From a8c813cb4b489315350654083d00c55761eb3cf6 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Tue, 8 Sep 2020 21:43:54 -0300 Subject: [PATCH 1/8] Initial implementation of ALi M6117D --- src/chipset/ali6117.c | 350 ++++++++++++++++++++++++++++++++++++ src/include/86box/chipset.h | 3 + src/win/Makefile.mingw | 4 +- 3 files changed, 355 insertions(+), 2 deletions(-) create mode 100644 src/chipset/ali6117.c diff --git a/src/chipset/ali6117.c b/src/chipset/ali6117.c new file mode 100644 index 000000000..14967e4f9 --- /dev/null +++ b/src/chipset/ali6117.c @@ -0,0 +1,350 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Implementation of the ALi M6117D SoC. + * + * + * + * Authors: RichardG, + * + * Copyright 2020 RichardG. + */ +#include +#include +#include +#include +#include +#include +#define HAVE_STDARG_H +#include <86box/86box.h> +#include <86box/mem.h> +#include <86box/io.h> +#include <86box/rom.h> +#include <86box/pci.h> +#include <86box/pic.h> +#include <86box/timer.h> +#include <86box/pit.h> +#include <86box/device.h> +#include <86box/keyboard.h> +#include <86box/port_92.h> +#include <86box/usb.h> +#include <86box/hdc.h> +#include <86box/chipset.h> + + +typedef struct ali6117_t +{ + uint32_t local; + + /* Main registers (port 22h/23h) */ + uint8_t unlocked; + uint8_t reg_offset; + uint8_t regs[256]; +} ali6117_t; + + +#ifdef ENABLE_ALI6117_LOG +int ali6117_do_log = ENABLE_ALI6117_LOG; + +static void +ali6117_log(const char *fmt, ...) +{ + va_list ap; + + if (ali6117_do_log) { + va_start(ap, fmt); + pclog_ex(fmt, ap); + va_end(ap); + } +} +#else +#define ali6117_log(fmt, ...) +#endif + + +static void +ali6117_recalcmapping(ali6117_t *dev) +{ + uint8_t reg, bitpair; + uint32_t base, size; + int state; + + shadowbios = 0; + shadowbios_write = 0; + + ali6117_log("M6117: Shadowing for 0xa0000-0xbffff (reg %02X) = %s\n", (dev->regs[0x12] & 0x02) ? "on" : "off"); + mem_set_mem_state(0xa0000, 0x20000, (dev->regs[0x12] & 0x02) ? (MEM_WRITE_INTERNAL | MEM_READ_INTERNAL) : (MEM_WRITE_EXTANY | MEM_READ_EXTANY)); + + for (reg = 0; reg <= 1; reg++) { + for (bitpair = 0; bitpair <= 3; bitpair++) { + size = 0x8000; + base = 0xc0000 + (size * ((reg * 4) + bitpair)); + ali6117_log("M6117: Shadowing for %05x-%05x (reg %02X bp %d wmask %02X rmask %02X) =", base, base + size - 1, 0x14 + reg, bitpair, 1 << ((bitpair * 2) + 1), 1 << (bitpair * 2)); + + state = 0; + if (dev->regs[0x14 + reg] & (1 << ((bitpair * 2) + 1))) { + ali6117_log(" w on"); + state |= MEM_WRITE_INTERNAL; + if (base >= 0xe0000) + shadowbios_write |= 1; + } else { + ali6117_log(" w off"); + state |= MEM_WRITE_EXTANY; + } + if (dev->regs[0x14 + reg] & (1 << (bitpair * 2))) { + ali6117_log("; r on\n"); + state |= MEM_READ_INTERNAL; + if (base >= 0xe0000) + shadowbios |= 1; + } else { + ali6117_log("; r off\n"); + state |= MEM_READ_EXTANY; + } + + mem_set_mem_state(base, size, state); + } + } + + flushmmucache(); +} + + +static void +ali6117_smram_map(int smm, uint32_t addr, uint32_t size, int is_smram) +{ + mem_set_mem_state_smram(smm, addr, size, is_smram); +} + + +static void +ali6117_reg_write(uint16_t addr, uint8_t val, void *priv) +{ + ali6117_t *dev = (ali6117_t *) priv; + + ali6117_log("ALI6117: reg_write(%04X, %02X)\n", addr, val); + + if (addr == 0x22) + dev->reg_offset = val; + else if (dev->reg_offset == 0x13) + dev->unlocked = (val == 0xc5); + else if (dev->unlocked) { + ali6117_log("ALI6117: regs[%02X] = %02X\n", dev->reg_offset, val); + + switch (dev->reg_offset) { + case 0x30: case 0x34: case 0x35: case 0x3e: + case 0x3f: case 0x46: case 0x4c: case 0x6a: + case 0x73: + return; /* read-only registers */ + + case 0x12: + val &= 0xf7; + /* FALL-THROUGH */ + + case 0x14: case 0x15: + dev->regs[dev->reg_offset] = val; + ali6117_recalcmapping(dev); + break; + + case 0x1e: + val &= 0x07; + break; + + case 0x20: + val &= 0xbf; + refresh_at_enable = (val & 0x02); + break; + + case 0x31: + /* TODO: fast gate A20 (bit 0) */ + val &= 0x21; + break; + + case 0x32: + val &= 0xc1; + break; + + case 0x33: + val &= 0xfd; + break; + + case 0x36: + val &= 0xf0; + val |= dev->regs[dev->reg_offset]; + break; + + case 0x37: + val &= 0xf5; + break; + + case 0x3c: + /* TODO: IDE channel selection (bit 0, secondary if set) */ + val &= 0x8f; + break; + + case 0x44: case 0x45: + val &= 0x3f; + break; + + case 0x4a: + val &= 0xfe; + break; + + case 0x55: + val &= 0x03; + break; + + case 0x56: + val &= 0xc7; + break; + + case 0x58: + val &= 0xc3; + break; + + case 0x59: + val &= 0x60; + break; + + case 0x5b: + val &= 0x1f; + break; + + case 0x64: + val &= 0xf7; + break; + + case 0x66: + val &= 0xe3; + break; + + case 0x67: + val &= 0xdf; + break; + + case 0x69: + val &= 0x50; + break; + + case 0x6b: + val &= 0x7f; + break; + + case 0x6e: case 0x6f: + val &= 0x03; + break; + + case 0x71: + val &= 0x1f; + break; + } + + dev->regs[dev->reg_offset] = val; + } +} + + +static uint8_t +ali6117_reg_read(uint16_t addr, void *priv) +{ + ali6117_t *dev = (ali6117_t *) priv; + uint8_t ret; + + if (addr == 0x22) + ret = dev->reg_offset; + else + ret = dev->regs[dev->reg_offset]; + + ali6117_log("ALI6117: reg_read(%04X) = %02X\n", dev->reg_offset, ret); + return ret; +} + + +static void +ali6117_reset(void *priv) +{ + ali6117_t *dev = (ali6117_t *) priv; + + ali6117_log("ALI6117: reset()\n"); + + memset(dev->regs, 0, sizeof(dev->regs)); + dev->regs[0x11] = 0xf8; + dev->regs[0x12] = 0x20; + dev->regs[0x17] = 0xff; + dev->regs[0x18] = 0xf0; + dev->regs[0x1a] = 0xff; + dev->regs[0x1b] = 0xf0; + dev->regs[0x1d] = 0xff; + dev->regs[0x20] = 0x80; + dev->regs[0x30] = 0x08; + dev->regs[0x31] = 0x01; + dev->regs[0x34] = 0x04; /* enable internal RTC */ + dev->regs[0x35] = 0x20; /* enable internal KBC */ + dev->regs[0x36] = (dev->local & 0x4); /* M6117D ID */ +} + + +static void +ali6117_setup(ali6117_t *dev) +{ + ali6117_log("ALI6117: setup()\n"); + + /* Main register interface */ + io_sethandler(0x22, 2, + ali6117_reg_read, NULL, NULL, ali6117_reg_write, NULL, NULL, dev); +} + + +static void +ali6117_close(void *priv) +{ + ali6117_t *dev = (ali6117_t *) priv; + + ali6117_log("ALI6117: close()\n"); + + io_removehandler(0x22, 2, + ali6117_reg_read, NULL, NULL, ali6117_reg_write, NULL, NULL, dev); + + free(dev); +} + + +static void * +ali6117_init(const device_t *info) +{ + ali6117_log("ALI6117: init()\n"); + + ali6117_t *dev = (ali6117_t *) malloc(sizeof(ali6117_t)); + memset(dev, 0, sizeof(ali6117_t)); + + dev->local = info->local; + + device_add(&ide_isa_device); + + ali6117_setup(dev); + ali6117_reset(dev); + + pci_elcr_io_disable(); + refresh_at_enable = 0; + + return dev; +} + + +const device_t ali6117d_device = +{ + "ALi M6117D", + DEVICE_AT, + 0x2, + ali6117_init, + ali6117_close, + ali6117_reset, + NULL, + NULL, + NULL, + NULL +}; diff --git a/src/include/86box/chipset.h b/src/include/86box/chipset.h index 36be94044..683491c85 100644 --- a/src/include/86box/chipset.h +++ b/src/include/86box/chipset.h @@ -26,6 +26,9 @@ extern const device_t ali1429_device; #if defined(DEV_BRANCH) && defined(USE_M1489) extern const device_t ali1489_device; #endif +#if defined(DEV_BRANCH) && defined(USE_STPC) +extern const device_t ali6117d_device; +#endif /* AMD */ extern const device_t amd640_device; diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index 2abce2836..a1fa60d51 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -560,7 +560,7 @@ endif ifeq ($(STPC), y) OPTS += -DUSE_STPC -DEVBROBJ += stpc.o +DEVBROBJ += ali6117.o stpc.o endif ifeq ($(M1489), y) @@ -601,7 +601,7 @@ endif # Final versions of the toolchain flags. CFLAGS := $(WX_FLAGS) $(OPTS) $(DFLAGS) $(COPTIM) $(AOPTIM) \ - $(AFLAGS) -fomit-frame-pointer -mstackrealign -Wall \ + $(AFLAGS) -mstackrealign -Wall \ -fno-strict-aliasing # Add freetyp2 references through pkgconfig From 777a6d02e0f0d480b049b080c34839acf4b57359 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Tue, 8 Sep 2020 21:44:10 -0300 Subject: [PATCH 2/8] Indentation cleanups on STPC --- src/chipset/stpc.c | 190 ++++++++++++++++++++++----------------------- 1 file changed, 95 insertions(+), 95 deletions(-) diff --git a/src/chipset/stpc.c b/src/chipset/stpc.c index 30b02aab0..7ff1cc36f 100644 --- a/src/chipset/stpc.c +++ b/src/chipset/stpc.c @@ -125,7 +125,7 @@ stpc_recalcmapping(stpc_t *dev) size = 0x4000; base = 0xc0000 + (size * ((reg * 4) + bitpair)); } - stpc_log("STPC: Shadowing for %05x-%05x (reg %02X bp %d wmask %02X rmask %02X) =", base, base + size - 1, 0x25 + reg, bitpair, 1 << (bitpair * 2), 1 << ((bitpair * 2) + 1)); + stpc_log("STPC: Shadowing for %05X-%05X (reg %02X bp %d wmask %02X rmask %02X) =", base, base + size - 1, 0x25 + reg, bitpair, 1 << (bitpair * 2), 1 << ((bitpair * 2) + 1)); state = 0; if (dev->regs[0x25 + reg] & (1 << (bitpair * 2))) { @@ -446,9 +446,9 @@ stpc_ide_read(int func, int addr, void *priv) uint8_t ret; if (func > 0) - ret = 0xff; + ret = 0xff; else { - ret = dev->pci_conf[2][addr]; + ret = dev->pci_conf[2][addr]; if (addr == 0x48) { ret &= 0xfc; ret |= (!!(dev->bm[0]->status & 0x04)); @@ -467,8 +467,8 @@ stpc_isab_write(int func, int addr, uint8_t val, void *priv) stpc_t *dev = (stpc_t *) priv; if (func == 1 && !(dev->local & STPC_IDE_ATLAS)) { - stpc_ide_write(0, addr, val, priv); - return; + stpc_ide_write(0, addr, val, priv); + return; } stpc_log("STPC: isab_write(%d, %02X, %02X)\n", func, addr, val); @@ -498,11 +498,11 @@ stpc_isab_read(int func, int addr, void *priv) uint8_t ret; if ((func == 1) && !(dev->local & STPC_IDE_ATLAS)) - ret = stpc_ide_read(0, addr, priv); + ret = stpc_ide_read(0, addr, priv); else if (func > 0) - ret = 0xff; + ret = 0xff; else - ret = dev->pci_conf[1][addr]; + ret = dev->pci_conf[1][addr]; stpc_log("STPC: isab_read(%d, %02X) = %02X\n", func, addr, ret); return ret; @@ -552,9 +552,9 @@ stpc_usb_read(int func, int addr, void *priv) uint8_t ret; if (func > 0) - ret = 0xff; + ret = 0xff; else - ret = dev->pci_conf[3][addr]; + ret = dev->pci_conf[3][addr]; stpc_log("STPC: usb_read(%d, %02X) = %02X\n", func, addr, ret); return ret; @@ -596,32 +596,32 @@ stpc_serial_handlers(uint8_t val) { stpc_serial_t *dev; if (!(dev = device_get_priv(&stpc_serial_device))) { - stpc_log("STPC: Not remapping UARTs, disabled by strap (raw %02X)\n", val); - return 0; + stpc_log("STPC: Not remapping UARTs, disabled by strap (raw %02X)\n", val); + return 0; } uint16_t uart0_io = 0x3f8, uart0_irq = 4, uart1_io = 0x3f8, uart1_irq = 3; if (val & 0x10) - uart1_io -= 0x100; + uart1_io -= 0x100; if (val & 0x20) - uart1_io -= 0x10; + uart1_io -= 0x10; if (val & 0x40) - uart0_io -= 0x100; + uart0_io -= 0x100; if (val & 0x80) - uart0_io -= 0x10; + uart0_io -= 0x10; if (uart0_io == uart1_io) { - /* Apply defaults if both UARTs are set to the same address. */ - stpc_log("STPC: Both UARTs set to %02X, resetting to defaults\n", uart0_io); - uart0_io = 0x3f8; - uart1_io = 0x2f8; + /* Apply defaults if both UARTs are set to the same address. */ + stpc_log("STPC: Both UARTs set to %02X, resetting to defaults\n", uart0_io); + uart0_io = 0x3f8; + uart1_io = 0x2f8; } if (uart0_io < 0x300) { - /* The address for UART0 defines the IRQs for both ports. */ - uart0_irq = 3; - uart1_irq = 4; + /* The address for UART0 defines the IRQs for both ports. */ + uart0_irq = 3; + uart1_irq = 4; } stpc_log("STPC: Remapping UART0 to %04X %d and UART1 to %04X %d (raw %02X)\n", uart0_io, uart0_irq, uart1_io, uart1_irq, val); @@ -696,7 +696,7 @@ stpc_reg_write(uint16_t addr, uint8_t val, void *priv) case 0x56: case 0x57: elcr_write(dev->reg_offset, val, NULL); if (dev->reg_offset == 0x57) - refresh_at_enable = val & 0x01; + refresh_at_enable = (val & 0x01); break; case 0x59: @@ -719,16 +719,16 @@ stpc_reg_read(uint16_t addr, void *priv) if (addr == 0x22) ret = dev->reg_offset; else if (dev->reg_offset >= 0xc0) - return 0xff; /* Cyrix CPU registers: let the CPU code handle these */ + return 0xff; /* Cyrix CPU registers: let the CPU code handle these */ else if ((dev->reg_offset == 0x56) || (dev->reg_offset == 0x57)) { - /* ELCR is in here, not in port 4D0h. */ + /* ELCR is in here, not in port 4D0h. */ ret = elcr_read(dev->reg_offset, NULL); if (dev->reg_offset == 0x57) ret |= (dev->regs[dev->reg_offset] & 0x01); } else ret = dev->regs[dev->reg_offset]; - stpc_log("STPC: reg_read(%04X) = %02X\n", addr, ret); + stpc_log("STPC: reg_read(%04X) = %02X\n", dev->reg_offset, ret); return ret; } @@ -743,9 +743,9 @@ stpc_reset(void *priv) memset(dev->regs, 0, sizeof(dev->regs)); dev->regs[0x7b] = 0xff; if (device_get_priv(&stpc_lpt_device)) - dev->regs[0x4c] |= 0x80; /* LPT strap */ + dev->regs[0x4c] |= 0x80; /* LPT strap */ if (stpc_serial_handlers(0x00)) - dev->regs[0x4c] |= 0x03; /* UART straps */ + dev->regs[0x4c] |= 0x03; /* UART straps */ } @@ -763,14 +763,14 @@ stpc_setup(stpc_t *dev) /* Client */ dev->pci_conf[0][0x00] = 0x0e; dev->pci_conf[0][0x01] = 0x10; - dev->pci_conf[0][0x02] = 0x64; - dev->pci_conf[0][0x03] = 0x05; + dev->pci_conf[0][0x02] = 0x64; + dev->pci_conf[0][0x03] = 0x05; } else { /* Atlas, Elite, Consumer II */ dev->pci_conf[0][0x00] = 0x4a; dev->pci_conf[0][0x01] = 0x10; - dev->pci_conf[0][0x02] = 0x0a; - dev->pci_conf[0][0x03] = 0x02; + dev->pci_conf[0][0x02] = 0x0a; + dev->pci_conf[0][0x03] = 0x02; } dev->pci_conf[0][0x04] = 0x07; @@ -785,26 +785,26 @@ stpc_setup(stpc_t *dev) /* Client */ dev->pci_conf[1][0x00] = 0x0e; dev->pci_conf[1][0x01] = 0x10; - dev->pci_conf[1][0x02] = 0xcc; - dev->pci_conf[1][0x03] = 0x55; + dev->pci_conf[1][0x02] = 0xcc; + dev->pci_conf[1][0x03] = 0x55; } else if (dev->local & STPC_ISAB_CONSUMER2) { /* Consumer II */ dev->pci_conf[1][0x00] = 0x4a; dev->pci_conf[1][0x01] = 0x10; - dev->pci_conf[1][0x02] = 0x0b; - dev->pci_conf[1][0x03] = 0x02; + dev->pci_conf[1][0x02] = 0x0b; + dev->pci_conf[1][0x03] = 0x02; } else if (dev->local & STPC_IDE_ATLAS) { /* Atlas */ dev->pci_conf[1][0x00] = 0x4a; dev->pci_conf[1][0x01] = 0x10; - dev->pci_conf[1][0x02] = 0x10; - dev->pci_conf[1][0x03] = 0x02; + dev->pci_conf[1][0x02] = 0x10; + dev->pci_conf[1][0x03] = 0x02; } else { /* Elite */ dev->pci_conf[1][0x00] = 0x4a; dev->pci_conf[1][0x01] = 0x10; - dev->pci_conf[1][0x02] = 0x1a; - dev->pci_conf[1][0x03] = 0x02; + dev->pci_conf[1][0x02] = 0x1a; + dev->pci_conf[1][0x03] = 0x02; } dev->pci_conf[1][0x04] = 0x0f; @@ -830,11 +830,11 @@ stpc_setup(stpc_t *dev) } if (dev->local & STPC_IDE_ATLAS) { - dev->pci_conf[2][0x02] = 0x28; - dev->pci_conf[2][0x03] = 0x02; + dev->pci_conf[2][0x02] = 0x28; + dev->pci_conf[2][0x03] = 0x02; } else { - dev->pci_conf[2][0x02] = dev->pci_conf[1][0x02]; - dev->pci_conf[2][0x03] = dev->pci_conf[1][0x03]; + dev->pci_conf[2][0x02] = dev->pci_conf[1][0x02]; + dev->pci_conf[2][0x03] = dev->pci_conf[1][0x03]; } dev->pci_conf[2][0x06] = 0x80; @@ -866,22 +866,22 @@ stpc_setup(stpc_t *dev) /* USB */ if (dev->usb) { - dev->pci_conf[3][0x00] = 0x4a; - dev->pci_conf[3][0x01] = 0x10; - dev->pci_conf[3][0x02] = 0x30; - dev->pci_conf[3][0x03] = 0x02; + dev->pci_conf[3][0x00] = 0x4a; + dev->pci_conf[3][0x01] = 0x10; + dev->pci_conf[3][0x02] = 0x30; + dev->pci_conf[3][0x03] = 0x02; - dev->pci_conf[3][0x06] = 0x80; - dev->pci_conf[3][0x07] = 0x02; + dev->pci_conf[3][0x06] = 0x80; + dev->pci_conf[3][0x07] = 0x02; - dev->pci_conf[3][0x09] = 0x10; - dev->pci_conf[3][0x0a] = 0x03; - dev->pci_conf[3][0x0b] = 0x0c; + dev->pci_conf[3][0x09] = 0x10; + dev->pci_conf[3][0x0a] = 0x03; + dev->pci_conf[3][0x0b] = 0x0c; /* NOTE: This is an erratum in the STPC Atlas programming manual, the programming manuals for the other STPC chipsets say 0x80, which is indeed multi-function (as the STPC Atlas programming manual indicates as well, and Windows 2000 also issues a 0x7B STOP error if it is 0x40. */ - dev->pci_conf[3][0x0e] = /*0x40*/ 0x80; + dev->pci_conf[3][0x0e] = /*0x40*/ 0x80; } /* PCI setup */ @@ -919,10 +919,10 @@ stpc_init(const device_t *info) pci_add_card(0x0B, stpc_nb_read, stpc_nb_write, dev); dev->ide_slot = pci_add_card(0x0C, stpc_isab_read, stpc_isab_write, dev); if (dev->local & STPC_IDE_ATLAS) - dev->ide_slot = pci_add_card(0x0D, stpc_ide_read, stpc_ide_write, dev); + dev->ide_slot = pci_add_card(0x0D, stpc_ide_read, stpc_ide_write, dev); if (dev->local & STPC_USB) { - dev->usb = device_add(&usb_device); - pci_add_card(0x0E, stpc_usb_read, stpc_usb_write, dev); + dev->usb = device_add(&usb_device); + pci_add_card(0x0E, stpc_usb_read, stpc_usb_write, dev); } dev->bm[0] = device_add_inst(&sff8038i_device, 1); @@ -990,38 +990,38 @@ stpc_lpt_handlers(stpc_lpt_t *dev, uint8_t val) uint8_t old_addr = (dev->reg1 & 0x03), new_addr = (val & 0x03); switch (old_addr) { - case 0x1: - lpt3_remove(); - break; + case 0x1: + lpt3_remove(); + break; - case 0x2: - lpt1_remove(); - break; + case 0x2: + lpt1_remove(); + break; - case 0x3: - lpt2_remove(); - break; + case 0x3: + lpt2_remove(); + break; } switch (new_addr) { - case 0x1: - stpc_log("STPC: Remapping parallel port to LPT3\n"); - lpt3_init(0x3bc); - break; + case 0x1: + stpc_log("STPC: Remapping parallel port to LPT3\n"); + lpt3_init(0x3bc); + break; - case 0x2: - stpc_log("STPC: Remapping parallel port to LPT1\n"); - lpt1_init(0x378); - break; + case 0x2: + stpc_log("STPC: Remapping parallel port to LPT1\n"); + lpt1_init(0x378); + break; - case 0x3: - stpc_log("STPC: Remapping parallel port to LPT2\n"); - lpt2_init(0x278); - break; + case 0x3: + stpc_log("STPC: Remapping parallel port to LPT2\n"); + lpt2_init(0x278); + break; - default: - stpc_log("STPC: Disabling parallel port\n"); - break; + default: + stpc_log("STPC: Disabling parallel port\n"); + break; } dev->reg1 = (val & 0x08); @@ -1036,22 +1036,22 @@ stpc_lpt_write(uint16_t addr, uint8_t val, void *priv) stpc_lpt_t *dev = (stpc_lpt_t *) priv; if (dev->unlocked < 2) { - /* Cheat a little bit: in reality, any write to any - I/O port is supposed to reset the unlock counter. */ - if ((addr == 0x3f0) && (val == 0x55)) - dev->unlocked++; - else - dev->unlocked = 0; + /* Cheat a little bit: in reality, any write to any + I/O port is supposed to reset the unlock counter. */ + if ((addr == 0x3f0) && (val == 0x55)) + dev->unlocked++; + else + dev->unlocked = 0; } else if (addr == 0x3f0) { - if (val == 0xaa) - dev->unlocked = 0; - else - dev->offset = val; + if (val == 0xaa) + dev->unlocked = 0; + else + dev->offset = val; } else if (dev->offset == 1) { - /* dev->reg1 is set by stpc_lpt_handlers */ - stpc_lpt_handlers(dev, val); + /* dev->reg1 is set by stpc_lpt_handlers */ + stpc_lpt_handlers(dev, val); } else if (dev->offset == 4) { - dev->reg4 = (val & 0x03); + dev->reg4 = (val & 0x03); } } From dd2562f273e335184f403ba8ee4224f1c06a93e6 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Tue, 8 Sep 2020 21:47:42 -0300 Subject: [PATCH 3/8] Fix machine table indentation trainwreck --- src/machine/machine_table.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 8ccc49014..eb8f62d6f 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -151,7 +151,7 @@ const machine_t machines[] = { { "[SCAT] Samsung Deskmaster 286", "deskmaster286", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512,16384, 128, 127, machine_at_deskmaster286_init, NULL }, { "[GC103] Quadtel 286 clone", "quadt286", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512,16384, 128, 127, machine_at_quadt286_init, NULL }, { "[GC103] Trigem 286M", "tg286m", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 512, 8192, 128, 127, machine_at_tg286m_init, NULL }, - { "[ISA] MR 286 clone", "mr286", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 512,16384, 128, 127, machine_at_mr286_init, NULL }, + { "[ISA] MR 286 clone", "mr286", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 512,16384, 128, 127, machine_at_mr286_init, NULL }, #if defined(DEV_BRANCH) && defined(USE_SIEMENS) { "[ISA] Siemens PCD-2L", "siemens", MACHINE_TYPE_286, {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 256,15872, 128, 63, machine_at_siemens_init, NULL }, #endif @@ -172,8 +172,8 @@ const machine_t machines[] = { #endif { "[WD76C10] Amstrad MegaPC", "megapc", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_VIDEO | MACHINE_HDC, 1, 32, 1, 127, machine_at_wd76c10_init, NULL }, { "[SCAMP] Commodore SL386SX", "cbm_sl386sx25", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_VIDEO | MACHINE_HDC, 1024, 8192, 512, 127,machine_at_commodore_sl386sx_init, at_commodore_sl386sx_get_device }, - { "[NEAT] DTK 386SX clone", "dtk386", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512, 8192, 128, 127, machine_at_neat_init, NULL }, - { "[NEAT] Goldstar 386", "goldstar386", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512, 8192, 128, 127, machine_at_goldstar386_init, NULL }, + { "[NEAT] DTK 386SX clone", "dtk386", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512, 8192, 128, 127, machine_at_neat_init, NULL }, + { "[NEAT] Goldstar 386", "goldstar386", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512, 8192, 128, 127, machine_at_goldstar386_init, NULL }, { "[SCAT] KMX-C-02", "kmxc02", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512,16384, 512, 127, machine_at_kmxc02_init, NULL }, { "[Intel 82335] Shuttle 386SX", "shuttle386sx", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512, 8192, 128, 127, machine_at_shuttle386sx_init, NULL }, @@ -184,12 +184,12 @@ const machine_t machines[] = { { "[MCA] IBM PS/2 model 55SX", "ibmps2_m55sx", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"IBM",cpus_IBM486SLC},{"", NULL}}, MACHINE_MCA | MACHINE_AT | MACHINE_PS2 | MACHINE_VIDEO, 1, 8, 1, 63, machine_ps2_model_55sx_init, NULL }, /* 386DX machines */ - { "[ACC 2168] AMI 386DX clone", "acc386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512, 16384, 128, 127, machine_at_acc386_init, NULL }, - { "[SiS 310] ASUS ISA-386C", "asus386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512, 16384, 128, 127, machine_at_asus386_init, NULL }, + { "[ACC 2168] AMI 386DX clone", "acc386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512, 16384, 128, 127, machine_at_acc386_init, NULL }, + { "[SiS 310] ASUS ISA-386C", "asus386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512, 16384, 128, 127, machine_at_asus386_init, NULL }, { "[ISA] Compaq Portable III (386)", "portableiii386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT | MACHINE_HDC | MACHINE_VIDEO, 1, 14, 1, 127, machine_at_portableiii386_init, at_cpqiii_get_device }, - { "[ISA] Micronics 386 clone", "micronics386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512, 8192, 128, 127, machine_at_micronics386_init, NULL }, + { "[ISA] Micronics 386 clone", "micronics386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512, 8192, 128, 127, machine_at_micronics386_init, NULL }, { "[C&T 386] ECS 386/32", "ecs386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 1, 16, 1, 127, machine_at_ecs386_init, NULL }, - { "[UMC 491] US Technologies 386", "ustechnologies386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 1, 16, 1, 127, machine_at_ustechnologies386_init, NULL }, + { "[UMC 491] US Technologies 386", "ustechnologies386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 1, 16, 1, 127,machine_at_ustechnologies386_init, NULL }, /* 386DX machines which utilize the VLB bus */ { "[OPTi 495] Award 386DX clone", "award386dx", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 32, 1, 127, machine_at_opti495_init, NULL }, @@ -240,7 +240,7 @@ const machine_t machines[] = { { "[VIA VT82C496G] FIC VIP-IO2", "486vipio2", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 128, 1, 255, machine_at_486vipio2_init, NULL }, #endif #if defined(DEV_BRANCH) && defined(USE_M1489) - { "[ALi M1489] ABit AB-PB4", "abpb4", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 1, 64, 1, 255, machine_at_abpb4_init, NULL }, + { "[ALi M1489] ABIT AB-PB4", "abpb4", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 1, 64, 1, 255, machine_at_abpb4_init, NULL }, #endif #if defined(DEV_BRANCH) && defined(USE_STPC) { "[STPC Client] ITOX STAR", "itoxstar", MACHINE_TYPE_486, {{"ST", cpus_STPC6675}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 255, machine_at_itoxstar_init, NULL }, @@ -283,7 +283,7 @@ const machine_t machines[] = { /* 430FX */ { "[i430FX-3V] ASUS P/I-P54TP4XE", "p54tp4xe", MACHINE_TYPE_SOCKET7_3V, MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_p54tp4xe_init, NULL }, { "[i430FX-3V] ASUS P/I-P54TP4XE (MR BIOS)","mr586", MACHINE_TYPE_SOCKET7_3V, MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_HDC | MACHINE_PS2, 8, 128, 8, 127, machine_at_mr586_init, NULL }, - { "[i430FX-3V] Gateway 2000 P5-xxx", "gw2katx", MACHINE_TYPE_SOCKET7_3V, MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_gw2katx_init, NULL }, + { "[i430FX-3V] Gateway 2000 P5-xxx", "gw2katx", MACHINE_TYPE_SOCKET7_3V, MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_gw2katx_init, NULL }, { "[i430FX-3V] Intel Advanced/ATX", "thor", MACHINE_TYPE_SOCKET7_3V, MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_thor_init, NULL }, { "[i430FX-3V] Intel Advanced/ATX (MR BIOS)","mrthor", MACHINE_TYPE_SOCKET7_3V, MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_mrthor_init, NULL }, { "[i430FX-3V] Intel Advanced/EV", "endeavor", MACHINE_TYPE_SOCKET7_3V, MACHINE_CPUS_PENTIUM_S73V, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC | MACHINE_VIDEO, 8, 128, 8, 127, machine_at_endeavor_init, at_endeavor_get_device }, @@ -301,7 +301,7 @@ const machine_t machines[] = { { "[i430HX] Micronics M7S-Hi", "m7shi", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 511, machine_at_m7shi_init, NULL }, { "[i430HX] Intel TC430HX", "tc430hx", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 255, machine_at_tc430hx_init, NULL }, { "[i430HX] Toshiba Equium 5200D", "equium5200", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 192, 8, 127, machine_at_equium5200_init, NULL }, - { "[i430HX] Sony Vaio PCV-240", "pcv240", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 192, 8, 127, machine_at_pcv240_init, NULL }, + { "[i430HX] Sony Vaio PCV-240", "pcv240", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 192, 8, 127, machine_at_pcv240_init, NULL }, { "[i430HX] ASUS P/I-P65UP5 (C-P55T2D)", "p65up5_cp55t2d", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 512, 8, 127, machine_at_p65up5_cp55t2d_init, NULL }, /* 430VX */ @@ -309,8 +309,8 @@ const machine_t machines[] = { { "[i430VX] Shuttle HOT-557", "430vx", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_i430vx_init, NULL }, { "[i430VX] Epox P55-VA", "p55va", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_p55va_init, NULL }, { "[i430VX] HP Brio 80xx", "brio80xx", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_brio80xx_init, NULL }, - { "[i430VX] Biostar MB-8500TVX-A", "8500tvxa", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_8500tvxa_init, NULL }, - { "[i430VX] Compaq Presario 4500", "presario4500", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC | MACHINE_VIDEO, 8, 128, 8, 127, machine_at_presario4500_init, NULL }, + { "[i430VX] Biostar MB-8500TVX-A", "8500tvxa", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_8500tvxa_init, NULL }, + { "[i430VX] Compaq Presario 4500", "presario4500", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC | MACHINE_VIDEO, 8, 128, 8, 127, machine_at_presario4500_init, NULL }, { "[i430VX] Packard Bell PB680", "pb680", MACHINE_TYPE_SOCKET7, MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_pb680_init, NULL }, /* 430TX */ @@ -349,7 +349,7 @@ const machine_t machines[] = { /* 440LX */ { "[i440LX] ABIT LX6", "lx6", MACHINE_TYPE_SLOT1, {{"Intel", cpus_PentiumII66}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 1024, 8, 255, machine_at_lx6_init, NULL }, - { "[i440LX] Micronics Spitfire", "spitfire", MACHINE_TYPE_SLOT1, {{"Intel", cpus_PentiumII66}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 1024, 8, 255, machine_at_spitfire_init, NULL }, + { "[i440LX] Micronics Spitfire", "spitfire", MACHINE_TYPE_SLOT1, {{"Intel", cpus_PentiumII66}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 1024, 8, 255, machine_at_spitfire_init, NULL }, /* 440EX */ { "[i440EX] QDI EXCELLENT II", "p6i440e2", MACHINE_TYPE_SLOT1, {{"Intel", cpus_PentiumII66}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 512, 8, 255, machine_at_p6i440e2_init, NULL }, From 55b29db14b5b1423c07fe112a982472a439059c3 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Tue, 8 Sep 2020 22:06:28 -0300 Subject: [PATCH 4/8] Finish M6117 implementation --- src/cpu/cpu.h | 3 +++ src/cpu/cpu_table.c | 12 ++++++++++++ src/include/86box/chipset.h | 2 +- src/include/86box/machine.h | 5 ++++- src/machine/m_at_286_386sx.c | 26 ++++++++++++++++++++++++++ src/machine/machine_table.c | 5 ++++- src/win/Makefile.mingw | 13 ++++++++++++- 7 files changed, 62 insertions(+), 4 deletions(-) diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 3e104c15e..9ec85a4df 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -138,6 +138,9 @@ extern CPU cpus_i386SX[]; extern CPU cpus_i386DX[]; extern CPU cpus_Am386SX[]; extern CPU cpus_Am386DX[]; +#if defined(DEV_BRANCH) && defined(USE_M6117) +extern CPU cpus_ALiM6117[]; +#endif extern CPU cpus_486SLC[]; extern CPU cpus_486DLC[]; extern CPU cpus_IBM386SLC[]; diff --git a/src/cpu/cpu_table.c b/src/cpu/cpu_table.c index 03d42af0d..f3ed839db 100644 --- a/src/cpu/cpu_table.c +++ b/src/cpu/cpu_table.c @@ -211,6 +211,18 @@ CPU cpus_Am386DX[] = { {"", -1, 0, 0, 0, 0, 0, 0, 0,0,0,0, 0} }; + +#if defined(DEV_BRANCH) && defined(USE_M6117) +/* All M6117 timings and edx_reset values assumed. */ +CPU cpus_ALiM6117[] = { + /*i386DX/RapidCAD*/ + {"M6117/66", CPU_386DX, fpus_80386, 66666666, 1, 0x2308, 0, 0, 0, 3,3,3,3, 2}, + {"M6117/80", CPU_386DX, fpus_80386, 80000000, 1, 0x2308, 0, 0, 0, 4,4,3,3, 3}, + {"", -1, 0, 0, 0, 0, 0, 0, 0,0,0,0, 0} +}; +#endif + + CPU cpus_486SLC[] = { /*Cx486SLC*/ {"Cx486SLC/20", CPU_486SLC, fpus_80386, 20000000, 1, 0x400, 0, 0x0000, 0, 4,4,3,3, 3}, diff --git a/src/include/86box/chipset.h b/src/include/86box/chipset.h index 683491c85..71f3508a1 100644 --- a/src/include/86box/chipset.h +++ b/src/include/86box/chipset.h @@ -26,7 +26,7 @@ extern const device_t ali1429_device; #if defined(DEV_BRANCH) && defined(USE_M1489) extern const device_t ali1489_device; #endif -#if defined(DEV_BRANCH) && defined(USE_STPC) +#if defined(DEV_BRANCH) && defined(USE_M6117) extern const device_t ali6117d_device; #endif diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 4f4ca8e35..b095e59b7 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -241,7 +241,10 @@ extern int machine_at_adi386sx_init(const machine_t *); extern int machine_at_commodore_sl386sx_init(const machine_t *); extern int machine_at_wd76c10_init(const machine_t *); -extern int machine_at_awardsx_init(const machine_t *); +extern int machine_at_awardsx_init(const machine_t *); +#if defined(DEV_BRANCH) && defined(USE_M6117) +extern int machine_at_pja511m_init(const machine_t *); +#endif #ifdef EMU_DEVICE_H extern const device_t *at_ama932j_get_device(void); diff --git a/src/machine/m_at_286_386sx.c b/src/machine/m_at_286_386sx.c index 41f0650b0..e9f8662b3 100644 --- a/src/machine/m_at_286_386sx.c +++ b/src/machine/m_at_286_386sx.c @@ -36,6 +36,7 @@ #include <86box/hdc.h> #include <86box/sio.h> #include <86box/video.h> +#include <86box/flash.h> #include <86box/machine.h> int @@ -545,3 +546,28 @@ machine_at_awardsx_init(const machine_t *model) return ret; } + + +#if defined(DEV_BRANCH) && defined(USE_M6117) +int +machine_at_pja511m_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear(L"roms/machines/pja511m/2006915102435734.rom", + 0x000e0000, 131072, 0); + + if (bios_only || !ret) + return ret; + + machine_at_common_init(model); + + device_add_inst(&fdc37c669_device, 1); + //device_add_inst(&fdc37c669_device, 2); /* enable when dual FDC37C669 is implemented */ + device_add(&keyboard_ps2_ami_pci_device); + device_add(&ali6117d_device); + device_add(&sst_flash_29ee010_device); + + return ret; +} +#endif diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index eb8f62d6f..177b6c2ca 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -179,13 +179,16 @@ const machine_t machines[] = { { "[Intel 82335] Shuttle 386SX", "shuttle386sx", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512, 8192, 128, 127, machine_at_shuttle386sx_init, NULL }, { "[Intel 82335] ADI 386SX", "adi386sx", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512, 8192, 128, 127, machine_at_adi386sx_init, NULL }, { "[OPTi 291] DTK PPM-3333P", "awardsx", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 1, 16, 1, 127, machine_at_awardsx_init, NULL }, +#if defined(DEV_BRANCH) && defined(USE_M6117) + { "[ALi M6117D] Acrosser PJ-A511M", "pja511m", MACHINE_TYPE_386SX, {{"ALi", cpus_ALiM6117}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 1, 64, 1, 127, machine_at_pja511m_init, NULL }, +#endif /* 386SX machines which utilize the MCA bus */ { "[MCA] IBM PS/2 model 55SX", "ibmps2_m55sx", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"IBM",cpus_IBM486SLC},{"", NULL}}, MACHINE_MCA | MACHINE_AT | MACHINE_PS2 | MACHINE_VIDEO, 1, 8, 1, 63, machine_ps2_model_55sx_init, NULL }, /* 386DX machines */ { "[ACC 2168] AMI 386DX clone", "acc386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512, 16384, 128, 127, machine_at_acc386_init, NULL }, - { "[SiS 310] ASUS ISA-386C", "asus386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512, 16384, 128, 127, machine_at_asus386_init, NULL }, + { "[SiS 310] ASUS ISA-386C", "asus386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512, 16384, 128, 127, machine_at_asus386_init, NULL }, { "[ISA] Compaq Portable III (386)", "portableiii386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT | MACHINE_HDC | MACHINE_VIDEO, 1, 14, 1, 127, machine_at_portableiii386_init, at_cpqiii_get_device }, { "[ISA] Micronics 386 clone", "micronics386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512, 8192, 128, 127, machine_at_micronics386_init, NULL }, { "[C&T 386] ECS 386/32", "ecs386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 1, 16, 1, 127, machine_at_ecs386_init, NULL }, diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index bdcaf3c6b..bd25e6ca4 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -84,6 +84,9 @@ ifeq ($(DEV_BUILD), y) ifndef M1489 M1489 := y endif + ifndef M6117 + M6117 := y + endif ifndef VGAWONDER VGAWONDER := y endif @@ -163,6 +166,9 @@ else ifndef M1489 M1489 := n endif + ifndef M6117 + M6117 := n + endif ifndef VGAWONDER VGAWONDER := n endif @@ -560,7 +566,7 @@ endif ifeq ($(STPC), y) OPTS += -DUSE_STPC -DEVBROBJ += ali6117.o stpc.o +DEVBROBJ += stpc.o endif ifeq ($(M1489), y) @@ -568,6 +574,11 @@ OPTS += -DUSE_M1489 DEVBROBJ += ali1489.o endif +ifeq ($(M6117), y) +OPTS += -DUSE_M6117 +DEVBROBJ += ali6117.o +endif + ifeq ($(596B), y) OPTS += -DUSE_596B endif From a129291a0d3844d719cca48b555499899fe12fa3 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Tue, 8 Sep 2020 22:10:13 -0300 Subject: [PATCH 5/8] Change STPC CPU table to better values, more in line with the 486 CPU list and BIOS identification naming schemes --- src/cpu/cpu.h | 4 ++-- src/cpu/cpu_table.c | 10 +++++----- src/machine/machine_table.c | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 9ec85a4df..c8e5ab924 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -153,8 +153,8 @@ extern CPU cpus_i486[]; extern CPU cpus_Am486[]; extern CPU cpus_Cx486[]; #if defined(DEV_BRANCH) && defined(USE_STPC) -extern CPU cpus_STPC6675[]; -extern CPU cpus_STPC133[]; +extern CPU cpus_STPCDX[]; +extern CPU cpus_STPCDX2[]; #endif extern CPU cpus_WinChip[]; extern CPU cpus_WinChip_SS7[]; diff --git a/src/cpu/cpu_table.c b/src/cpu/cpu_table.c index f3ed839db..266872976 100644 --- a/src/cpu/cpu_table.c +++ b/src/cpu/cpu_table.c @@ -386,14 +386,14 @@ CPU cpus_Cx486[] = { #if defined(DEV_BRANCH) && defined(USE_STPC) /* All STPC timings and Cyrix CPUID values assumed. */ -CPU cpus_STPC6675[] = { - {"STPC 66", CPU_Cx486DX, fpus_internal, 66666666, 1.0, 0x430, 0, 0x051a, CPU_SUPPORTS_DYNAREC, 7, 7, 3, 3, 5}, - {"STPC 75", CPU_Cx486DX, fpus_internal, 75000000, 1.0, 0x430, 0, 0x051a, CPU_SUPPORTS_DYNAREC, 7, 7, 3, 3, 5}, +CPU cpus_STPCDX[] = { + {"STPC-DX/66", CPU_Cx486DX, fpus_internal, 66666666, 1.0, 0x430, 0, 0x051a, CPU_SUPPORTS_DYNAREC, 7, 7, 3, 3, 5}, + {"STPC-DX/75", CPU_Cx486DX, fpus_internal, 75000000, 1.0, 0x430, 0, 0x051a, CPU_SUPPORTS_DYNAREC, 7, 7, 3, 3, 5}, {"", -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; -CPU cpus_STPC133[] = { - {"STPC 133", CPU_Cx486DX2, fpus_internal, 133333333, 2.0, 0x430, 0, 0x0b1b, CPU_SUPPORTS_DYNAREC, 14,14, 6, 6, 10}, +CPU cpus_STPCDX2[] = { + {"STPC-DX2/133", CPU_Cx486DX2, fpus_internal, 133333333, 2.0, 0x430, 0, 0x0b1b, CPU_SUPPORTS_DYNAREC, 14,14, 6, 6, 10}, {"", -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; #endif diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 177b6c2ca..aea45202f 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -246,10 +246,10 @@ const machine_t machines[] = { { "[ALi M1489] ABIT AB-PB4", "abpb4", MACHINE_TYPE_486, {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 1, 64, 1, 255, machine_at_abpb4_init, NULL }, #endif #if defined(DEV_BRANCH) && defined(USE_STPC) - { "[STPC Client] ITOX STAR", "itoxstar", MACHINE_TYPE_486, {{"ST", cpus_STPC6675}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 255, machine_at_itoxstar_init, NULL }, - { "[STPC Consumer-II] Acrosser AR-B1479", "arb1479", MACHINE_TYPE_486, {{"ST", cpus_STPC133}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 32, 160, 8, 255, machine_at_arb1479_init, NULL }, - { "[STPC Elite] Advantech PCM-9340", "pcm9340", MACHINE_TYPE_486, {{"ST", cpus_STPC133}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 32, 96, 8, 255, machine_at_pcm9340_init, NULL }, - { "[STPC Atlas] AAEON PCM-5330", "pcm5330", MACHINE_TYPE_486, {{"ST", cpus_STPC133}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 32, 128, 32, 255, machine_at_pcm5330_init, NULL }, + { "[STPC Client] ITOX STAR", "itoxstar", MACHINE_TYPE_486, {{"ST", cpus_STPCDX}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 255, machine_at_itoxstar_init, NULL }, + { "[STPC Consumer-II] Acrosser AR-B1479", "arb1479", MACHINE_TYPE_486, {{"ST", cpus_STPCDX2}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 32, 160, 8, 255, machine_at_arb1479_init, NULL }, + { "[STPC Elite] Advantech PCM-9340", "pcm9340", MACHINE_TYPE_486, {{"ST", cpus_STPCDX2}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 32, 96, 8, 255, machine_at_pcm9340_init, NULL }, + { "[STPC Atlas] AAEON PCM-5330", "pcm5330", MACHINE_TYPE_486, {{"ST", cpus_STPCDX2}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 32, 128, 32, 255, machine_at_pcm5330_init, NULL }, #endif /* Socket 4 machines */ From 8d44f2e32958156a4a7d5936d1dfaa631074c8c9 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Tue, 8 Sep 2020 22:10:35 -0300 Subject: [PATCH 6/8] Remove unused M6117 SMRAM function --- src/chipset/ali6117.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/chipset/ali6117.c b/src/chipset/ali6117.c index 14967e4f9..16732d046 100644 --- a/src/chipset/ali6117.c +++ b/src/chipset/ali6117.c @@ -114,13 +114,6 @@ ali6117_recalcmapping(ali6117_t *dev) } -static void -ali6117_smram_map(int smm, uint32_t addr, uint32_t size, int is_smram) -{ - mem_set_mem_state_smram(smm, addr, size, is_smram); -} - - static void ali6117_reg_write(uint16_t addr, uint8_t val, void *priv) { From 4107c2090e367fb71057bb19760e02f9c205e1a5 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Tue, 8 Sep 2020 22:19:36 -0300 Subject: [PATCH 7/8] Fix M6117 clocking mistake; the CPU has a clock divider(!) --- src/cpu/cpu_table.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cpu/cpu_table.c b/src/cpu/cpu_table.c index 266872976..8d6a097ec 100644 --- a/src/cpu/cpu_table.c +++ b/src/cpu/cpu_table.c @@ -216,8 +216,8 @@ CPU cpus_Am386DX[] = { /* All M6117 timings and edx_reset values assumed. */ CPU cpus_ALiM6117[] = { /*i386DX/RapidCAD*/ - {"M6117/66", CPU_386DX, fpus_80386, 66666666, 1, 0x2308, 0, 0, 0, 3,3,3,3, 2}, - {"M6117/80", CPU_386DX, fpus_80386, 80000000, 1, 0x2308, 0, 0, 0, 4,4,3,3, 3}, + {"M6117/33", CPU_386DX, fpus_80386, 33333333, 1, 0x2308, 0, 0, 0, 6,6,3,3, 4}, + {"M6117/40", CPU_386DX, fpus_80386, 40000000, 1, 0x2308, 0, 0, 0, 7,7,3,3, 5}, {"", -1, 0, 0, 0, 0, 0, 0, 0,0,0,0, 0} }; #endif From 5b016edb2a956826f8703540ad95aca4dfdefd04 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Tue, 8 Sep 2020 22:54:30 -0300 Subject: [PATCH 8/8] Add non-working AMI M6117 machine --- src/chipset/ali6117.c | 2 +- src/include/86box/machine.h | 1 + src/machine/m_at_286_386sx.c | 22 ++++++++++++++++++++++ src/machine/machine_table.c | 3 ++- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/chipset/ali6117.c b/src/chipset/ali6117.c index 16732d046..52759ad20 100644 --- a/src/chipset/ali6117.c +++ b/src/chipset/ali6117.c @@ -77,7 +77,7 @@ ali6117_recalcmapping(ali6117_t *dev) shadowbios = 0; shadowbios_write = 0; - ali6117_log("M6117: Shadowing for 0xa0000-0xbffff (reg %02X) = %s\n", (dev->regs[0x12] & 0x02) ? "on" : "off"); + ali6117_log("M6117: Shadowing for a0000-bffff (reg 12) = %s\n", (dev->regs[0x12] & 0x02) ? "on" : "off"); mem_set_mem_state(0xa0000, 0x20000, (dev->regs[0x12] & 0x02) ? (MEM_WRITE_INTERNAL | MEM_READ_INTERNAL) : (MEM_WRITE_EXTANY | MEM_READ_EXTANY)); for (reg = 0; reg <= 1; reg++) { diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index b095e59b7..6be53cdc2 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -243,6 +243,7 @@ extern int machine_at_wd76c10_init(const machine_t *); extern int machine_at_awardsx_init(const machine_t *); #if defined(DEV_BRANCH) && defined(USE_M6117) +extern int machine_at_arb1375_init(const machine_t *); extern int machine_at_pja511m_init(const machine_t *); #endif diff --git a/src/machine/m_at_286_386sx.c b/src/machine/m_at_286_386sx.c index e9f8662b3..5e593b332 100644 --- a/src/machine/m_at_286_386sx.c +++ b/src/machine/m_at_286_386sx.c @@ -549,6 +549,28 @@ machine_at_awardsx_init(const machine_t *model) #if defined(DEV_BRANCH) && defined(USE_M6117) +int +machine_at_arb1375_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear(L"roms/machines/arb1375/a1375v25.u11-a", + 0x000e0000, 131072, 0); + + if (bios_only || !ret) + return ret; + + machine_at_common_init(model); + + device_add(&fdc37c669_device); + device_add(&keyboard_ps2_ami_pci_device); + device_add(&ali6117d_device); + device_add(&sst_flash_29ee010_device); + + return ret; +} + + int machine_at_pja511m_init(const machine_t *model) { diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index aea45202f..546633c76 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -180,7 +180,8 @@ const machine_t machines[] = { { "[Intel 82335] ADI 386SX", "adi386sx", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 512, 8192, 128, 127, machine_at_adi386sx_init, NULL }, { "[OPTi 291] DTK PPM-3333P", "awardsx", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 1, 16, 1, 127, machine_at_awardsx_init, NULL }, #if defined(DEV_BRANCH) && defined(USE_M6117) - { "[ALi M6117D] Acrosser PJ-A511M", "pja511m", MACHINE_TYPE_386SX, {{"ALi", cpus_ALiM6117}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 1, 64, 1, 127, machine_at_pja511m_init, NULL }, + { "[ALi M6117D] Acrosser AR-B1375", "arb1375", MACHINE_TYPE_386SX, {{"ALi", cpus_ALiM6117}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 1, 32, 1, 127, machine_at_arb1375_init, NULL }, + { "[ALi M6117D] Acrosser PJ-A511M", "pja511m", MACHINE_TYPE_386SX, {{"ALi", cpus_ALiM6117}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 1, 32, 1, 127, machine_at_pja511m_init, NULL }, #endif /* 386SX machines which utilize the MCA bus */