mirror of
https://github.com/irmen/prog8.git
synced 2025-02-04 02:30:19 +00:00
keyboardhandler
This commit is contained in:
parent
00b717cde8
commit
197081f10d
@ -15,9 +15,9 @@ sealed class PtExpression(val type: DataType, position: Position) : PtNode(posit
|
||||
if(type==DataType.UNDEFINED) {
|
||||
@Suppress("LeakingThis")
|
||||
when(this) {
|
||||
is PtBuiltinFunctionCall -> {}
|
||||
is PtFunctionCall -> {}
|
||||
is PtIdentifier -> {}
|
||||
is PtBuiltinFunctionCall -> { /* void function call */ }
|
||||
is PtFunctionCall -> { /* void function call */ }
|
||||
is PtIdentifier -> { /* non-variable identifier */ }
|
||||
else -> throw IllegalArgumentException("type should be known @$position")
|
||||
}
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ cx16 {
|
||||
&uword ISTOP = $0328
|
||||
&uword IGETIN = $032a
|
||||
&uword ICLALL = $032c
|
||||
&uword KEYHDL = $032e ; keyboard scan code handler
|
||||
&uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8
|
||||
&uword ILOAD = $0330
|
||||
&uword ISAVE = $0332
|
||||
&uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in
|
||||
|
@ -6,7 +6,7 @@ main {
|
||||
|
||||
sub start() {
|
||||
|
||||
txt.print("ps2 scancode handler test - press keys! esc to quit!\n")
|
||||
txt.print("ps2 custom key handler test - press keys! esc to quit!\n")
|
||||
|
||||
sys.set_irqd()
|
||||
uword old_keyhdl = cx16.KEYHDL
|
||||
@ -22,7 +22,7 @@ main {
|
||||
sys.clear_irqd()
|
||||
}
|
||||
|
||||
sub keyboard_scancode_handler(ubyte prefix, ubyte scancode, bool updown) {
|
||||
sub keyboard_scancode_handler(ubyte prefix, ubyte scancode, bool updown) -> bool {
|
||||
txt.print_ubhex(prefix, true)
|
||||
txt.chrout(':')
|
||||
txt.print_ubhex(scancode, true)
|
||||
@ -36,7 +36,7 @@ main {
|
||||
; escape was pressed! exit back to basic
|
||||
main.start.escape_pressed = true
|
||||
}
|
||||
return
|
||||
return true ; true = consume key event, false = continue processing it
|
||||
|
||||
asm_shim:
|
||||
%asm {{
|
||||
@ -49,8 +49,15 @@ asm_shim:
|
||||
+ stx prefix
|
||||
sta scancode
|
||||
jsr keyboard_scancode_handler
|
||||
beq +
|
||||
plx
|
||||
pla
|
||||
lda #0 ;By setting A=0 we will consume this key event
|
||||
tax
|
||||
plp
|
||||
rts
|
||||
+ plx
|
||||
pla ; leave A untouched, continue processing
|
||||
plp
|
||||
rts
|
||||
}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user