From 3abf7993ce2d2deb1c0596f3404b2bfa27324564 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 17 Feb 2016 23:47:59 -0500 Subject: make the cursor behave *much* better, via custom conio function --- timed_getch.s | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'timed_getch.s') 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 -- cgit v1.2.3