From 052534e53d0be93b58ca47b56141ea36da58156e Mon Sep 17 00:00:00 2001 From: Jet Hughes Date: Thu, 28 Jul 2022 11:24:22 +1200 Subject: [PATCH] vault backup: 2022-07-28 11:24:22 --- content/notes/06-6809-programming.md | 51 ++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/content/notes/06-6809-programming.md b/content/notes/06-6809-programming.md index 811a8c2a3..26321a4ce 100644 --- a/content/notes/06-6809-programming.md +++ b/content/notes/06-6809-programming.md @@ -64,3 +64,54 @@ beq somewhere ## 6809.uk text screen ![](https://i.imgur.com/dC1idMA.png) + +write h to top left +``` +lda #'H' +sta $0400 +``` + +add an 'e' beside that +``` +lda #'E' +sta $0401 +``` + +## print routine +![](https://i.imgur.com/IEiGKtj.png) + +- pass the address of the string in Y +- "address" - the index into the memory array the hold the first character of the string +- use $00 to end the string + +## algorithm +- print a string + - Load a character from memory\[Y] + - Move on to the next character (Y++) + - Compare the character to $00 If equal exit this routine + - Write the character to the screen + - Move on to the next screen location + - GOTO start + +PUTS() + +``` +; +; +Routine: PUTS +; Pass the address of the string in Y +; +PUTS: + ldx #$0400 ; start of screen +more: + lda 0,y ; current char -> A (load y into a) + leay 1,y ; increment y + cmpa #$00 ; was it a zero? + beq done ; if it was 0 then return + sta 0,x ; write (store a in x) + leax 1,x ; increment x + bra more ; repeat +done: + rts ; return from this routine +``` +