aboutsummaryrefslogtreecommitdiff
path: root/timed_getch.s
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2016-02-17 23:47:59 -0500
committerB. Watson <yalhcru@gmail.com>2016-02-17 23:47:59 -0500
commit3abf7993ce2d2deb1c0596f3404b2bfa27324564 (patch)
tree67b4cb01fb3b303a14edf41f6ffa56243d33af3a /timed_getch.s
parentb2f7604ac51db075201ea0aa40d002d3d5e7e071 (diff)
downloadtaipan-3abf7993ce2d2deb1c0596f3404b2bfa27324564.tar.gz
make the cursor behave *much* better, via custom conio function
Diffstat (limited to 'timed_getch.s')
-rw-r--r--timed_getch.s33
1 files changed, 20 insertions, 13 deletions
diff --git a/timed_getch.s b/timed_getch.s
index 510c885..c996438 100644
--- a/timed_getch.s
+++ b/timed_getch.s
@@ -1,7 +1,7 @@
.export _timed_getch, _set_jiffy_timer, _agetc, _numgetc
.export _yngetc, _lcgetc, _jsleep
- .import _cgetc, _cblank, _cursor, _rand
+ .import _cgetc, _cblank, putchar, _rand
.include "atari.inc"
@@ -54,30 +54,37 @@ _timed_getch:
cmp #$27 ; inverse (atari) key
beq @wait4key
- jmp _agetc ; user hit a key, read it.
+ jmp _agetc_no_cursor ; user hit a key, read it.
@done:
;lda #$00 ; return(0), A is already 0 here
tax
rts
+_agetc_no_cursor:
+ jsr _cgetc
+ jmp finish_agetc
+
; _agetc removes the inverse-video bit, and if
; a control key is pressed, it turns it into the non-control version
; (e.g. ^A = lowercase a). Keys that can't be mapped to regular ASCII
; (such as clear, delete, escape) are replaced with a space.
; extern unsigned char agetc(void);
_agetc:
- lda #1 ; show cursor
- jsr _cursor
- sta FR1+2 ; save old cursor status
- lda #1
- jsr _cblank
+ lda #$80 ; inverse space
+ jsr putchar
jsr _cgetc ; get ATASCII code of keypress
+ pha
+ lda #$00 ; space
+ jsr putchar
+ pla
+
+finish_agetc:
+ pha
; twitch the random bottle based on the low bit of
; the character entered.
- pha
and #$01
beq @nr
jsr _rand
@@ -107,11 +114,11 @@ notcontrol:
bcc ok ; (remember, $7e, backspace, was handled above)
lda #$20
ok:
- pha
- ldx #0
- lda FR1+2
- jsr _cursor
- pla
+; pha
+; ldx #0
+; lda FR1+2
+; jsr _cursor
+; pla
ldx #0
rts