small keyboard reading fixes
This commit is contained in:
1 parent
a7cb7eb52e
commit
f9e3b57a79
14 files changed
+57
-26
No files matched your search
@@ -0,0 +1,4 @@
|
||||
$F142 is a well-known address of keyboard reading routine, described for example here:
|
||||
- http://sta.c64.org/cbm64kbdfunc.html
|
||||
|
||||
It is used for eexample by a music eeditor here: https://github.com/martinpiper/C64Public/blob/master/MusicEditor/GetKey.a
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
//
|
||||
// Well-known Kernal routine, described in:
|
||||
//
|
||||
// - http://sta.c64.org/cbm64kbdfunc.html
|
||||
//
|
||||
|
||||
|
||||
read_kb_buf:
|
||||
|
||||
// Check for a key
|
||||
lda NDX
|
||||
bne !+
|
||||
|
||||
// Nothing in keyboard buffer to read
|
||||
sec
|
||||
rts
|
||||
|
||||
!:
|
||||
lda KEYD
|
||||
pha
|
||||
phy_trash_a
|
||||
|
||||
jsr pop_keyboard_buffer
|
||||
|
||||
ply_trash_a
|
||||
pla
|
||||
clc
|
||||
|
||||
rts
|
||||
@@ -2,6 +2,10 @@
|
||||
//
|
||||
// Helper routine - disconnects the keyboard from CIA1_PRB,
|
||||
// leaves $FF in .X (behavior needed in some places)
|
||||
//
|
||||
|
||||
|
||||
#if !CONFIG_LEGACY_SCNKEY
|
||||
|
||||
|
||||
keyboard_disconnect:
|
||||
@@ -13,3 +17,6 @@ keyboard_disconnect:
|
||||
#endif
|
||||
|
||||
rts
|
||||
|
||||
|
||||
#endif
|
||||
@@ -2,7 +2,9 @@
|
||||
// Pop key out of keyboard buffer
|
||||
// Disable interrupts while reading from keyboard buffer
|
||||
// so that no race conditions can occur
|
||||
|
||||
//
|
||||
// CPU registers that has to be preserved: .X
|
||||
//
|
||||
|
||||
pop_keyboard_buffer:
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ SCNKEY:
|
||||
#endif
|
||||
|
||||
// Retrieve SHIFT / VENDOR / CTRL status
|
||||
// Use .X to detect 2 or more keys pressed (should be $FF now)
|
||||
|
||||
ldy #(__kb_matrix_bucky_confmask_end - kb_matrix_bucky_confmask - 1)
|
||||
scnkey_bucky_loop:
|
||||
@@ -154,7 +153,7 @@ scnkey_matrix_loop_inner:
|
||||
!:
|
||||
dey
|
||||
bpl scnkey_matrix_loop_inner
|
||||
bmi scnkey_no_keys // branch always, multiple keys must have been pressed
|
||||
bmi scnkey_no_keys // branch always, multiple keys must have been pressed
|
||||
scnkey_matrix_loop_next:
|
||||
dex
|
||||
bpl scnkey_matrix_loop
|
||||
|
||||
Reference in new issue
Block a user