I'm still working on my Apollo DSKY on the 3k Vic 20

I'm trying to. Move the cursor to a specific row/col , get a 2 character input and check that it is made up of numbers.
Here's my code - suffice to say it doesn't work quite right...
Code: Select all
verb_input jsr t_clbuff ; clear kb buffer
lda #0
sta TMPCH ; initialise good input flag
lda #13 ; set input cursor location column
sta $00ca
lda #6 ; set input cursor location row
sta $00c9
sta $00cc ; turn cursor on
vi_getchr jsr $f20e ; call CHRIN
lda $00c6 ; how many keys pressed
cmp #2 ; verbs are 2 characters long
bne vi_getchr ; go back to get next char
ldx #2 ; we'll loop twice as their should be 2 chars
ldy #10 ; we'll scan for 0 to 9 in the kb buffer
vi_readbuf lda $277,x ; read char from kb buffer
vi_ckval cmp VALIDKEYS,y ; check the key is numeric
beq vi_goodkey ; if we detect a numeric set a flag
vi_cont dey ; decrement y
bne vi_ckval ; if not done loop for next key check
lda TMPCH ; was a good input made? if so TMPCH will be 1
beq vi_exit ; if not exit
dex ; loop to next character
bne vi_readbuf ; loop back for next char
vi_exit lda #1 ; tidy up
sta $00cc ; turn cursor off
jsr t_clbuff ; clear kb buffer
rts ; done
vi_goodkey lda #1 ; flag that a good key was pressed
sta TMPCH ; save the flag as a 1
jmp vi_cont ; continue processing
Thanks