Pengwin Posted March 10, 2012 Share Posted March 10, 2012 I am trying to work my way through the 'translated' MADS documentation, but the 'repeat' instructions are just notmaking sense to me. Could some explain how to repeat a line of code? So I don't need to put in things like: lsr lsr lsr lsr or do that I could create a macro to repeat something x amount of times using a parameter? Quote Link to comment Share on other sites More sharing options...
Rybags Posted March 10, 2012 Share Posted March 10, 2012 From what I can see in the docs :4 lsr Quote Link to comment Share on other sites More sharing options...
Pengwin Posted March 10, 2012 Author Share Posted March 10, 2012 Thanks, that was it Quote Link to comment Share on other sites More sharing options...
+JAC! Posted March 10, 2012 Share Posted March 10, 2012 or for more complex stuff use .REPT/ENDR with preset parameters based on the iteration count (#) .rept 4,#,#*2 lda $1000+:1 sta $2000+:2 .endr => 4 4000 AD 00 10 lda $1000+0 5 4003 8D 00 20 sta $2000+0 4 4006 AD 01 10 lda $1000+1 5 4009 8D 02 20 sta $2000+2 4 400C AD 02 10 lda $1000+2 5 400F 8D 04 20 sta $2000+4 4 4012 AD 03 10 lda $1000+3 5 4015 8D 06 20 sta $2000+6 2 Quote Link to comment Share on other sites More sharing options...
NRV Posted March 10, 2012 Share Posted March 10, 2012 or for more complex stuff use .REPT/ENDR with preset parameters based on the iteration count (#) .rept 4,#,#*2 lda $1000+:1 sta $2000+:2 .endr Nice, didn't know that you can use parameters with .REPT (I would have used # and #*2 directly in the inside). You can also use the iteration count # with the other format: :4 sta $2000+#*2 ==> sta $2000 sta $2002 sta $2004 sta $2006 Sometime ago I would have liked to nest .REPT statements, but I couldn't .. I don't know if it's possible now (but you can use the :n format inside a .REPT) 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.