summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornot_a_robot06 <temporarythrowaway@tutamail.com>2025-02-15 19:56:14 +0000
committernot_a_robot06 <temporarythrowaway@tutamail.com>2025-02-15 19:56:14 +0000
commit4db3c9071d5a22123f3ee0d49ce709c47c4a4a71 (patch)
treea6c97bb42991061cc228782f85798ed5af49719f
parent424240eb2f9f78d8ea648feab4a32cc0fdbea194 (diff)
downloadc64-life-4db3c9071d5a22123f3ee0d49ce709c47c4a4a71.tar.gz
c64-life-4db3c9071d5a22123f3ee0d49ce709c47c4a4a71.tar.bz2
c64-life-4db3c9071d5a22123f3ee0d49ce709c47c4a4a71.zip
use chrout to clear screen
- turns out there are kernal routines for handling cursors and printing so is the proper way to do things
-rw-r--r--life.asm35
1 files changed, 5 insertions, 30 deletions
diff --git a/life.asm b/life.asm
index 1e3a6af..2745dc6 100644
--- a/life.asm
+++ b/life.asm
@@ -5,10 +5,14 @@ numL := $02 ; low byte of a 16-bit number
numH := $03 ; low byte of a 16-bit number
key_buf_len := $c6
key_buf := $0277
+CHROUT := $ffd2
; initialisation: clear screen and set num to point to screen mem start
init:
- jsr clear_screen
+ ; clear screen
+ lda #$93
+ jsr CHROUT
+
ldy #$00
lda #$04
sta numH
@@ -77,35 +81,6 @@ key_wait_loop:
pla
rts
-; clear the screen by filling it with spaces
-; destroys: A, Y, numL & numH (in memory)
-clear_screen:
- ; init: y = 0 because you can't use indirect addressing without a register,
- ; load start of screen memory into numL/numH
- ldy #0
- lda #$04
- sta numH
- lda #$00
- sta numL
- jmp cs_loop
-
- ; add 1 to high bit, return if $08 (screen mem only goes to $07ff)
- add_carry:
- inc numH
- lda numH
- cmp #$08
- bne cs_loop
- rts
-
- ; store a space in current screen mem address as specified by num, branch if
- ; number overflows to 0 (i.e. add 1 to high bit of 16 bit number)
- cs_loop:
- lda #$20
- sta (numL),y
- inc numL
- beq add_carry
- jmp cs_loop
-
; print byte in A at location in num
print_byte:
; init: store original A in X and push Y to stack