diff options
author | B. Watson <yalhcru@gmail.com> | 2016-02-19 06:43:11 -0500 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2016-02-19 06:43:11 -0500 |
commit | 08fd9af5a9247f5c47b926259ed45cf6a437e67d (patch) | |
tree | 5b1b9baf7da562d74493121caa71bc64619b3ea4 /timed_getch.s | |
parent | 53c1088fff0e8c8730622449dc863bbab938801c (diff) | |
download | taipan-08fd9af5a9247f5c47b926259ed45cf6a437e67d.tar.gz |
save a byte in timed_getch, add conio doc
Diffstat (limited to 'timed_getch.s')
-rw-r--r-- | timed_getch.s | 23 |
1 files changed, 12 insertions, 11 deletions
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 |