Pengwin #1 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 Share this post Link to post Share on other sites
Rybags #2 Posted March 10, 2012 From what I can see in the docs :4 lsr Quote Share this post Link to post Share on other sites
Pengwin #3 Posted March 10, 2012 Thanks, that was it Quote Share this post Link to post Share on other sites
+JAC! #4 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 1 Quote Share this post Link to post Share on other sites
NRV #5 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 Share this post Link to post Share on other sites