Jump to content
IGNORED

run into MADS issue (again)


Recommended Posts

how would you deal with following (dummy code):

 

 

.rept 32

sty ?var+1

nop

?var ldy #0

.endr

 

it costs me yesterday quite time to debug that it actually put in all 32 references the last ?var adress.

 

How can I tell MADS to take the label of each code block of the 32?

Edited by Heaven/TQA
Link to comment
Share on other sites

Do you prefer a sledgehammer or an atomic bomb:

.rept 4
	.local
	sty	x+1
	nop
x	ldy	#0
	.endl
.endr

.rept 4,#
	sty	x:1+1
	nop
x:1	ldy	#0
.endr

The first method creates a local scope around each iteration, and the second incorporates the loop counter into the label name.

 

?var doesn't work because it's a temp label, and temp labels are order-dependent. It's specifically for cases where each reference needs to read the value from the previous update, so they can't be used for the cases where the definition comes after the reference.

Edited by phaeron
  • Like 2
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...