From b10f6b4f504cdf6ca943a7fe5187b88ceb2bab6a Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 7 Aug 2023 03:26:23 +0200 Subject: [PATCH 1/5] Fixed some of the PC330's on-board devices (CMOS still doesn't save, that needs the upper NVRAM bank of the OPTi 82c602. --- src/machine/m_at_386dx_486.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/machine/m_at_386dx_486.c b/src/machine/m_at_386dx_486.c index 3f37c13c4..c039da38c 100644 --- a/src/machine/m_at_386dx_486.c +++ b/src/machine/m_at_386dx_486.c @@ -633,6 +633,7 @@ machine_at_pc330_6573_init(const machine_t *model) /* doesn't like every CPU oth return ret; machine_at_common_init(model); + device_add(&ide_vlb_2ch_device); pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x10, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); @@ -642,8 +643,8 @@ machine_at_pc330_6573_init(const machine_t *model) /* doesn't like every CPU oth device_add(&opti802g_pci_device); device_add(&opti822_device); - device_add(&keyboard_ps2_device); - device_add(&fdc37c665_device); + device_add(&keyboard_ps2_ami_device); + device_add(&fdc37c665_ide_device); device_add(&ide_opti611_vlb_device); device_add(&intel_flash_bxt_device); From 8a1cbbcba198ca74fc409671b47eecb4ad9763d7 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 7 Aug 2023 03:29:10 +0200 Subject: [PATCH 2/5] Implemented the P6 model-specific register 1D9h (DEBUG_CTL), needed by Netware 6.0. --- src/cpu/cpu.c | 7 +++++++ src/cpu/cpu.h | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index d633b9bb2..46f4618a4 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -2735,6 +2735,10 @@ amd_k_invalid_rdmsr: EAX = msr.ecx187 & 0xffffffff; EDX = msr.ecx187 >> 32; break; + case 0x1d9: + EAX = msr.debug_ctl & 0xffffffff; + EDX = msr.debug_ctl >> 32; + break; case 0x1e0: EAX = msr.ecx1e0 & 0xffffffff; EDX = msr.ecx1e0 >> 32; @@ -3172,6 +3176,9 @@ amd_k_invalid_wrmsr: case 0x187: msr.ecx187 = EAX | ((uint64_t) EDX << 32); break; + case 0x1d9: + msr.debug_ctl = EAX | ((uint64_t) EDX << 32); + break; case 0x1e0: msr.ecx1e0 = EAX | ((uint64_t) EDX << 32); break; diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index d13201608..c1ffb3591 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -284,6 +284,11 @@ typedef struct { /* Pentium Pro, Pentium II Klamath, and Pentium II Deschutes MSR's */ uint64_t ecx186; /* 0x00000186, 0x00000187 */ uint64_t ecx187; /* 0x00000186, 0x00000187 */ + + /* Pentium Pro, Pentium II Klamath, and Pentium II Deschutes MSR's */ + uint64_t debug_ctl; /* 0x000001d9 - Debug Registers Control */ + + /* Pentium Pro, Pentium II Klamath, and Pentium II Deschutes MSR's */ uint64_t ecx1e0; /* 0x000001e0 */ /* Pentium Pro, Pentium II Klamath, and Pentium II Deschutes MSR's that are also From 7f4fdf09b5e9cd7cb9ef74e8af3e7401c9711759 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 7 Aug 2023 03:30:23 +0200 Subject: [PATCH 3/5] Added two TODO comments in chipset/opti895.c. --- src/chipset/opti895.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/chipset/opti895.c b/src/chipset/opti895.c index 8bc93702f..512c4fc82 100644 --- a/src/chipset/opti895.c +++ b/src/chipset/opti895.c @@ -155,6 +155,7 @@ opti895_write(uint16_t addr, uint8_t val, void *priv) dev->regs[dev->idx] = val; opti895_log("dev->regs[%04x] = %08x\n", dev->idx, val); + /* TODO: Registers 0x30-0x3F for OPTi 802GP and 898. */ switch (dev->idx) { case 0x21: cpu_cache_ext_enabled = !!(dev->regs[0x21] & 0x10); @@ -213,12 +214,14 @@ opti895_read(uint16_t addr, void *priv) ret = dev->regs[dev->idx]; break; case 0x24: + /* TODO: Registers 0x30-0x3F for OPTi 802GP and 898. */ if (((dev->idx >= 0x20) && (dev->idx <= 0x2f)) || ((dev->idx >= 0xe0) && (dev->idx <= 0xef))) { ret = dev->regs[dev->idx]; if (dev->idx == 0xe0) ret = (ret & 0xf6) | (in_smm ? 0x00 : 0x08) | !!dev->forced_green; } break; + case 0xe1: case 0xe2: ret = dev->scratch[addr - 0xe1]; From 53daf8be9d67cef004267a73e69c6f3211b7e3e0 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 7 Aug 2023 03:32:56 +0200 Subject: [PATCH 4/5] Left and right Windows keys tracking in keyboard.c. --- src/device/keyboard.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/device/keyboard.c b/src/device/keyboard.c index e788ff23f..15eb06035 100644 --- a/src/device/keyboard.c +++ b/src/device/keyboard.c @@ -167,6 +167,12 @@ keyboard_input(int down, uint16_t scan) case 0x138: /* Right Alt */ shift |= 0x40; break; + case 0x15b: /* Left Windows */ + shift |= 0x08; + break; + case 0x15c: /* Right Windows */ + shift |= 0x80; + break; default: break; @@ -191,6 +197,12 @@ keyboard_input(int down, uint16_t scan) case 0x138: /* Right Alt */ shift &= ~0x40; break; + case 0x15b: /* Left Windows */ + shift &= ~0x08; + break; + case 0x15c: /* Right Windows */ + shift &= ~0x80; + break; case 0x03a: /* Caps Lock */ caps_lock ^= 1; break; From 88c12bf4b978a355c6efe2467f9cd2e05c8253c3 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 7 Aug 2023 03:35:23 +0200 Subject: [PATCH 5/5] Made the secondary graphics card initialize before the primary one so that the primary one's memory mappings have precedence by virtue of coming last - fixes main output going to the wrong window on some 486 machines. --- src/video/vid_table.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/video/vid_table.c b/src/video/vid_table.c index eb999eb3f..c417229dc 100644 --- a/src/video/vid_table.c +++ b/src/video/vid_table.c @@ -343,16 +343,6 @@ video_reset(int card) monitor_index_global = 0; loadfont("roms/video/mda/mda.rom", 0); - /* Do not initialize internal cards here. */ - if (!(card == VID_NONE) && !(card == VID_INTERNAL) && !machine_has_flags(machine, MACHINE_VIDEO_ONLY)) { - vid_table_log("VIDEO: initializing '%s'\n", video_cards[card].device->name); - - video_prepare(); - - /* Initialize the video card. */ - device_add(video_cards[card].device); - } - if (!(card == VID_NONE) && !machine_has_flags(machine, MACHINE_VIDEO_ONLY) && gfxcard[1] != 0 @@ -363,6 +353,16 @@ video_reset(int card) monitor_index_global = 0; } + /* Do not initialize internal cards here. */ + if (!(card == VID_NONE) && !(card == VID_INTERNAL) && !machine_has_flags(machine, MACHINE_VIDEO_ONLY)) { + vid_table_log("VIDEO: initializing '%s'\n", video_cards[card].device->name); + + video_prepare(); + + /* Initialize the video card. */ + device_add(video_cards[card].device); + } + /* Enable the Voodoo if configured. */ if (voodoo_enabled) device_add(&voodoo_device);