Skip to content

Commit

Permalink
[KERNAL] Num Lock as first keystroke fix (X16Community#354)
Browse files Browse the repository at this point in the history
* [KERNAL] enable control and persisting of ps2kbd LED state, respond to numlock

* extapi setter must use .X, and for consistency change getter

* Check command status before sending set LED status command

---------

Co-authored-by: mooinglemur <[email protected]>
  • Loading branch information
stefan-b-jakobsson and mooinglemur authored Aug 22, 2024
1 parent d2841e8 commit 17c25a1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions kernal/drivers/x16/ps2kbd.s
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
I2C_ADDRESS = $42
I2C_KBD_ADDRESS = $43
I2C_GET_SCANCODE_OFFSET = $07
I2C_GET_KBD_CMD_STATUS = $18
I2C_KBD_CMD2 = $1a
I2C_CMD_PENDING = $01

MODIFIER_SHIFT = 1 ; C64: Shift
MODIFIER_ALT = 2 ; C64: Commodore
Expand Down Expand Up @@ -594,6 +596,12 @@ kbd_leds:

_set_kbd_leds:
ldx #I2C_ADDRESS
ldy #I2C_GET_KBD_CMD_STATUS
: jsr i2c_read_byte
cmp #I2C_CMD_PENDING
beq :-

; Set LED state command
ldy #I2C_KBD_CMD2
lda #$ed
jsr i2c_write_first_byte
Expand Down

0 comments on commit 17c25a1

Please sign in to comment.