Heaven/TQA Posted January 7, 2015 Share Posted January 7, 2015 (edited) 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 January 7, 2015 by Heaven/TQA Quote Link to comment Share on other sites More sharing options...
phaeron Posted January 7, 2015 Share Posted January 7, 2015 (edited) 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 January 7, 2015 by phaeron 2 Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted January 7, 2015 Author Share Posted January 7, 2015 (edited) aaarg.... thanks! now my self modifiing code might work . well... tested... Works! would have saved me hours yesterday. again lesson learned. Edited January 7, 2015 by Heaven/TQA Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.