From 5e28639a4e13516efdbc6787c7342feb83831ed0 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Tue, 12 Dec 2017 05:00:29 -0800 Subject: [PATCH] alpha works, but esc crashes --- bbb2.system.s | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/bbb2.system.s b/bbb2.system.s index 54fc2cb..2576120 100644 --- a/bbb2.system.s +++ b/bbb2.system.s @@ -404,21 +404,6 @@ handy_rts: ;;; ------------------------------------------------------------ -.proc down_common - lda current_entry - inc a - cmp num_entries ; past the limit? - bcs handy_rts ; yes, just redraw - sta current_entry ; go to next - - lda CV - cmp #bottom_row ; at the bottom? - bne handy_rts - inc page_start ; yes, adjust page and - lda #ASCII_ETB ; scroll screen down - jmp COUT ; implicit rts -.endproc - .proc on_down jsr down_common bra draw_current_line_inv @@ -443,14 +428,12 @@ handy_rts: ;;; ------------------------------------------------------------ .proc on_alpha -loop: lda KBD +loop: jsr down_common + lda KBD and #$5F ; make ASCII and uppercase - dec a ldy #1 cmp (curr_ptr),y ; key < first char ? - bcc draw_current_line_inv - - jsr down_common + beq draw_current_line_inv jsr draw_current_line bra loop .endproc @@ -493,6 +476,25 @@ draw_current_line_inv: ;; fall through .endproc +.proc down_common + lda current_entry + inc a + cmp num_entries ; past the limit? + bcc :+ + pla ; yes - abort subroutine + pla + bra draw_current_line_inv + +: sta current_entry ; go to next + + lda CV + cmp #bottom_row ; at the bottom? + bne handy_rts + inc page_start ; yes, adjust page and + lda #ASCII_ETB ; scroll screen down + jmp COUT ; implicit rts +.endproc + ;;; ------------------------------------------------------------ .proc on_escape