Caps/Num/Scroll LED states are now displayed

This commit is contained in:
Cacodemon345
2025-03-27 16:31:32 +06:00
parent bb22e1dccb
commit 85a94516f7
4 changed files with 48 additions and 6 deletions

View File

@@ -72,9 +72,9 @@ static int keydelay[512];
#endif
static scancode *scan_table; /* scancode table for keyboard */
static uint8_t caps_lock = 0;
static uint8_t num_lock = 0;
static uint8_t scroll_lock = 0;
static volatile uint8_t caps_lock = 0;
static volatile uint8_t num_lock = 0;
static volatile uint8_t scroll_lock = 0;
static uint8_t shift = 0;
static int key5576mode = 0;
@@ -318,13 +318,16 @@ keyboard_input(int down, uint16_t scan)
shift &= ~0x80;
break;
case 0x03a: /* Caps Lock */
caps_lock ^= 1;
if (!(machine_has_bus(machine, MACHINE_AT) > 0))
caps_lock ^= 1;
break;
case 0x045:
num_lock ^= 1;
if (!(machine_has_bus(machine, MACHINE_AT) > 0))
num_lock ^= 1;
break;
case 0x046:
scroll_lock ^= 1;
if (!(machine_has_bus(machine, MACHINE_AT) > 0))
scroll_lock ^= 1;
break;
default:

View File

@@ -3476,6 +3476,7 @@ keyboard_at_bat(void *priv)
keyboard_scan = 1;
keyboard_update_states(0, 0, 0);
kbc_at_dev_queue_add(dev, 0xaa, 0);
} else {
bat_counter--;
@@ -3510,6 +3511,7 @@ keyboard_at_write(void *priv)
switch (dev->command) {
case 0xed: /* Set/reset LEDs */
kbc_at_dev_queue_add(dev, 0xfa, 0);
keyboard_update_states(!!(val & 0x4), !!(val & 0x2), val & 0x1);
keyboard_at_log("%s: Set/reset LEDs [%02X]\n", dev->name, val);
break;
@@ -3762,6 +3764,7 @@ keyboard_at_init(const device_t *info)
if (dev->port != NULL) {
kbc_at_dev_reset(dev, 0);
keyboard_update_states(0, 0, 0);
bat_counter = 0x0000;
}