vault backup: 2022-08-01 10:20:54

This commit is contained in:
Jet Hughes 2022-08-01 10:20:55 +12:00
parent 6e188762f5
commit 40faca8a96

View File

@ -40,7 +40,42 @@ other instructions set flags too
# Input/Output
![screen](https://i.imgur.com/IEiGKtj.png)
The screen always displays whatever is in the "screens memory location" which is $0400
``` 6809 assembly
lda #'H' ; load the character (indicated by '') into the a register
sta $0400 ; store the contents of the a register in memory at location $0400
```
## printing a whole string
```
message:
.byte "HELLO WORLD", 0
START:
ldy #message ; load
bsr puts ; branch to the "puts" subroutine
rts ; return
; Routine: PUTS
; Pass the address of the string in Y
;
screen EQU $0400 ; start of screen
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
done:
puls a,x,y ; restore a, x, y
rts ; return from this routine
```
# Hello World