From 066f89c5a4a37375fcf0528e8f5380fd2a3e2f93 Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 16 Oct 2020 13:05:19 +0200 Subject: [PATCH] Added the AMI Apollo. --- src/include/86box/machine.h | 1 + src/include/86box/nvr.h | 1 + src/include/86box/sio.h | 1 + src/machine/m_at_socket4_5.c | 32 +++++++++++++++++++++ src/machine/machine_table.c | 1 + src/nvr_at.c | 55 ++++++++++++++++++++++++++++-------- src/sio/sio_82091aa.c | 10 +++++++ 7 files changed, 89 insertions(+), 12 deletions(-) diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 501756471..f333c9b3f 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -366,6 +366,7 @@ extern int machine_at_p54tp4xe_init(const machine_t *); extern int machine_at_endeavor_init(const machine_t *); extern int machine_at_zappa_init(const machine_t *); extern int machine_at_mb500n_init(const machine_t *); +extern int machine_at_apollo_init(const machine_t *); #if defined(DEV_BRANCH) && defined(USE_VECTRA54) extern int machine_at_vectra54_init(const machine_t *); #endif diff --git a/src/include/86box/nvr.h b/src/include/86box/nvr.h index 1b0088f0b..6ceedb180 100644 --- a/src/include/86box/nvr.h +++ b/src/include/86box/nvr.h @@ -93,6 +93,7 @@ extern const device_t amstrad_nvr_device; extern const device_t ibmat_nvr_device; extern const device_t piix4_nvr_device; extern const device_t ls486e_nvr_device; +extern const device_t ami_apollo_nvr_device; extern const device_t via_nvr_device; #endif diff --git a/src/include/86box/sio.h b/src/include/86box/sio.h index 51fe2f19e..c3a4801d3 100644 --- a/src/include/86box/sio.h +++ b/src/include/86box/sio.h @@ -30,6 +30,7 @@ extern const device_t fdc37c932fr_device; extern const device_t fdc37c932qf_device; extern const device_t fdc37c935_device; extern const device_t i82091aa_device; +extern const device_t i82091aa_398_device; extern const device_t i82091aa_ide_device; extern const device_t pc87306_device; extern const device_t pc87307_device; diff --git a/src/machine/m_at_socket4_5.c b/src/machine/m_at_socket4_5.c index 3ae081dbb..e79395680 100644 --- a/src/machine/m_at_socket4_5.c +++ b/src/machine/m_at_socket4_5.c @@ -426,6 +426,7 @@ machine_at_zappa_init(const machine_t *model) return ret; } + int machine_at_mb500n_init(const machine_t *model) { @@ -456,6 +457,37 @@ machine_at_mb500n_init(const machine_t *model) } +int +machine_at_apollo_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear(L"roms/machines/apollo/S728P.ROM", + 0x000e0000, 131072, 0); + + if (bios_only || !ret) + return ret; + + machine_at_common_init_ex(model, 2); + device_add(&ami_apollo_nvr_device); + + pci_init(PCI_CONFIG_TYPE_1); + pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x08, PCI_CARD_NORMAL, 1, 2, 3, 4); + pci_register_slot(0x09, PCI_CARD_NORMAL, 2, 3, 4, 1); + pci_register_slot(0x0A, PCI_CARD_NORMAL, 3, 4, 1, 2); + pci_register_slot(0x0B, PCI_CARD_NORMAL, 4, 1, 2, 3); + pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); + device_add(&keyboard_ps2_ami_pci_device); + device_add(&i430fx_device); + device_add(&piix_device); + device_add(&pc87332_ps1_device); + device_add(&intel_flash_bxt_device); + + return ret; +} + + #if defined(DEV_BRANCH) && defined(USE_VECTRA54) int machine_at_vectra54_init(const machine_t *model) diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 2f45c11e7..b4be54184 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -278,6 +278,7 @@ const machine_t machines[] = { /* 430FX */ { "[i430FX] Acer V30", "acerv30", MACHINE_TYPE_SOCKET5, MACHINE_CPUS_PENTIUM_S5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 128, 8, 127, machine_at_acerv30_init, NULL }, + { "[i430FX] AMI Apollo", "apollo", MACHINE_TYPE_SOCKET5, MACHINE_CPUS_PENTIUM_S5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 128, 8, 127, machine_at_apollo_init, NULL }, #if defined(DEV_BRANCH) && defined(USE_VECTRA54) { "[i430FX] HP Vectra VL 5 Series 4", "vectra54", MACHINE_TYPE_SOCKET5, MACHINE_CPUS_PENTIUM_S5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8, 128, 8, 511, machine_at_vectra54_init, NULL }, #endif diff --git a/src/nvr_at.c b/src/nvr_at.c index 0536a806c..5636260ad 100644 --- a/src/nvr_at.c +++ b/src/nvr_at.c @@ -286,8 +286,9 @@ #define RTC_CENTURY_VIA 0x7F /* century register for VIA VT82C586B */ #define RTC_REGS 14 /* number of registers */ -#define FLAG_LS_HACK 0x01 -#define FLAG_PIIX4 0x02 +#define FLAG_LS_HACK 0x01 +#define FLAG_APOLLO_HACK 0x02 +#define FLAG_PIIX4 0x04 typedef struct { @@ -703,9 +704,7 @@ nvr_read(uint16_t addr, void *priv) case 0x2e: case 0x2f: if (local->flags & FLAG_LS_HACK) { - checksum = (nvr->regs[0x2e] << 8) | nvr->regs[0x2f]; - if (nvr->regs[0x2c] & 0x80) - checksum -= 0x80; + checksum = ((nvr->regs[0x2e] << 8) | nvr->regs[0x2f]) - (nvr->regs[0x2c] & 0x80); if (local->addr[addr_id] == 0x2e) ret = checksum >> 8; else @@ -714,6 +713,25 @@ nvr_read(uint16_t addr, void *priv) ret = nvr->regs[local->addr[addr_id]]; break; + case 0x3e: + case 0x3f: + if (local->flags & FLAG_APOLLO_HACK) { + checksum = ((nvr->regs[0x3e] << 8) | nvr->regs[0x3f]) - (nvr->regs[0x52] & 0x0c); + if (local->addr[addr_id] == 0x3e) + ret = checksum >> 8; + else + ret = checksum & 0xff; + } else + ret = nvr->regs[local->addr[addr_id]]; + break; + + case 0x52: + if (local->flags & FLAG_APOLLO_HACK) + ret = nvr->regs[local->addr[addr_id]] & 0xf3; + else + ret = nvr->regs[local->addr[addr_id]]; + break; + default: ret = nvr->regs[local->addr[addr_id]]; break; @@ -894,13 +912,17 @@ nvr_at_init(const device_t *info) local->cent = 0xff; break; - case 5: /* Lucky Star LS-486E */ - local->flags |= FLAG_LS_HACK; - /*FALLTHROUGH*/ - case 1: /* standard AT */ + case 5: /* Lucky Star LS-486E */ + case 6: /* AMI Apollo */ if (info->local == 9) local->flags |= FLAG_PIIX4; + else { + if ((info->local & 7) == 5) + local->flags |= FLAG_LS_HACK; + else if ((info->local & 7) == 6) + local->flags |= FLAG_APOLLO_HACK; + } nvr->irq = 8; local->cent = RTC_CENTURY_AT; break; @@ -922,7 +944,7 @@ nvr_at_init(const device_t *info) local->def = 0xff; break; - case 6: /* VIA VT82C586B */ + case 7: /* VIA VT82C586B */ nvr->irq = 8; local->cent = RTC_CENTURY_VIA; break; @@ -1049,11 +1071,20 @@ const device_t ls486e_nvr_device = { NULL }; -const device_t via_nvr_device = { - "VIA PC/AT NVRAM", +const device_t ami_apollo_nvr_device = { + "AMI Apollo PC/AT NVRAM", DEVICE_ISA | DEVICE_AT, 14, nvr_at_init, nvr_at_close, NULL, NULL, nvr_at_speed_changed, NULL }; + +const device_t via_nvr_device = { + "VIA PC/AT NVRAM", + DEVICE_ISA | DEVICE_AT, + 15, + nvr_at_init, nvr_at_close, NULL, + NULL, nvr_at_speed_changed, + NULL +}; diff --git a/src/sio/sio_82091aa.c b/src/sio/sio_82091aa.c index c17473677..bf69d2f7d 100644 --- a/src/sio/sio_82091aa.c +++ b/src/sio/sio_82091aa.c @@ -285,6 +285,16 @@ const device_t i82091aa_device = { }; +const device_t i82091aa_398_device = { + "Intel 82091AA Super I/O (Port 398h)", + 0, + 0x148, + i82091aa_init, i82091aa_close, NULL, + NULL, NULL, NULL, + NULL +}; + + const device_t i82091aa_ide_device = { "Intel 82091AA Super I/O (With IDE)", 0,