Genoa Unknown 486: Port 92h controls the exact same gate as the KBC, fixes #4660.

This commit is contained in:
OBattler
2024-07-28 02:26:43 +02:00
parent 72311a301b
commit 4ae901c901
3 changed files with 26 additions and 4 deletions

View File

@@ -37,6 +37,7 @@ extern void port_92_add(void *priv);
extern void port_92_remove(void *priv);
extern const device_t port_92_device;
extern const device_t port_92_key_device;
extern const device_t port_92_inv_device;
extern const device_t port_92_word_device;
extern const device_t port_92_pci_device;

View File

@@ -2333,7 +2333,7 @@ machine_at_genoa486_init(const machine_t *model)
machine_at_common_init(model);
device_add(&compaq_genoa_device);
device_add(&port_92_device);
device_add(&port_92_key_device);
device_add(&keyboard_at_ami_device);

View File

@@ -36,6 +36,7 @@
#define PORT_92_PCI 4
#define PORT_92_RESET 8
#define PORT_92_A20 16
#define PORT_92_KEY 32
static uint8_t
port_92_readb(uint16_t port, void *priv)
@@ -46,7 +47,10 @@ port_92_readb(uint16_t port, void *priv)
if (port == 0x92) {
/* Return bit 1 directly from mem_a20_alt, so the
pin can be reset independently of the device. */
ret = (dev->reg & ~0x03) | (mem_a20_alt & 2) | (cpu_alt_reset & 1);
if (dev->flags & PORT_92_KEY)
ret = (dev->reg & ~0x03) | (mem_a20_key & 2) | (cpu_alt_reset & 1);
else
ret = (dev->reg & ~0x03) | (mem_a20_alt & 2) | (cpu_alt_reset & 1);
if (dev->flags & PORT_92_INV)
ret |= 0xfc;
@@ -94,8 +98,11 @@ port_92_writeb(uint16_t port, uint8_t val, void *priv)
dev->reg = val & 0x03;
if ((mem_a20_alt ^ val) & 2) {
mem_a20_alt = (val & 2);
if (dev->flags & PORT_92_KEY) {
mem_a20_key = val & 2;
mem_a20_recalc();
} else if ((mem_a20_alt ^ val) & 2) {
mem_a20_alt = (mem_a20_alt & 0xfd) | (val & 2);
mem_a20_recalc();
}
@@ -234,6 +241,20 @@ const device_t port_92_device = {
.config = NULL
};
const device_t port_92_key_device = {
.name = "Port 92 Register (using A20 key)",
.internal_name = "port_92_key",
.flags = 0,
.local = PORT_92_KEY,
.init = port_92_init,
.close = port_92_close,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t port_92_inv_device = {
.name = "Port 92 Register (inverted bits 2-7)",
.internal_name = "port_92_inv",