62 lines
1.3 KiB
Plaintext
62 lines
1.3 KiB
Plaintext
.include "lcd.h65"
|
|
.include "string.h65"
|
|
.include "ps2_keyboard_text_handler.h65"
|
|
|
|
.export ps2_keyboard_printer
|
|
|
|
.import home:absolute
|
|
|
|
.code
|
|
|
|
;;********************************************************************************
|
|
;; @brief Print characters to the display when a key was pressed
|
|
;; @details
|
|
;; Print the character that corresponds to a key.
|
|
;; This uses the @ref kb "text keyboard handler" to correctly handle modifier keys
|
|
;;
|
|
;; Controls:
|
|
;; - `ESC`: Jump home
|
|
;; - `Print`: Clear the display
|
|
;; - `F12`: Restart the program
|
|
;; @ingroup applications keyboard
|
|
;;********************************************************************************
|
|
.proc ps2_keyboard_printer
|
|
jsr lcd::clear
|
|
jsr kb::init
|
|
jeq loop
|
|
ps2kb_PrintCmdFailed
|
|
; jmp homeloop
|
|
ps2kb_CmdEnable
|
|
jsr ps2kb::begin_receive
|
|
|
|
loop:
|
|
wai
|
|
; ; put shift, ralt and lalt in debug leds
|
|
; lda kb::modifier
|
|
; Reverse A
|
|
; and #%00000111
|
|
; ora IO1 + IO::RANH
|
|
; sta IO1 + IO::RANH
|
|
lda kb::char
|
|
beq @no_char
|
|
stz kb::char
|
|
jsr lcd::print_char
|
|
bra loop
|
|
@no_char:
|
|
lda kb::keycode
|
|
beq loop
|
|
stz kb::keycode
|
|
cmp #kb::K::ESCAPE
|
|
beq @esacpe
|
|
cmp #kb::K::PRINT
|
|
beq @clear_display
|
|
cmp #kb::K::F12
|
|
jeq ps2_keyboard_printer
|
|
bra loop
|
|
@esacpe:
|
|
jmp home
|
|
@clear_display:
|
|
jsr lcd::clear
|
|
bra loop
|
|
.endproc
|