Loops/Downward for: Difference between revisions

Content added Content deleted
No edit summary
Line 102: Line 102:
Code is called as a subroutine, i.e. "JSR ForLoop." OS/Hardware specific printing subroutines are unimplemented here.
Code is called as a subroutine, i.e. "JSR ForLoop." OS/Hardware specific printing subroutines are unimplemented here.
<lang 68000devpac>ForLoop:
<lang 68000devpac>ForLoop:
MOVE.B #10,D0
MOVE.W #10,D0
MOVE.W #9,D1 ;DBcc operates at word length so we need to clear the upper byte of the word.
loop:
loop:
JSR Print_D0_As_Ascii ;some routine that converts the digits of D0 into ascii characters and prints them to screen.
JSR Print_D0_As_Ascii ;some routine that converts the digits of D0 into ascii characters and prints them to screen.
DBRA D0,loop ;repeat until D0.W = $FFFF
SUBQ.B #1,D0
DBRA D1,loop ;repeat until D1.W = $FFFF
rts</lang>
rts</lang>