From 47a83d92ea6db0691bb3e74cb8d4e3b858c0f519 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 2 Feb 2025 04:38:06 -0500 Subject: [PATCH 1/4] Rename define+device for lotech EMS board --- src/device/isamem.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/device/isamem.c b/src/device/isamem.c index 4dc88cc6c..d248e985e 100644 --- a/src/device/isamem.c +++ b/src/device/isamem.c @@ -102,7 +102,7 @@ #define ISAMEM_BRXT_CARD 13 #define ISAMEM_BRAT_CARD 14 #define ISAMEM_EV165A_CARD 15 -#define ISAMEM_LOTECH_CARD 16 +#define ISAMEM_LOTECH_EMS_CARD 16 #define ISAMEM_DEBUG 0 @@ -578,7 +578,7 @@ isamem_init(const device_t *info) dev->flags |= FLAG_FAST; break; - case ISAMEM_LOTECH_CARD: /* Lotech EMS */ + case ISAMEM_LOTECH_EMS_CARD: /* Lotech EMS */ /* The Lotech EMS cannot have more than 4096KB per board. */ ems_max = EMS_LOTECH_MAXSIZE; fallthrough; @@ -800,7 +800,7 @@ isamem_init(const device_t *info) mem_mapping_disable(&dev->ems[i].mapping); /* Set up an I/O port handler. */ - if (dev->board != ISAMEM_LOTECH_CARD) + if (dev->board != ISAMEM_LOTECH_EMS_CARD) io_sethandler(dev->base_addr[0] + (EMS_PGSIZE * i), 2, ems_in, NULL, NULL, ems_out, NULL, NULL, &(dev->ems[i])); @@ -831,7 +831,7 @@ isamem_init(const device_t *info) } } - if (dev->board == ISAMEM_LOTECH_CARD) + if (dev->board == ISAMEM_LOTECH_EMS_CARD) io_sethandler(dev->base_addr[0], 4, consecutive_ems_in, NULL, NULL, consecutive_ems_out, NULL, NULL, dev); } @@ -1856,11 +1856,11 @@ static const device_config_t lotech_config[] = { // clang-format on }; -static const device_t lotech_device = { +static const device_t lotech_ems_device = { .name = "Lo-tech EMS Board", .internal_name = "lotechems", .flags = DEVICE_ISA, - .local = ISAMEM_LOTECH_CARD, + .local = ISAMEM_LOTECH_EMS_CARD, .init = isamem_init, .close = isamem_close, .reset = NULL, @@ -2071,7 +2071,7 @@ static const struct { #ifdef USE_ISAMEM_IAB { &iab_device }, #endif /* USE_ISAMEM_IAB */ - { &lotech_device }, + { &lotech_ems_device }, { NULL } // clang-format on }; From a3fb32cdc3827ee3d49bcec8ea4ccfe1130a280f Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 2 Feb 2025 04:43:14 -0500 Subject: [PATCH 2/4] Rename define+device for Realtek 8019AS PNP --- src/include/86box/net_ne2000.h | 2 +- src/include/86box/network.h | 2 +- src/network/net_ne2000.c | 28 ++++++++++++++-------------- src/network/network.c | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/include/86box/net_ne2000.h b/src/include/86box/net_ne2000.h index cb17ef8b1..ecf2612b5 100644 --- a/src/include/86box/net_ne2000.h +++ b/src/include/86box/net_ne2000.h @@ -44,7 +44,7 @@ enum { NE2K_NE2000_COMPAT = 4, /* 16-bit ISA NE2000-Compatible */ NE2K_NE2000_COMPAT_8BIT = 5, /* 8-bit ISA NE2000-Compatible, like: https://github.com/skiselev/isa8_eth */ NE2K_ETHERNEXT_MC = 6, /* 16-bit MCA EtherNext/MC */ - NE2K_RTL8019AS = 7, /* 16-bit ISA PnP Realtek 8019AS */ + NE2K_RTL8019AS_PNP = 7, /* 16-bit ISA PnP Realtek 8019AS */ NE2K_DE220P = 8, /* 16-bit ISA PnP D-Link DE-220P */ NE2K_RTL8029AS = 9, /* 32-bit PCI Realtek 8029AS */ /* Check nic_init() if adding items after this point. */ diff --git a/src/include/86box/network.h b/src/include/86box/network.h index fa6408790..2140d62dd 100644 --- a/src/include/86box/network.h +++ b/src/include/86box/network.h @@ -213,7 +213,7 @@ extern const device_t ne2000_device; extern const device_t ne2000_compat_device; extern const device_t ne2000_compat_8bit_device; extern const device_t ethernext_mc_device; -extern const device_t rtl8019as_device; +extern const device_t rtl8019as_pnp_device; extern const device_t de220p_device; extern const device_t rtl8029as_device; diff --git a/src/network/net_ne2000.c b/src/network/net_ne2000.c index 97c2b5de2..2f6c60d51 100644 --- a/src/network/net_ne2000.c +++ b/src/network/net_ne2000.c @@ -312,7 +312,7 @@ asic_write(nic_t *dev, uint32_t off, uint32_t val, unsigned len) static uint32_t page3_read(nic_t *dev, uint32_t off, UNUSED(unsigned int len)) { - if (dev->board >= NE2K_RTL8019AS) + if (dev->board >= NE2K_RTL8019AS_PNP) switch (off) { case 0x1: /* 9346CR */ return (dev->_9346cr); @@ -327,7 +327,7 @@ page3_read(nic_t *dev, uint32_t off, UNUSED(unsigned int len)) return (dev->config3 & 0x46); case 0x8: /* CSNSAV */ - return ((dev->board == NE2K_RTL8019AS) ? dev->pnp_csnsav : 0x00); + return ((dev->board == NE2K_RTL8019AS_PNP) ? dev->pnp_csnsav : 0x00); case 0xe: /* 8029ASID0 */ if (dev->board == NE2K_RTL8029AS) @@ -350,7 +350,7 @@ page3_read(nic_t *dev, uint32_t off, UNUSED(unsigned int len)) static void page3_write(nic_t *dev, uint32_t off, uint32_t val, UNUSED(unsigned len)) { - if (dev->board >= NE2K_RTL8019AS) { + if (dev->board >= NE2K_RTL8019AS_PNP) { nelog(3, "%s: Page2 write to register 0x%02x, len=%u, value=0x%04x\n", dev->name, off, len, val); @@ -919,7 +919,7 @@ nic_init(const device_t *info) dev->name = info->name; dev->board = info->local; - if (dev->board >= NE2K_RTL8019AS) { + if (dev->board >= NE2K_RTL8019AS_PNP) { dev->base_address = 0x340; dev->base_irq = 12; if (dev->board == NE2K_RTL8029AS) { @@ -1042,18 +1042,18 @@ nic_init(const device_t *info) dp8390_mem_alloc(dev->dp8390, 0x4000, 0x8000); break; - case NE2K_RTL8019AS: + case NE2K_RTL8019AS_PNP: case NE2K_RTL8029AS: dev->is_pci = (dev->board == NE2K_RTL8029AS) ? 1 : 0; dev->maclocal[0] = 0x00; /* 00:E0:4C (Realtek OID) */ dev->maclocal[1] = 0xE0; dev->maclocal[2] = 0x4C; - rom = (dev->board == NE2K_RTL8019AS) ? ROM_PATH_RTL8019 : ROM_PATH_RTL8029; + rom = (dev->board == NE2K_RTL8019AS_PNP) ? ROM_PATH_RTL8019 : ROM_PATH_RTL8029; if (dev->is_pci) dp8390_set_defaults(dev->dp8390, DP8390_FLAG_EVEN_MAC); else dp8390_set_defaults(dev->dp8390, DP8390_FLAG_EVEN_MAC | DP8390_FLAG_CLEAR_IRQ); - dp8390_set_id(dev->dp8390, 0x50, (dev->board == NE2K_RTL8019AS) ? 0x70 : 0x43); + dp8390_set_id(dev->dp8390, 0x50, (dev->board == NE2K_RTL8019AS_PNP) ? 0x70 : 0x43); dp8390_mem_alloc(dev->dp8390, 0x4000, 0x8000); break; @@ -1090,13 +1090,13 @@ nic_init(const device_t *info) * Make this device known to the I/O system. * PnP and PCI devices start with address spaces inactive. */ - if ((dev->board < NE2K_RTL8019AS) && (dev->board != NE2K_ETHERNEXT_MC)) + if ((dev->board < NE2K_RTL8019AS_PNP) && (dev->board != NE2K_ETHERNEXT_MC)) nic_ioset(dev, dev->base_address); /* Set up our BIOS ROM space, if any. */ nic_rom_init(dev, rom); - if (dev->board >= NE2K_RTL8019AS) { + if (dev->board >= NE2K_RTL8019AS_PNP) { if (dev->is_pci) { /* * Configure the PCI space registers. @@ -1144,7 +1144,7 @@ nic_init(const device_t *info) pci_add_card(PCI_ADD_NORMAL, nic_pci_read, nic_pci_write, dev, &dev->pci_slot); } - /* Initialize the RTL8029 EEPROM. */ + /* Initialize the RTL80x9 EEPROM. */ memset(dev->eeprom, 0x00, sizeof(dev->eeprom)); if (dev->board == NE2K_RTL8029AS) { @@ -1158,7 +1158,7 @@ nic_init(const device_t *info) const char *pnp_rom_file = NULL; int pnp_rom_len = 0x4a; switch (dev->board) { - case NE2K_RTL8019AS: + case NE2K_RTL8019AS_PNP: pnp_rom_file = "roms/network/rtl8019as/RTL8019A.BIN"; break; @@ -1182,7 +1182,7 @@ nic_init(const device_t *info) } switch (info->local) { - case NE2K_RTL8019AS: + case NE2K_RTL8019AS_PNP: case NE2K_DE220P: dev->pnp_card = isapnp_add_card(pnp_rom, pnp_rom_len, nic_pnp_config_changed, nic_pnp_csn_changed, @@ -1706,11 +1706,11 @@ const device_t ethernext_mc_device = { .config = mca_mac_config }; -const device_t rtl8019as_device = { +const device_t rtl8019as_pnp_device = { .name = "Realtek RTL8019AS", .internal_name = "ne2kpnp", .flags = DEVICE_ISA | DEVICE_AT, - .local = NE2K_RTL8019AS, + .local = NE2K_RTL8019AS_PNP, .init = nic_init, .close = nic_close, .reset = NULL, diff --git a/src/network/network.c b/src/network/network.c index f4b03ee79..66990e51d 100644 --- a/src/network/network.c +++ b/src/network/network.c @@ -96,7 +96,7 @@ static const NETWORK_CARD net_cards[] = { { &ne1000_device }, { &ne2000_device }, { &pcnet_am79c960_eb_device }, - { &rtl8019as_device }, + { &rtl8019as_pnp_device }, { &wd8003e_device }, { &wd8003eb_device }, { &wd8013ebt_device }, From cca1b2b293faaa42b5935db818b71333e1394b7f Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 2 Feb 2025 04:49:32 -0500 Subject: [PATCH 3/4] Trivial EMS cleanups and a few comments --- src/device/isamem.c | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/src/device/isamem.c b/src/device/isamem.c index d248e985e..5cac31c7f 100644 --- a/src/device/isamem.c +++ b/src/device/isamem.c @@ -27,16 +27,20 @@ * modern boards even have multiple 'copies' of those registers, * which can be switched very fast, to allow for multitasking. * - * TODO: The EV159 is supposed to support 16b EMS transfers, but the + * TODO: The EV-159 is supposed to support 16b EMS transfers, but the * EMM.sys driver for it doesn't seem to want to do that.. * + * EV-125 (It supports backfill) + * https://theretroweb.com/expansioncard/documentation/50250.pdf * + * EV-158 (RAM 10000) + * http://web.archive.org/web/19961104093221/http://www.everex.com/supp/techlib/memmem.html * * Authors: Fred N. van Kempen, * Jasmine Iwanek * * Copyright 2018 Fred N. van Kempen. - * Copyright 2022-2024 Jasmine Iwanek. + * Copyright 2022-2025 Jasmine Iwanek. * * Redistribution and use in source and binary forms, with * or without modification, are permitted provided that the @@ -304,16 +308,13 @@ ems_writew(uint32_t addr, uint16_t val, void *priv) static uint8_t ems_in(uint16_t port, void *priv) { - const emsreg_t *dev = (emsreg_t *) priv; - uint8_t ret = 0xff; -#ifdef ENABLE_ISAMEM_LOG - int vpage; -#endif - + const emsreg_t *dev = (emsreg_t *) priv; + uint8_t ret = 0xff; /* Get the viewport page number. */ #ifdef ENABLE_ISAMEM_LOG - vpage = (port / EMS_PGSIZE); + int vpage = (port / EMS_PGSIZE); #endif + port &= (EMS_PGSIZE - 1); switch (port & 0x0001) { @@ -339,13 +340,11 @@ ems_in(uint16_t port, void *priv) static uint8_t consecutive_ems_in(uint16_t port, void *priv) { - const memdev_t *dev = (memdev_t *) priv; - uint8_t ret = 0xff; - int vpage; - + const memdev_t *dev = (memdev_t *) priv; + uint8_t ret = 0xff; /* Get the viewport page number. */ - vpage = (port - dev->base_addr[0]); - + int vpage = (port - dev->base_addr[0]); + ret = dev->ems[vpage].page; if (dev->ems[vpage].enabled) ret |= 0x80; @@ -359,11 +358,10 @@ consecutive_ems_in(uint16_t port, void *priv) static void ems_out(uint16_t port, uint8_t val, void *priv) { - emsreg_t *dev = (emsreg_t *) priv; - int vpage; - + emsreg_t *dev = (emsreg_t *) priv; /* Get the viewport page number. */ - vpage = (port / EMS_PGSIZE); + int vpage = (port / EMS_PGSIZE); + port &= (EMS_PGSIZE - 1); switch (port & 0x0001) { @@ -433,11 +431,9 @@ ems_out(uint16_t port, uint8_t val, void *priv) static void consecutive_ems_out(uint16_t port, uint8_t val, void *priv) { - memdev_t *dev = (memdev_t *) priv; - int vpage; - + memdev_t *dev = (memdev_t *) priv; /* Get the viewport page number. */ - vpage = (port - dev->base_addr[0]); + int vpage = (port - dev->base_addr[0]); isamem_log("ISAMEM: write(%04x, %02x) to page mapping registers! (page=%d)\n", port, val, vpage); @@ -1030,6 +1026,7 @@ static const device_config_t genericxt_config[] = { // clang-format on }; +// This also nicely accounts for the Everex EV-138 static const device_t genericxt_device = { .name = "Generic PC/XT Memory Expansion", .internal_name = "genericxt", @@ -1236,6 +1233,7 @@ static const device_config_t genericat_config[] = { // clang-format on }; +// This also nicely accounts for the Everex EV-135 static const device_t genericat_device = { .name = "Generic PC/AT Memory Expansion", .internal_name = "genericat", From 4b5162feddc25136eabfdadf2ecc58a10f643694 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 2 Feb 2025 05:01:42 -0500 Subject: [PATCH 4/4] Fix for building on msys2 clang found by ANightly --- src/qt/win_cdrom_ioctl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qt/win_cdrom_ioctl.c b/src/qt/win_cdrom_ioctl.c index 271f7226f..38c553852 100644 --- a/src/qt/win_cdrom_ioctl.c +++ b/src/qt/win_cdrom_ioctl.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include <86box/cdrom.h> #include <86box/log.h>