From dd914429d8cbe5ec996b22412398b491e661b126 Mon Sep 17 00:00:00 2001 From: tiseno100 <58827426+tiseno100@users.noreply.github.com> Date: Tue, 29 Sep 2020 12:07:03 +0300 Subject: [PATCH] Added the Phoenix 486 Jumper Readout port A must have for Phoenix 486 machines --- src/chipset/acc2168.c | 17 ----- src/device/phoenix_486_jumper.c | 107 ++++++++++++++++++++++++++++++++ src/include/86box/chipset.h | 1 + src/machine/m_at_386dx_486.c | 2 + src/win/Makefile.mingw | 3 +- 5 files changed, 112 insertions(+), 18 deletions(-) create mode 100644 src/device/phoenix_486_jumper.c diff --git a/src/chipset/acc2168.c b/src/chipset/acc2168.c index 11bca1cac..cab02eed1 100644 --- a/src/chipset/acc2168.c +++ b/src/chipset/acc2168.c @@ -100,21 +100,6 @@ acc2168_read(uint16_t addr, void *p) return dev->regs[dev->reg_idx]; } - -/* - Bit 7 = Super I/O chip: 1 = enabled, 0 = disabled; - Bit 6 = Graphics card: 1 = standalone, 0 = on-board; - Bit 5 = ???? (if 1, siren and hangs). -*/ -static uint8_t -acc2168_port_78_read(uint16_t addr, void *p) -{ - acc2168_t *dev = (acc2168_t *)p; - - return dev->port_78; -} - - static void acc2168_close(void *priv) { @@ -132,8 +117,6 @@ acc2168_init(const device_t *info) io_sethandler(0x00f2, 0x0002, acc2168_read, NULL, NULL, acc2168_write, NULL, NULL, dev); - io_sethandler(0x0078, 0x0001, - acc2168_port_78_read, NULL, NULL, NULL, NULL, NULL, dev); device_add(&port_92_inv_device); diff --git a/src/device/phoenix_486_jumper.c b/src/device/phoenix_486_jumper.c new file mode 100644 index 000000000..4383a828d --- /dev/null +++ b/src/device/phoenix_486_jumper.c @@ -0,0 +1,107 @@ +/* + * 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 Phoenix 486 Jumper Readout + * + * Copyright 2020 Tiseno100 + */ + + +#include +#include +#include +#include +#include +#include +#define HAVE_STDARG_H +#include <86box/86box.h> +#include "cpu.h" +#include <86box/timer.h> +#include <86box/io.h> +#include <86box/device.h> +#include <86box/chipset.h> + +/* +Bit 7 = Super I/O +Bit 6 = ??? +Bit 5 = ??? +Bit 4 = ??? +Bit 3 = ??? +Bit 2 = ??? +Bit 1 = ??? +Bit 0 = ??? +*/ + +typedef struct +{ + uint8_t jumper; +} phoenix_486_jumper_t; + +#ifdef ENABLE_PHOENIX_486_JUMPER_LOG +int phoenix_486_jumper_do_log = ENABLE_PHOENIX_486_JUMPER_LOG; +static void +phoenix_486_jumper_log(const char *fmt, ...) +{ + va_list ap; + + if (phoenix_486_jumper_do_log) { + va_start(ap, fmt); + pclog_ex(fmt, ap); + va_end(ap); + } +} +#else +#define phoenix_486_jumper_log(fmt, ...) +#endif + +static void +phoenix_486_jumper_write(uint16_t addr, uint8_t val, void *priv) +{ + phoenix_486_jumper_t *dev = (phoenix_486_jumper_t *) priv; + phoenix_486_jumper_log("Phoenix 486 Jumper: Write %02x\n", val); + dev->jumper = val; +} + +static uint8_t +phoenix_486_jumper_read(uint16_t addr, void *priv) +{ + phoenix_486_jumper_t *dev = (phoenix_486_jumper_t *) priv; + phoenix_486_jumper_log("Phoenix 486 Jumper: Read %02x\n", dev->jumper); + return dev->jumper; +} + + +static void +phoenix_486_jumper_close(void *priv) +{ + phoenix_486_jumper_t *dev = (phoenix_486_jumper_t *) priv; + + free(dev); +} + +static void * +phoenix_486_jumper_init(const device_t *info) +{ + phoenix_486_jumper_t *dev = (phoenix_486_jumper_t *) malloc(sizeof(phoenix_486_jumper_t)); + memset(dev, 0, sizeof(phoenix_486_jumper_t)); + + dev->jumper = info->local; + + io_sethandler(0x0078, 0x0001, phoenix_486_jumper_read, NULL, NULL, phoenix_486_jumper_write, NULL, NULL, dev); + + return dev; +} + +const device_t phoenix_486_jumper_device = { + "Phoenix 486 Jumper Readout", + 0, + 0, + phoenix_486_jumper_init, phoenix_486_jumper_close, NULL, + NULL, NULL, NULL, + NULL +}; diff --git a/src/include/86box/chipset.h b/src/include/86box/chipset.h index 6a31d08a7..e70515676 100644 --- a/src/include/86box/chipset.h +++ b/src/include/86box/chipset.h @@ -131,6 +131,7 @@ extern const device_t vlsi_scamp_device; extern const device_t wd76c10_device; /* Miscellaneous Hardware */ +extern const device_t phoenix_486_jumper_device; extern const device_t vpc2007_device; #endif /*EMU_CHIPSET_H*/ diff --git a/src/machine/m_at_386dx_486.c b/src/machine/m_at_386dx_486.c index dbaf729b7..10ae6413d 100644 --- a/src/machine/m_at_386dx_486.c +++ b/src/machine/m_at_386dx_486.c @@ -200,6 +200,8 @@ machine_at_pb410a_init(const machine_t *model) device_add(&acc3221_device); device_add(&acc2168_device); + device_add(&phoenix_486_jumper_device); + if (gfxcard == VID_INTERNAL) device_add(&ht216_32_pb410a_device); diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index 3f19d9b54..fcd35a524 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -656,7 +656,8 @@ DEVOBJ := bugger.o hwm.o hwm_lm75.o hwm_lm78.o hwm_gl518sm.o ibm_5161.o isamem. keyboard_xt.o keyboard_at.o \ mouse.o \ mouse_bus.o \ - mouse_serial.o mouse_ps2.o + mouse_serial.o mouse_ps2.o \ + phoenix_486_jumper.o SIOOBJ := sio_acc3221.o \ sio_f82c710.o sio_82091aa.o \