136 lines
2.6 KiB
Plaintext
136 lines
2.6 KiB
Plaintext
|
.include "system.h65"
|
||
|
.include "string.h65"
|
||
|
.include "keypad.h65"
|
||
|
.include "lcd.h65"
|
||
|
.include "ps2_keyboard_simple_handler.h65"
|
||
|
.include "ps2_keyboard_text_handler.h65"
|
||
|
|
||
|
.export ps2_keyboard_util
|
||
|
|
||
|
.import home:absolute
|
||
|
|
||
|
.code
|
||
|
.proc ps2_keyboard_util
|
||
|
stz kp::_DEBUG_VAL
|
||
|
jsr skb::init
|
||
|
beq print_menu
|
||
|
ps2kb_PrintCmdFailed
|
||
|
bra loop
|
||
|
print_menu:
|
||
|
Print MENU
|
||
|
loop:
|
||
|
wai
|
||
|
lda skb::scancode
|
||
|
beq @read_keypad
|
||
|
Printf FMT_CODE,skb::scancode
|
||
|
stz skb::scancode
|
||
|
@read_keypad:
|
||
|
lda kp::_DEBUG_VAL
|
||
|
jeq loop
|
||
|
stz kp::_DEBUG_VAL
|
||
|
cmp #'*'
|
||
|
jeq home
|
||
|
pha
|
||
|
jsr lcd::clear
|
||
|
pla
|
||
|
ldy #0 ; arg for commands
|
||
|
ldx #ps2kb::NO_DATA
|
||
|
cmp #'0'
|
||
|
beq @l0
|
||
|
cmp #'1'
|
||
|
beq @l1
|
||
|
cmp #'2'
|
||
|
beq @l2
|
||
|
cmp #'3'
|
||
|
beq @l3
|
||
|
cmp #'4'
|
||
|
beq @l4
|
||
|
cmp #'5'
|
||
|
beq @l5
|
||
|
cmp #'6'
|
||
|
beq @l6
|
||
|
cmp #'7'
|
||
|
beq @l7
|
||
|
cmp #'8'
|
||
|
beq @l8
|
||
|
cmp #'9'
|
||
|
beq @l9
|
||
|
cmp #'#'
|
||
|
beq @lhash
|
||
|
cmp #'A'
|
||
|
beq @lA
|
||
|
cmp #'B'
|
||
|
beq @lB
|
||
|
cmp #'C'
|
||
|
beq @lC
|
||
|
cmp #'D'
|
||
|
beq @lD
|
||
|
jsr lcd::print_char
|
||
|
jmp loop
|
||
|
@l0: ; get scancode set
|
||
|
lda #$f0
|
||
|
ldx #0
|
||
|
ldy #1
|
||
|
bra @send_cmd
|
||
|
@l1: ; echo
|
||
|
lda #$ee
|
||
|
bra @send_cmd
|
||
|
@l2: ; identify
|
||
|
lda #$f2
|
||
|
ldy #2
|
||
|
bra @send_cmd
|
||
|
@l3: ; set typematic min speed and delay
|
||
|
lda #$f3
|
||
|
ldx #%01111111
|
||
|
bra @send_cmd
|
||
|
@l4: ; enable
|
||
|
lda #$f4
|
||
|
bra @send_cmd
|
||
|
@l5: ; disable
|
||
|
lda #$f5
|
||
|
bra @send_cmd
|
||
|
@l6: ; set typematic max speed and min delay
|
||
|
lda #$f3
|
||
|
ldx #0
|
||
|
bra @send_cmd
|
||
|
@l7: ; set typematic all
|
||
|
lda #$f7
|
||
|
bra @send_cmd
|
||
|
@l8: ; set make/release all
|
||
|
lda #$f8
|
||
|
bra @send_cmd
|
||
|
@l9: ; set CAPSLOCK
|
||
|
lda #$ed
|
||
|
ldx #kb::MOD::CAPSLOCK
|
||
|
bra @send_cmd
|
||
|
@lhash: ; set SCROLLLOCK led
|
||
|
lda #$ed
|
||
|
ldx #kb::MOD::SCROLLLOCK
|
||
|
bra @send_cmd
|
||
|
@lC: ; set NUMLOCK led
|
||
|
lda #$ed
|
||
|
ldx #kb::MOD::NUMLOCK
|
||
|
bra @send_cmd
|
||
|
@lD: ; turn all leds off
|
||
|
lda #$ed
|
||
|
ldx #0
|
||
|
bra @send_cmd
|
||
|
@lA:
|
||
|
; TODO
|
||
|
@lB: ; reprint menu
|
||
|
jmp print_menu
|
||
|
@send_cmd:
|
||
|
jsr ps2kb::send_command
|
||
|
ps2kb_WaitFinishCmd
|
||
|
Printf FMT_CMD_DATA, ps2kb::send_cmd, ps2kb::send_data, ps2kb::cmd_response, ps2kb::cmd_response+1, ps2kb::cmd_response+2
|
||
|
jmp loop
|
||
|
.endproc
|
||
|
|
||
|
.rodata
|
||
|
FMT_CODE: .asciiz "K %x "
|
||
|
FMT_CMD_DATA: .asciiz "C %x-%x > %x%x%x"
|
||
|
MENU: .byte " EE F2 F3 "
|
||
|
.byte " F4 F5 F3' MEN"
|
||
|
.byte " T1 T0 LC LN "
|
||
|
.asciiz " RET F0 LS L0 "
|