Changes

Jump to: navigation, search

6502 Counting Loop Example

63 bytes added, 03:45, 18 December 2023
no edit summary
[[Category:6502 Assembler]][[Category:SPO600]]Here is a solution for part of the [[SPO600 64-bit Assembly Language Lab]] but implemented in 6502 Assembly language for use with the [[6502 Emulator]]:
; ROM routines
START:
JSR SCINIT ; Initialize and clear the screen
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

Navigation menu