small keyboard reading fixes
This commit is contained in:
1 parent
a7cb7eb52e
commit
f9e3b57a79
14 files changed
+57
-26
No files matched your search
@@ -134,7 +134,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on
|
|||||||
| `$FFDB` | | `SETTIM` | DONE | |
|
| `$FFDB` | | `SETTIM` | DONE | |
|
||||||
| `$FFDE` | | `RDTIM` | DONE | |
|
| `$FFDE` | | `RDTIM` | DONE | |
|
||||||
| `$FFE1` | `$F6ED` | `STOP` | DONE | |
|
| `$FFE1` | `$F6ED` | `STOP` | DONE | |
|
||||||
| `$FFE4` | `$F13E` | `GETIN` | PARTIAL | only some devices supported |
|
| `$FFE4` | `$F13E` | `GETIN` | PARTIAL | only keyaboard supported |
|
||||||
| `$FFE7` | `$F32F` | `CLALL` | DONE | |
|
| `$FFE7` | `$F32F` | `CLALL` | DONE | |
|
||||||
| `$FFEA` | | `UDTIM` | DONE | |
|
| `$FFEA` | | `UDTIM` | DONE | |
|
||||||
| `$FFED` | | `SCREEN` | DONE | |
|
| `$FFED` | | `SCREEN` | DONE | |
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2
-19
@@ -8,26 +8,9 @@
|
|||||||
// CPU registers that has to be preserved (see [RG64]): .X, .Y
|
// CPU registers that has to be preserved (see [RG64]): .X, .Y
|
||||||
//
|
//
|
||||||
|
|
||||||
// XXX currently does not preserve registers, to be fixed!
|
|
||||||
|
|
||||||
GETIN:
|
GETIN:
|
||||||
|
|
||||||
// Wait for a key
|
// XXX this should be a dispatcher for several different devices!
|
||||||
lda NDX
|
|
||||||
bne !+
|
|
||||||
|
|
||||||
// Nothing in keyboard buffer to read
|
jmp read_kb_buf
|
||||||
sec
|
|
||||||
lda #$00
|
|
||||||
rts
|
|
||||||
|
|
||||||
!:
|
|
||||||
lda KEYD
|
|
||||||
pha
|
|
||||||
|
|
||||||
jsr pop_keyboard_buffer
|
|
||||||
|
|
||||||
pla
|
|
||||||
clc
|
|
||||||
|
|
||||||
rts
|
|
||||||
@@ -26,16 +26,22 @@ udtim_update_stkey: // entry to be used when interrupts are disabled
|
|||||||
// Another action we have to perform is to copy the last row of keyboard to RAM,
|
// Another action we have to perform is to copy the last row of keyboard to RAM,
|
||||||
// so that various routines can detect the STOP key press
|
// so that various routines can detect the STOP key press
|
||||||
|
|
||||||
|
#if CONFIG_KEYBOARD_C128
|
||||||
|
lda #$FF
|
||||||
|
sta VIC_XSCAN // disconnect the extra C128 keys
|
||||||
|
#endif
|
||||||
|
|
||||||
lda #$7F
|
lda #$7F
|
||||||
sta CIA1_PRA // select the last row (bit to 0)
|
sta CIA1_PRA // select the last row (bit to 0)
|
||||||
|
|
||||||
lda CIA1_PRB // read the row
|
lda CIA1_PRB // read the row
|
||||||
sta STKEY
|
sta STKEY
|
||||||
|
|
||||||
// Finish by disconnecting the keyboard, this will prevent
|
// Leave the CIA configured this way. It would be far better to disconnect
|
||||||
// interference when scanning joystick in port 1
|
// the keyboard at this point, but certain software (mainly intros) is
|
||||||
|
// unable to, for example, read the space bar status.
|
||||||
|
|
||||||
jmp keyboard_disconnect
|
rts
|
||||||
|
|
||||||
udtim_clock_rollover:
|
udtim_clock_rollover:
|
||||||
|
|
||||||
|
|||||||
@@ -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,
|
// Helper routine - disconnects the keyboard from CIA1_PRB,
|
||||||
// leaves $FF in .X (behavior needed in some places)
|
// leaves $FF in .X (behavior needed in some places)
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#if !CONFIG_LEGACY_SCNKEY
|
||||||
|
|
||||||
|
|
||||||
keyboard_disconnect:
|
keyboard_disconnect:
|
||||||
@@ -13,3 +17,6 @@ keyboard_disconnect:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -2,7 +2,9 @@
|
|||||||
// Pop key out of keyboard buffer
|
// Pop key out of keyboard buffer
|
||||||
// Disable interrupts while reading from keyboard buffer
|
// Disable interrupts while reading from keyboard buffer
|
||||||
// so that no race conditions can occur
|
// so that no race conditions can occur
|
||||||
|
//
|
||||||
|
// CPU registers that has to be preserved: .X
|
||||||
|
//
|
||||||
|
|
||||||
pop_keyboard_buffer:
|
pop_keyboard_buffer:
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ SCNKEY:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Retrieve SHIFT / VENDOR / CTRL status
|
// 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)
|
ldy #(__kb_matrix_bucky_confmask_end - kb_matrix_bucky_confmask - 1)
|
||||||
scnkey_bucky_loop:
|
scnkey_bucky_loop:
|
||||||
@@ -154,7 +153,7 @@ scnkey_matrix_loop_inner:
|
|||||||
!:
|
!:
|
||||||
dey
|
dey
|
||||||
bpl scnkey_matrix_loop_inner
|
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:
|
scnkey_matrix_loop_next:
|
||||||
dex
|
dex
|
||||||
bpl scnkey_matrix_loop
|
bpl scnkey_matrix_loop
|
||||||
|
|||||||
Reference in new issue
Block a user