summaryrefslogtreecommitdiff
path: root/life.asm
diff options
context:
space:
mode:
Diffstat (limited to 'life.asm')
-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