diff --git a/src/chipset/CMakeLists.txt b/src/chipset/CMakeLists.txt index 6018dd045..94ef408f6 100644 --- a/src/chipset/CMakeLists.txt +++ b/src/chipset/CMakeLists.txt @@ -39,6 +39,7 @@ add_library(chipset OBJECT intel_i450kx.c intel_sio.c intel_piix.c + isa486c.c ../ioapic.c neat.c opti283.c diff --git a/src/chipset/isa486c.c b/src/chipset/isa486c.c new file mode 100644 index 000000000..6494ed1b8 --- /dev/null +++ b/src/chipset/isa486c.c @@ -0,0 +1,131 @@ +#include +#include +#include +#include +#include +#include +#define HAVE_STDARG_H +#include <86box/86box.h> +#include "cpu.h" +#include <86box/io.h> +#include <86box/device.h> +#include <86box/mem.h> +#include <86box/plat_unused.h> +#include <86box/chipset.h> + +typedef struct isa486c_t { + uint8_t regs[3]; +} isa486c_t; + +static void +isa486c_recalcmapping(isa486c_t *dev) +{ + uint32_t shflags = 0; + uint32_t bases[5] = { 0x000c0000, 0x000c8000, 0x000d0000, 0x000d8000, 0x000e0000 }; + uint32_t sizes[5] = { 0x00008000, 0x00008000, 0x00008000, 0x00008000, 0x00020000 }; + + if (dev->regs[1] & 0x20) + shflags = MEM_READ_EXTANY | MEM_WRITE_INTERNAL; + else + shflags = MEM_READ_INTERNAL | MEM_WRITE_EXTANY; + + shadowbios = 0; + shadowbios_write = 0; + + for (uint8_t i = 0; i < 5; i++) + if (dev->regs[1] & (1 << i)) { + if (i == 4) { + shadowbios = 1; + shadowbios_write = !!(dev->regs[1] & 0x20); + } + + mem_set_mem_state_both(bases[i], sizes[i], shflags); + } else + mem_set_mem_state_both(bases[i], sizes[i], MEM_READ_EXTANY | MEM_WRITE_EXTANY); + + flushmmucache_nopc(); +} + +static void +isa486c_write(uint16_t addr, uint8_t val, void *priv) +{ + isa486c_t *dev = (isa486c_t *) priv; + + switch (addr) { + case 0x0023: + dev->regs[0] = val; + break; + /* + Port 25h: + - Bit 0 = Video BIOS (C000-C7FF) shadow enabled; + - Bit 1 = C800-C8FF shadow enabled; + - Bit 2 = D000-D7FF shadow enabled; + - Bit 3 = D800-DFFF shadow enabled; + - Bit 4 = E000-FFFF shadow enabled (or F0000-FFFFF?); + - Bit 5 = If set, read from ROM, write to shadow; + - Bit 6 = KEN Video & BIOS enabled (cacheability!). + */ + case 0x0025: + dev->regs[1] = val; + isa486c_recalcmapping(dev); + break; + case 0x0027: + dev->regs[2] = val; + break; + } +} + +static uint8_t +isa486c_read(uint16_t addr, void *priv) +{ + isa486c_t *dev = (isa486c_t *) priv; + uint8_t ret = 0xff; + + switch (addr) { + case 0x0023: + ret = dev->regs[0]; + break; + case 0x0025: + ret = dev->regs[1]; + break; + case 0x0027: + ret = dev->regs[2]; + break; + } + + return ret; +} + +static void +isa486c_close(void *priv) +{ + isa486c_t *dev = (isa486c_t *) priv; + + free(dev); +} + +static void * +isa486c_init(UNUSED(const device_t *info)) +{ + isa486c_t *dev = (isa486c_t *) calloc(1, sizeof(isa486c_t)); + + io_sethandler(0x0023, 0x0001, isa486c_read, NULL, NULL, isa486c_write, NULL, NULL, dev); + io_sethandler(0x0025, 0x0001, isa486c_read, NULL, NULL, isa486c_write, NULL, NULL, dev); + io_sethandler(0x0027, 0x0001, isa486c_read, NULL, NULL, isa486c_write, NULL, NULL, dev); + + return dev; +} + +const device_t isa486c_device = { + .name = "ASUS ISA-486C Gate Array", + .internal_name = "isa486c", + .flags = 0, + .local = 0, + .init = isa486c_init, + .close = isa486c_close, + .reset = NULL, + .available = NULL, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; diff --git a/src/device/postcard.c b/src/device/postcard.c index 9e2c629c1..b91d8b402 100644 --- a/src/device/postcard.c +++ b/src/device/postcard.c @@ -158,6 +158,8 @@ postcard_init(UNUSED(const device_t *info)) postcard_port = 0x84; /* ISA Compaq machines */ else if (strstr(machines[machine].name, "Olivetti")) postcard_port = 0x378; /* Olivetti machines */ + else if (!strcmp(machines[machine].internal_name, "isa486c")) + postcard_port = 0x5080; /* ASUS ISA-486C */ else postcard_port = 0x80; /* AT and clone machines */ postcard_log("POST card initializing on port %04Xh\n", postcard_port); diff --git a/src/include/86box/chipset.h b/src/include/86box/chipset.h index 3a65bbce9..fe088b209 100644 --- a/src/include/86box/chipset.h +++ b/src/include/86box/chipset.h @@ -37,6 +37,9 @@ extern const device_t ali6117d_device; /* AMD */ extern const device_t amd640_device; +/* ASUS */ +extern const device_t isa486c_device; + /* Compaq */ extern const device_t compaq_386_device; extern const device_t compaq_genoa_device; diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index d8c213d53..996f2bf5f 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -508,6 +508,7 @@ extern int machine_at_pc916sx_init(const machine_t *); sure this appear here (and in the .c file) in the order and position in which they appear in the machine table. */ extern int machine_at_dataexpert386wb_init(const machine_t *); +extern int machine_at_isa486c_init(const machine_t *); extern int machine_at_genoa486_init(const machine_t *); extern int machine_at_ga486l_init(const machine_t *); extern int machine_at_cougar_init(const machine_t *); diff --git a/src/machine/m_at_386dx_486.c b/src/machine/m_at_386dx_486.c index ed8f75a84..e3838ce32 100644 --- a/src/machine/m_at_386dx_486.c +++ b/src/machine/m_at_386dx_486.c @@ -2445,6 +2445,30 @@ machine_at_dataexpert386wb_init(const machine_t *model) return ret; } +int +machine_at_isa486c_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear("roms/machines/isa486c/asus-isa-486c-401a0-040591-657e2c17a0218417632602.bin", + 0x000f0000, 65536, 0); + + if (bios_only || !ret) + return ret; + + machine_at_common_init(model); + + device_add(&isa486c_device); + device_add(&port_92_key_device); + + device_add(&keyboard_at_ami_device); + + if (fdc_current[0] == FDC_INTERNAL) + device_add(&fdc_at_device); + + return ret; +} + int machine_at_genoa486_init(const machine_t *model) { diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 7e0ae8d64..adf132a5d 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -5998,6 +5998,46 @@ const machine_t machines[] = { }, /* 486 machines - Socket 1 */ + /* Has Award KBC firmware. */ + { + .name = "[ZyMOS Poach] ASUS ISA-486C", + .internal_name = "isa486c", + .type = MACHINE_TYPE_486, + .chipset = MACHINE_CHIPSET_ZYMOS_POACH, + .init = machine_at_isa486c_init, + .p1_handler = NULL, + .gpio_handler = NULL, + .available_flag = MACHINE_AVAILABLE, + .gpio_acpi_handler = NULL, + .cpu = { + .package = CPU_PKG_SOCKET1, + .block = CPU_BLOCK_NONE, + .min_bus = 0, + .max_bus = 0, + .min_voltage = 0, + .max_voltage = 0, + .min_multi = 0, + .max_multi = 0 + }, + .bus_flags = MACHINE_AT, + .flags = MACHINE_APM, + .ram = { + .min = 1024, + .max = 16384, + .step = 1024 + }, + .nvrmask = 127, + .kbc_device = NULL, + .kbc_p1 = 0xff, + .gpio = 0xffffffff, + .gpio_acpi = 0xffffffff, + .device = NULL, + .fdc_device = NULL, + .sio_device = NULL, + .vid_device = NULL, + .snd_device = NULL, + .net_device = NULL + }, /* Has AMI KF KBC firmware. */ { .name = "[ZyMOS Poach] Genoa Unknown 486", diff --git a/src/sound/saasound/SAAImpl.cpp b/src/sound/saasound/SAAImpl.cpp index f136eefc6..cb5d8f739 100644 --- a/src/sound/saasound/SAAImpl.cpp +++ b/src/sound/saasound/SAAImpl.cpp @@ -306,7 +306,6 @@ void scale_for_output(unsigned int left_input, unsigned int right_input, void CSAASoundInternal::GenerateMany(BYTE* pBuffer, unsigned long nSamples) { unsigned int left_mixed, right_mixed; - static double filterout_z1_left_mixed = 0, filterout_z1_right_mixed = 0; #if defined(DEBUGSAA) || defined(USE_CONFIG_FILE) BYTE* pBufferStart = pBuffer; diff --git a/src/sound/saasound/SAAImpl.h b/src/sound/saasound/SAAImpl.h index 61fa79c58..6cd3048fe 100755 --- a/src/sound/saasound/SAAImpl.h +++ b/src/sound/saasound/SAAImpl.h @@ -36,6 +36,8 @@ private: unsigned int m_nSampleRate; unsigned int m_nOversample; bool m_bHighpass; + double filterout_z1_left_mixed = 0; + double filterout_z1_right_mixed = 0; #ifdef USE_CONFIG_FILE SAAConfig m_Config; #endif