From 4db3c9071d5a22123f3ee0d49ce709c47c4a4a71 Mon Sep 17 00:00:00 2001 From: not_a_robot06 Date: Sat, 15 Feb 2025 19:56:14 +0000 Subject: use chrout to clear screen - turns out there are kernal routines for handling cursors and printing so is the proper way to do things --- life.asm | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) (limited to 'life.asm') 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 -- cgit v1.2.3