vault backup: 2022-08-01 10:30:55

This commit is contained in:
Jet Hughes 2022-08-01 10:30:55 +12:00
parent 40faca8a96
commit 3b1037236f

View File

@ -54,7 +54,7 @@ message:
.byte "HELLO WORLD", 0
START:
ldy #message ; load
ldy #message ; load "message", into the y register
bsr puts ; branch to the "puts" subroutine
rts ; return
@ -67,14 +67,14 @@ PUTS:
pshs a,x,y ; save a, x, and y ; store the contents of the a, x, and y registers so they are not overwritten
ldx #screen ; start of screen ; load the hex value of the memory location of the screen ($0400) into the x register
more:
lda 0,y+ ; current char -> A ; load
cmpa #$00 ; was it a zero?
beq done ; if it was 0 then return
sta 0,x+ ; write
bra more ; repeat
lda 0,y+ ; current char -> A ; load the contents of the Y register into the A register and increment Y by one
cmpa #$00 ; was it a zero? ; if the character loaded into A was a zero set the equal flag
beq done ; if it was 0 then return ; if the equal flag is set, branch to the "done" subroutine
sta 0,x+ ; write ; otherwise, store the contents of the A register into memory at the location (hex value) defined in the X register, and increment the hex value stored in the X register
bra more ; repeat ; branch to the "more" subroutine as there are more character to write
done:
puls a,x,y ; restore a, x, y
rts ; return from this routine
puls a,x,y ; restore a, x, y ; re load the stored values of the a, x, and y registers that were saved earlier
rts ; return from this routine
```
# Hello World