gethex supports backspace
This commit is contained in:
parent
2d12b2971a
commit
0913a5fd89
23
src/menu.s
23
src/menu.s
|
@ -443,16 +443,31 @@ Menu_TypeList
|
||||||
rts
|
rts
|
||||||
*** INPUT LIBRARY FOR MENU
|
*** INPUT LIBRARY FOR MENU
|
||||||
* Pass desired length in A
|
* Pass desired length in A
|
||||||
GetHex sta _gethex_maxlen
|
GetHex
|
||||||
|
sta _gethex_maxlen
|
||||||
stx _gethex_resultptr
|
stx _gethex_resultptr
|
||||||
sty _gethex_resultptr+1
|
sty _gethex_resultptr+1
|
||||||
stz _gethex_current
|
stz _gethex_current
|
||||||
|
lda $24
|
||||||
|
sta _gethex_screenx ;stash x. gets clobbered by RDKEY
|
||||||
|
|
||||||
:input jsr RDKEY
|
:input jsr RDKEY
|
||||||
|
|
||||||
cmp #$9B ;esc = abort
|
cmp #$9B ;esc = abort
|
||||||
bne :notesc
|
bne :notesc
|
||||||
rts
|
rts
|
||||||
:notesc cmp #"9"+1
|
:notesc cmp #$FF ;del
|
||||||
|
beq :goBack
|
||||||
|
cmp #$88
|
||||||
|
bne :notBack
|
||||||
|
:goBack
|
||||||
|
lda _gethex_current
|
||||||
|
beq :badChar ; otherwise result = -1
|
||||||
|
dec _gethex_current
|
||||||
|
dec _gethex_screenx
|
||||||
|
GOXY _gethex_screenx;$25
|
||||||
|
bra :input
|
||||||
|
:notBack cmp #"9"+1
|
||||||
bcs :notNum ;bge > 9
|
bcs :notNum ;bge > 9
|
||||||
cmp #"0"
|
cmp #"0"
|
||||||
bcc :badChar ;
|
bcc :badChar ;
|
||||||
|
@ -476,6 +491,7 @@ GetHex sta _gethex_maxlen
|
||||||
pla
|
pla
|
||||||
ldy _gethex_current
|
ldy _gethex_current
|
||||||
sta _gethex_buffer,y
|
sta _gethex_buffer,y
|
||||||
|
inc _gethex_screenx
|
||||||
iny
|
iny
|
||||||
cpy #_gethex_internalmax
|
cpy #_gethex_internalmax
|
||||||
bge :internalmax
|
bge :internalmax
|
||||||
|
@ -507,13 +523,14 @@ GetHex sta _gethex_maxlen
|
||||||
bcc :copyBuffer
|
bcc :copyBuffer
|
||||||
rts
|
rts
|
||||||
|
|
||||||
:badChar bra :input
|
:badChar jmp :input
|
||||||
|
|
||||||
_gethex_internalmax equ 8
|
_gethex_internalmax equ 8
|
||||||
_gethex_resultptr da 0000
|
_gethex_resultptr da 0000
|
||||||
_gethex_maxlen db 1
|
_gethex_maxlen db 1
|
||||||
_gethex_current db 0
|
_gethex_current db 0
|
||||||
_gethex_buffer ds _gethex_internalmax
|
_gethex_buffer ds _gethex_internalmax
|
||||||
|
_gethex_screenx db 0
|
||||||
PrHexChar jsr HexCharForByte
|
PrHexChar jsr HexCharForByte
|
||||||
|
|
||||||
HexCharForByte
|
HexCharForByte
|
||||||
|
|
Loading…
Reference in New Issue