From 08fd9af5a9247f5c47b926259ed45cf6a437e67d Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 19 Feb 2016 06:43:11 -0500 Subject: save a byte in timed_getch, add conio doc --- timed_getch.s | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'timed_getch.s') diff --git a/timed_getch.s b/timed_getch.s index c996438..40a2722 100644 --- a/timed_getch.s +++ b/timed_getch.s @@ -38,11 +38,16 @@ _timed_getch: lda #$2c ; $012c jiffies = 5 sec (NTSC) or 6 sec (PAL) ldx #$01 jsr _set_jiffy_timer + @wait4key: lda CDTMV3 ; has timer counted down to 0? ora CDTMV3+1 - beq @done ; yes, return(0) - lda CH ; no, check for a keypress + bne @timer_running + tax ; timer expired, return(0), A is already 0 here + rts + +@timer_running: + lda CH ; no, check for a keypress ; ...but don't let the capslock or inverse keys count ; as a keypress, here. @@ -54,13 +59,7 @@ _timed_getch: cmp #$27 ; inverse (atari) key beq @wait4key - jmp _agetc_no_cursor ; user hit a key, read it. - -@done: - ;lda #$00 ; return(0), A is already 0 here - tax - rts - + ; user hit a key, handle it. but don't print a cursor. _agetc_no_cursor: jsr _cgetc jmp finish_agetc @@ -71,12 +70,14 @@ _agetc_no_cursor: ; (such as clear, delete, escape) are replaced with a space. ; extern unsigned char agetc(void); _agetc: - lda #$80 ; inverse space + ; show the user a cursor + lda #$80 ; inverse space (putchar uses screen codes) jsr putchar jsr _cgetc ; get ATASCII code of keypress - pha + + ; get rid of the cursor lda #$00 ; space jsr putchar pla -- cgit v1.2.3