WIP quick hack to check keyboard

this for some reason only works ONCE
though I can replicate the logic in BASIC
and it works over multiple keys
not sure what's wrong
This commit is contained in:
Brooke Vibber 2023-03-05 15:45:44 -08:00
parent 24abc21b01
commit 53336f7af1

View file

@ -42,6 +42,9 @@ CIX = $f2 ; u8 - index into INBUFF
INBUFF = $f3 ; u16 - pointer to ascii INBUFF = $f3 ; u16 - pointer to ascii
FLPTR = $fc ; u16 - pointer to user buffer float48 FLPTR = $fc ; u16 - pointer to user buffer float48
CH1 = $02f2 ; previous character read from keyboard
CH = $02fc ; current character read from keyboard
LBUFF = $0580 ; result buffer for FASC routine LBUFF = $0580 ; result buffer for FASC routine
; FP ROM routine vectors ; FP ROM routine vectors
@ -73,15 +76,21 @@ stride = width >> 2
DMACTL = $D400 DMACTL = $D400
DLISTL = $D402 DLISTL = $D402
DLISTH = $D403 DLISTH = $D403
WSYNC = $D40A
; OS shadow registers ; OS shadow registers
SDLSTL = $230 SDLSTL = $230
SDLSTH = $231 SDLSTH = $231
; interrupt stuff ; interrupt stuff
SYSVBV = $E45F
XITVBV = $E462 XITVBV = $E462
SETVBV = $E45C SETVBV = $E45C
; Keys
KEY_RIGHT = $07
.struct float48 .struct float48
exponent .byte exponent .byte
mantissa .byte 6 mantissa .byte 6
@ -126,6 +135,9 @@ char_map:
.byte 96 + i .byte 96 + i
.endrepeat .endrepeat
hex_chars:
.byte "0123456789abcdef"
aspect: aspect:
; aspect ratio! ; aspect ratio!
; pixels at 320w are 5:6 (narrow) ; pixels at 320w are 5:6 (narrow)
@ -888,6 +900,33 @@ loop_sx:
jsr mandelbrot jsr mandelbrot
jsr pset jsr pset
; check keyboard buffer
lda CH
cmp #$ff
beq skip_char
; Clear the keyboard buffer
ldx #$ff
stx CH
tax
lsr a
lsr a
lsr a
lsr a
tay
lda hex_chars,y
sta temp
txa
and #$0f
tay
lda hex_chars,y
sta temp + 1
draw_text 14, 2, temp
skip_char:
; check if we should update the counters ; check if we should update the counters
; ;