Open main menu

CDOT Wiki β

Changes

6502 Counting Loop Example

21 bytes added, 02:00, 11 September 2023
no edit summary
LDX #$00 ; Loop index (0-9)
GOLINE:
TXA ; Put loop index into A
CLC
LDY #$00 ; Character number to print
DOCHARACTER:
LDA MSG,Y ; Get a character
BEQ DONE ; Done if it's NULL
JSR CHROUT ; Print character
INY ; Increment char number
JMP DO CHARACTER ; Process next character
DONE:
INX ; Increment loop index
CPX #10 ; Is it 10?
BNE GO LINE ; If not, branch to GOprint next line
BRK ; Stop