Jump to content
IGNORED

Having trouble with a RAM label in self-modifying code (DASM)


Recommended Posts

I adapted a self-modifying 48-pixel routine from JAC!'s Silly Venture 2017 Invitro for a little personal project, and for some reason the address of one of the immediate operands in the routine, 4thColumn, is being treated as an absolute address instead of zero-page, even when zero-page addressing is specified with the .z suffix applied to a STA. Could someone help me figure out why DASM is running into this issue? I'm running version 2.20.11 on Windows.

 

Here is the listing for my RAM declarations so far:

     10 U0000 ????				      seg.u	RAM
     11 U0080					      org	$80
     12 U0080
     13 U0080		       00 00 00 00*ramDraw    ds	52	;buffer for self-modifying code
     14 U0080		       00 81	   loadIndex  equ	ramDraw + 1	;immediate operand, init'ed before draw
     15 U0080		       00 8f	   colorTable equ	ramDraw + 15	;bottom of sliding color window, init'ed during vblank
     16 U0080		       00 a6	   4thColumn  equ	ramDraw + 38	;immediate operand, set in media res
     17 U00b4		       00	   temp       ds	1
     18 U00b5		       00 00	   bgPtr      ds	2
     19 U00b7		       00	   gfxHeight  ds	1
Here are all the store instructions that I will use in relation to the self-modifying kernel (to be clear, I wish to avoid needing to use the .z suffix). I see that DASM isn't initializing the 4thColumn address.

    124  f8ab		       85 81		      sta	loadIndex
    125  f8ad		       85 8f		      sta	colorTable
    126  f8af		       85 90		      sta	colorTable+1
C:\Users\galen\Desktop\vcsdev\big_mood.asm (127): error: Syntax Error '4thColumn'.
    127  f8b1		       8d 00 00 	      sta	4thColumn
C:\Users\galen\Desktop\vcsdev\big_mood.asm (128): error: Syntax Error '4thColumn'.
    128  f8b4               8d 00 00           sta.z    4thColumn
And here is the issue exhibited in context:

     99  f876				   ramDrawTemplate
    100  f876		       a0 00		      ldy	#00	;02 , 63:189 (loadIndex @ +1)
    101  f878		       b9 00 00 	      lda	gfx0,y	;04 , 67
    102  f87b		       85 1b		      sta	GRP0	;03 , 70
    103  f87d		       85 02		      sta	WSYNC	;!0
    104  f87f		       b9 00 00 	      lda	gfx1,y	;04 , 04
    105  f882		       85 1c		      sta	GRP1	;03 , 07
    106  f884		       b9 00 00 	      lda	clrTab,y	;04 , 11:033 (colorTable @ +15)
    107  f887		       8d 08 01 	      sta	$100+COLUPF	;04 , 15
    108  f88a		       b9 00 00 	      lda	gfx2,y	;04 , 19
    109  f88d		       85 1b		      sta	GRP0	;03 , 22
    110  f88f		       b9 00 00 	      lda	gfx3,y	;04 , 26
C:\Users\galen\Desktop\vcsdev\big_mood.asm (111): error: Syntax Error '4thColumn'.
    111  f892		       8d 00 00 	      sta.z	4thColumn	;03 , 29
    112  f895		       be 00 00 	      ldx	gfx4,y	;04 , 33
    113  f898		       b9 00 00 	      lda	gfx5,y	;04 , 37
    114  f89b		       a8		      tay		;02 , 39
    115  f89c		       a9 00		      lda	#00	;02 , 41:123 (4thColumn @ +38)
    116  f89e		       85 1c		      sta	GRP1	;03 , 44
    117  f8a0		       86 1b		      stx	GRP0	;03 , 47
    118  f8a2		       84 1c		      sty	GRP1	;03 , 50
    119  f8a4		       84 1b		      sty	GRP0	;03 , 53
    120  f8a6		       c6 81		      dec	loadIndex	;05 , 58
    121  f8a8		       d0 cc		      bne	ramDrawTemplate	;*2 , 60/61
    122  f8aa		       60		      rts		;06 , 66:198 - 52 bytes
The graphics and color addresses are uninitialized because I haven't written those tables yet. I just need to get past this stumbling block in the immediate operand. Edited by TheHoboInYourRoom
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...