add ToLower for simplified key handling

This commit is contained in:
Dagen Brock 2015-09-30 09:52:31 -05:00
parent 7f3066e1dd
commit b99f751c32
2 changed files with 129 additions and 2 deletions

127
src/misc.s Normal file
View File

@ -0,0 +1,127 @@
MenuCheckKeyColor jsr ColorizeMenu
lda _ticker
bne :skipDraw ; we want to avoid updating when nothing is happening... "Save the Cycles!!" ;)
jsr Menu_HighlightSelected
:skipDraw cmp #12
bne :skipUndraw
jsr Menu_UndrawSelectedAll
:skipUndraw cmp #16
bne :noReset
stz _ticker
jmp CheckKey ; Will RTS from CheckKey
:noReset inc _ticker
jmp CheckKey ; Will RTS from CheckKey
_ticker dw 0
CheckKey lda KEY
bpl :noKey
sta STROBE
sec
rts
:noKey clc
rts
ToLower cmp #"Z"
bcs :notUpper
cmp #"A"
bcc :notUpper
clc
adc #$20 ;add 32 to get lower char
:notUpper rts
WaitKey
:kloop
jsr ColorizeMenu
lda KEY
bpl :kloop
sta STROBE
cmp #"b" ; REMOVE DEBUG
bne :nobreak
brk $75
:nobreak
rts
ColorizeMenu
:loop
lda #6
jsr WaitSCB
lda #$A0 ; green
sta $c022
lda #7
jsr WaitSCB
lda #$c0 ; green
sta $c022
lda #9
jsr WaitSCB
lda #$d0 ; yello
sta $c022
lda #10
jsr WaitSCB
lda #$90 ; orange
sta $c022
lda #11
jsr WaitSCB
lda #$10 ; red
sta $c022
lda #12
jsr WaitSCB
lda #$30 ; purple
sta $c022
lda #13
jsr WaitSCB
lda #$70 ; bblue
sta $c022
lda #15
jsr WaitSCB
lda #$50 ; grey
sta $c022
lda #16
jsr WaitSCB
lda #$f0 ; white
sta $c022
rts
WaitSCB sta :val+1
ldx #2 ; to check twice
:waitloop lda $c02f
asl
lda $c02e
rol
:val cmp #$00
bne :waitloop
dex
bne :waitloop
; the problem is we can get the LAST
; horizcnt even/odd right as it changes
; and start early or something?
rts
MAXSCB db 0
PushAll MAC
pha
phx
phy
<<<
PopAll MAC
ply
plx
pla
<<<

View File

@ -196,8 +196,7 @@ Mesg_Done asc "DONE WITH TEST",$8D,00
TestKeyHandler sta $C010
cmp #"Q"
beq TestAbort
jsr ToLower
cmp #"q"
beq TestAbort
cmp #"p"
@ -1123,3 +1122,4 @@ BankMap ds 256 ;page-align ma
_stash ds 256
ds \