Skip to content

Commit

Permalink
[KERNAL] add extapi call for changing PS/2 typematic delay and rate (X…
Browse files Browse the repository at this point in the history
  • Loading branch information
mooinglemur authored Mar 23, 2024
1 parent cfc86b9 commit 8578e4f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ This is a major update with new features and bug fixes. This ROM requires a matc
3. `mouse_sprite_offset` good for custom mouse cursors where the locus is at a position in the sprite other than x=0, y=0
4. `joystick_ps2_keycodes` can remap the keyboard joystick
5. `iso_cursor_char` sets the blinking cursor screen code to a character other than $9F while in ISO mode.
6. `ps2kbd_typematic` sets the keyboard repeat delay and repeat rate.
* Solved a race in kbd_scan if a KERNAL call was in progress was interrupted by the default ISR.
* Removed support for preserving state in the KERNAL ISR for VERA 0.1.1. VERA 0.3.1 is the new minimum version.
* Implemented the C128 `PFKEY` API call. Within the KERNAL screen editor, the actions of the function keys F1-F8, as well as the SHIFT+RUN action can be changed.
Expand Down
2 changes: 1 addition & 1 deletion inc/keycode.inc
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ KEYCODE_F11 = $7A ; 57 78
KEYCODE_F12 = $7B ; 58 07 07 45 F12
KEYCODE_PRTSCR = $7C ; E0 2A E0 37 E0 12 E0 7C 07 46 Print Screen
KEYCODE_SCRLCK = $7D ; 46 7E 07 47 Scroll Lock
KEYCODE_PAUSEBRK = $7E ; E1 1D 45 E1 9D C5 E1 14 77 E1 F0 14 F0 77 07 48 Pause Break
KEYCODE_PAUSEBRK = $7E ; E1 1D 45 E1 9D C5 E1 14 77 E1 F0 14 F0 77 07 48 Pause Break
19 changes: 18 additions & 1 deletion kernal/drivers/x16/ps2kbd.s
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

.import memory_decompress_internal ; [lzsa]

.export kbd_config, kbd_scan, receive_scancode_resume, keymap
.export kbd_config, kbd_scan, receive_scancode_resume, keymap, ps2kbd_typematic
.export MODIFIER_4080

I2C_ADDRESS = $42
Expand Down Expand Up @@ -556,6 +556,23 @@ set_caps_led:
jsr i2c_write_next_byte
jmp i2c_write_stop

;*****************************************
; SET REPEAT RATE AND DELAY
;*****************************************
ps2kbd_typematic:
phx ; [4:0] repeat rate n, in the range 0-31, where rate in Hz = (-28n / 31) + 30
; [6:5] delay d, where delay in ms = (d + 1) * 250
; [7] must be zero
ldx #I2C_ADDRESS
ldy #I2C_KBD_CMD2
lda #$f3
jsr i2c_write_first_byte
pla
and #$7f
jsr i2c_write_next_byte
jmp i2c_write_stop


modifier_key_codes:
.byt KEYCODE_LSHIFT
.byt KEYCODE_LALT
Expand Down
2 changes: 2 additions & 0 deletions kernal/x16/extapi.s
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.import mouse_sprite_offset
.import joystick_ps2_keycodes
.import iso_cursor_char
.import ps2kbd_typematic

.export extapi

Expand Down Expand Up @@ -39,3 +40,4 @@ apitbl:
.word mouse_sprite_offset-1 ; API 3
.word joystick_ps2_keycodes-1 ; API 4
.word iso_cursor_char-1 ; API 5
.word ps2kbd_typematic-1 ; API 6

0 comments on commit 8578e4f

Please sign in to comment.