From 2590c4ab960ef8bf671c6ccd8a300fb3ec77c7a7 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Wed, 4 Oct 2023 21:12:50 -0400 Subject: [PATCH 01/10] Clean up mo.h a bit --- src/include/86box/mo.h | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/include/86box/mo.h b/src/include/86box/mo.h index 910c7eaed..8071b80b5 100644 --- a/src/include/86box/mo.h +++ b/src/include/86box/mo.h @@ -37,17 +37,17 @@ typedef struct mo_type_t { #define KNOWN_MO_TYPES 10 static const mo_type_t mo_types[KNOWN_MO_TYPES] = { // 3.5" standard M.O. disks - {248826, 512 }, - { 446325, 512 }, - { 1041500, 512 }, - { 310352, 2048}, - { 605846, 2048}, - { 1063146, 2048}, + { 248826, 512 }, + { 446325, 512 }, + { 1041500, 512 }, + { 310352, 2048 }, + { 605846, 2048 }, + { 1063146, 2048 }, // 5.25" M.O. disks - { 573624, 512 }, - { 314568, 1024}, - { 904995, 512 }, - { 637041, 1024}, + { 573624, 512 }, + { 314568, 1024 }, + { 904995, 512 }, + { 637041, 1024 }, }; typedef struct mo_drive_type_t { @@ -60,7 +60,7 @@ typedef struct mo_drive_type_t { #define KNOWN_MO_DRIVE_TYPES 22 static const mo_drive_type_t mo_drive_types[KNOWN_MO_DRIVE_TYPES] = { {"86BOX", "MAGNETO OPTICAL", "1.00", { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }}, - { "FUJITSU", "M2512A", "1314", { 1, 1, 0, 0, 0, 0, 0, 0, 0 } }, + { "FUJITSU", "M2512A", "1314", { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 }}, { "FUJITSU", "M2513-MCC3064SS", "1.00", { 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 }}, { "FUJITSU", "MCE3130SS", "0070", { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }}, { "FUJITSU", "MCF3064SS", "0030", { 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 }}, @@ -165,8 +165,10 @@ typedef struct mo_t { extern mo_t *mo[MO_NUM]; extern mo_drive_t mo_drives[MO_NUM]; +#if 0 extern uint8_t atapi_mo_drives[8]; extern uint8_t scsi_mo_drives[16]; +#endif #define mo_sense_error dev->sense[0] #define mo_sense_key dev->sense[2] From 2c14630e7e110cad29d2dd23df606726c8818e79 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Thu, 5 Oct 2023 08:46:32 -0400 Subject: [PATCH 02/10] Fix offset of mitsumi cd info --- src/cdrom/cdrom_mitsumi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cdrom/cdrom_mitsumi.c b/src/cdrom/cdrom_mitsumi.c index 19e19a420..cfd3cd84b 100644 --- a/src/cdrom/cdrom_mitsumi.c +++ b/src/cdrom/cdrom_mitsumi.c @@ -394,9 +394,9 @@ mitsumi_cdrom_out(uint16_t port, uint8_t val, void *priv) } break; case CMD_GET_VER: - dev->cmdbuf[1] = 1; - dev->cmdbuf[2] = 'D'; - dev->cmdbuf[3] = 0; + dev->cmdbuf[0] = 1; + dev->cmdbuf[1] = 'D'; + dev->cmdbuf[2] = 0; dev->cmdbuf_count = 4; break; case CMD_EJECT: From 859c7b781b009464254b64a15757c33b83a03605 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Thu, 5 Oct 2023 11:35:22 -0400 Subject: [PATCH 03/10] Correct comments in hdc_ide.c --- src/disk/hdc_ide.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index 61b8728e1..0abd4df89 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -141,12 +141,12 @@ static uint8_t ide_ter_pnp_rom[] = { 0x1c, 0x41, 0xd0, 0x06, 0x00, /* compatible device PNP0600 */ 0x31, 0x00, /* start dependent functions, preferred */ 0x22, 0x00, 0x08, /* IRQ 11 */ - 0x47, 0x01, 0xe8, 0x01, 0xe8, 0x01, 0x01, 0x08, /* I/O 0x168, decodes 16-bit, 1-byte alignment, 8 addresses */ - 0x47, 0x01, 0xee, 0x03, 0xee, 0x03, 0x01, 0x01, /* I/O 0x36E, decodes 16-bit, 1-byte alignment, 1 address */ + 0x47, 0x01, 0xe8, 0x01, 0xe8, 0x01, 0x01, 0x08, /* I/O 0x1E8, decodes 16-bit, 1-byte alignment, 8 addresses */ + 0x47, 0x01, 0xee, 0x03, 0xee, 0x03, 0x01, 0x01, /* I/O 0x3EE, decodes 16-bit, 1-byte alignment, 1 address */ 0x30, /* start dependent functions, acceptable */ 0x22, 0xb8, 0x1e, /* IRQ 3/4/5/7/9/10/11/12 */ - 0x47, 0x01, 0xe8, 0x01, 0xe8, 0x01, 0x01, 0x08, /* I/O 0x168, decodes 16-bit, 1-byte alignment, 8 addresses */ - 0x47, 0x01, 0xee, 0x03, 0xee, 0x03, 0x01, 0x01, /* I/O 0x36E, decodes 16-bit, 1-byte alignment, 1 address */ + 0x47, 0x01, 0xe8, 0x01, 0xe8, 0x01, 0x01, 0x08, /* I/O 0x1E8, decodes 16-bit, 1-byte alignment, 8 addresses */ + 0x47, 0x01, 0xee, 0x03, 0xee, 0x03, 0x01, 0x01, /* I/O 0x3EE, decodes 16-bit, 1-byte alignment, 1 address */ 0x30, /* start dependent functions, acceptable */ 0x22, 0xb8, 0x1e, /* IRQ 3/4/5/7/9/10/11/12 */ 0x47, 0x01, 0x00, 0x01, 0xf8, 0xff, 0x08, 0x08, /* I/O 0x100-0xFFF8, decodes 16-bit, 8-byte alignment, 8 addresses */ @@ -164,12 +164,12 @@ static uint8_t ide_qua_pnp_rom[] = { 0x1c, 0x41, 0xd0, 0x06, 0x00, /* compatible device PNP0600 */ 0x31, 0x00, /* start dependent functions, preferred */ 0x22, 0x00, 0x04, /* IRQ 10 */ - 0x47, 0x01, 0x68, 0x01, 0x68, 0x01, 0x01, 0x08, /* I/O 0x1E8, decodes 16-bit, 1-byte alignment, 8 addresses */ - 0x47, 0x01, 0x6e, 0x03, 0x6e, 0x03, 0x01, 0x01, /* I/O 0x3EE, decodes 16-bit, 1-byte alignment, 1 address */ + 0x47, 0x01, 0x68, 0x01, 0x68, 0x01, 0x01, 0x08, /* I/O 0x168, decodes 16-bit, 1-byte alignment, 8 addresses */ + 0x47, 0x01, 0x6e, 0x03, 0x6e, 0x03, 0x01, 0x01, /* I/O 0x36E, decodes 16-bit, 1-byte alignment, 1 address */ 0x30, /* start dependent functions, acceptable */ 0x22, 0xb8, 0x1e, /* IRQ 3/4/5/7/9/10/11/12 */ - 0x47, 0x01, 0x68, 0x01, 0x68, 0x01, 0x01, 0x08, /* I/O 0x1E8, decodes 16-bit, 1-byte alignment, 8 addresses */ - 0x47, 0x01, 0x6e, 0x03, 0x6e, 0x03, 0x01, 0x01, /* I/O 0x3EE, decodes 16-bit, 1-byte alignment, 1 address */ + 0x47, 0x01, 0x68, 0x01, 0x68, 0x01, 0x01, 0x08, /* I/O 0x168, decodes 16-bit, 1-byte alignment, 8 addresses */ + 0x47, 0x01, 0x6e, 0x03, 0x6e, 0x03, 0x01, 0x01, /* I/O 0x36E, decodes 16-bit, 1-byte alignment, 1 address */ 0x30, /* start dependent functions, acceptable */ 0x22, 0xb8, 0x1e, /* IRQ 3/4/5/7/9/10/11/12 */ 0x47, 0x01, 0x00, 0x01, 0xf8, 0xff, 0x08, 0x08, /* I/O 0x100-0xFFF8, decodes 16-bit, 8-byte alignment, 8 addresses */ From 032ce8ccf72d203c89d8f3e4adcf38b8305bcd7b Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Thu, 5 Oct 2023 11:46:25 -0400 Subject: [PATCH 04/10] Correct small oversight --- src/cdrom/cdrom_mitsumi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cdrom/cdrom_mitsumi.c b/src/cdrom/cdrom_mitsumi.c index cfd3cd84b..f1b292f42 100644 --- a/src/cdrom/cdrom_mitsumi.c +++ b/src/cdrom/cdrom_mitsumi.c @@ -397,7 +397,7 @@ mitsumi_cdrom_out(uint16_t port, uint8_t val, void *priv) dev->cmdbuf[0] = 1; dev->cmdbuf[1] = 'D'; dev->cmdbuf[2] = 0; - dev->cmdbuf_count = 4; + dev->cmdbuf_count = 3; break; case CMD_EJECT: cdrom_stop(&cdrom); From b7ae66b3931c5646789a21fa2fb9607c8f2921ee Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Thu, 5 Oct 2023 13:00:37 -0400 Subject: [PATCH 05/10] Avoid more magic numbers --- src/cdrom/cdrom_mitsumi.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/cdrom/cdrom_mitsumi.c b/src/cdrom/cdrom_mitsumi.c index f1b292f42..d270ab0f3 100644 --- a/src/cdrom/cdrom_mitsumi.c +++ b/src/cdrom/cdrom_mitsumi.c @@ -33,6 +33,10 @@ #include <86box/plat.h> #include <86box/sound.h> +#define MCD_DEFAULT_IOPORT 0x310 +#define MCD_DEFAULT_IRQ 5 +#define MCD_DEFAULT_DMA 5 + #define RAW_SECTOR_SIZE 2352 #define COOKED_SECTOR_SIZE 2048 @@ -244,6 +248,8 @@ mitsumi_cdrom_in(uint16_t port, void *priv) ret |= FLAG_NOSTAT; pclog("Read port 1: ret = %02x\n", ret | FLAG_UNK); return ret | FLAG_UNK; + case 2: + break; default: break; } @@ -419,6 +425,8 @@ mitsumi_cdrom_out(uint16_t port, uint8_t val, void *priv) case 1: mitsumi_cdrom_reset(dev); break; + case 2: + break; default: break; } @@ -432,10 +440,10 @@ mitsumi_cdrom_init(UNUSED(const device_t *info)) dev = malloc(sizeof(mcd_t)); memset(dev, 0x00, sizeof(mcd_t)); - dev->irq = 5; - dev->dma = 5; + dev->irq = MCD_DEFAULT_IRQ; + dev->dma = MCD_DEFAULT_DMA; - io_sethandler(0x310, 2, + io_sethandler(MCD_DEFAULT_IOPORT, 3, mitsumi_cdrom_in, NULL, NULL, mitsumi_cdrom_out, NULL, NULL, dev); mitsumi_cdrom_reset(dev); From b0cb094590de6f8f7a2efdcdd252f35f09a626d3 Mon Sep 17 00:00:00 2001 From: richardg867 Date: Thu, 5 Oct 2023 14:04:05 -0300 Subject: [PATCH 06/10] gdbstub: Small fixes to breakpoints and watches --- src/gdbstub.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gdbstub.c b/src/gdbstub.c index d2bb5364b..d41f4bbc5 100644 --- a/src/gdbstub.c +++ b/src/gdbstub.c @@ -1348,7 +1348,7 @@ unknown: /* Flag this watchpoint's corresponding pages as having a watchpoint. */ k = (breakpoint->end - 1) >> MEM_GRANULARITY_BITS; for (i = breakpoint->addr >> MEM_GRANULARITY_BITS; i <= k; i++) - gdbstub_watch_pages[i >> 6] |= (1 << (i & 63)); + gdbstub_watch_pages[i >> 6] |= (1ULL << (i & 63)); breakpoint = breakpoint->next; } else { @@ -1752,8 +1752,10 @@ gdbstub_mem_access(uint32_t *addrs, int access) if (watchpoint) { /* Check if any component of this address is within the breakpoint's range. */ for (i = 0; i < width; i++) { - if ((addrs[i] >= watchpoint->addr) && (addrs[i] < watchpoint->end)) + if ((addrs[i] >= watchpoint->addr) && (addrs[i] < watchpoint->end)) { + watch_addr = addrs[i]; break; + } } if (i < width) { gdbstub_log("GDB Stub: %s watchpoint at %08X\n", (access & GDBSTUB_MEM_AWATCH) ? "Access" : ((access & GDBSTUB_MEM_WRITE) ? "Write" : "Read"), watch_addr); From 78440c11ae83902976071e2943c9bf5212d52a4c Mon Sep 17 00:00:00 2001 From: richardg867 Date: Thu, 5 Oct 2023 14:08:09 -0300 Subject: [PATCH 07/10] gdbstub: More watchpoint fixes --- src/include/86box/gdbstub.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/include/86box/gdbstub.h b/src/include/86box/gdbstub.h index 5d55615b3..c58a58bf5 100644 --- a/src/include/86box/gdbstub.h +++ b/src/include/86box/gdbstub.h @@ -36,19 +36,19 @@ enum { #ifdef USE_GDBSTUB -# define GDBSTUB_MEM_ACCESS(addr, access, width) \ - uint32_t gdbstub_page = addr >> MEM_GRANULARITY_BITS; \ - if (gdbstub_watch_pages[gdbstub_page >> 6] & (1 << (gdbstub_page & 63))) { \ - uint32_t gdbstub_addrs[width]; \ - for (int gdbstub_i = 0; gdbstub_i < width; gdbstub_i++) \ - gdbstub_addrs[gdbstub_i] = addr + gdbstub_i; \ - gdbstub_mem_access(gdbstub_addrs, access | width); \ +# define GDBSTUB_MEM_ACCESS(addr, access, width) \ + uint32_t gdbstub_page = (addr) >> MEM_GRANULARITY_BITS; \ + if (gdbstub_watch_pages[gdbstub_page >> 6] & (1ULL << (gdbstub_page & 63))) { \ + uint32_t gdbstub_addrs[(width)]; \ + for (int gdbstub_i = 0; gdbstub_i < (width); gdbstub_i++) \ + gdbstub_addrs[gdbstub_i] = (addr) + gdbstub_i; \ + gdbstub_mem_access(gdbstub_addrs, (access) | (width)); \ } -# define GDBSTUB_MEM_ACCESS_FAST(addrs, access, width) \ - uint32_t gdbstub_page = addr >> MEM_GRANULARITY_BITS; \ - if (gdbstub_watch_pages[gdbstub_page >> 6] & (1 << (gdbstub_page & 63))) \ - gdbstub_mem_access(addrs, access | width); +# define GDBSTUB_MEM_ACCESS_FAST(addrs, access, width) \ + uint32_t gdbstub_page = (addrs)[0] >> MEM_GRANULARITY_BITS; \ + if (gdbstub_watch_pages[gdbstub_page >> 6] & (1ULL << (gdbstub_page & 63))) \ + gdbstub_mem_access((addrs), (access) | (width)); extern int gdbstub_step, gdbstub_next_asap; extern uint64_t gdbstub_watch_pages[(((uint32_t) -1) >> (MEM_GRANULARITY_BITS + 6)) + 1]; From e840a8337f872978855211e81a3d469cbc6adc02 Mon Sep 17 00:00:00 2001 From: richardg867 Date: Thu, 5 Oct 2023 14:10:46 -0300 Subject: [PATCH 08/10] pci: Fix macro expansion mistake with MIRQs --- src/include/86box/pci.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/86box/pci.h b/src/include/86box/pci.h index 6ea53c51d..c5ddfe4df 100644 --- a/src/include/86box/pci.h +++ b/src/include/86box/pci.h @@ -146,11 +146,11 @@ pci_register_bus_slot(0, card, type, inta, intb, intc, intd) #define pci_set_mirq(mirq, level, irq_state) \ - pci_irq(PCI_MIRQ_BASE | mirq, 0, level, 1, irq_state) + pci_irq(PCI_MIRQ_BASE | (mirq), 0, level, 1, irq_state) #define pci_set_irq(slot, pci_int, irq_state) \ pci_irq(slot, pci_int, 0, 1, irq_state) #define pci_clear_mirq(mirq, level, irq_state) \ - pci_irq(PCI_MIRQ_BASE | mirq, 0, level, 0, irq_state) + pci_irq(PCI_MIRQ_BASE | (mirq), 0, level, 0, irq_state) #define pci_clear_irq(slot, pci_int, irq_state) \ pci_irq(slot, pci_int, 0, 0, irq_state) From 346d99f9b30bab3c2827e4c8b99d7310f88e0506 Mon Sep 17 00:00:00 2001 From: Alexander Babikov <2708460+lemondrops@users.noreply.github.com> Date: Fri, 6 Oct 2023 01:18:16 +0500 Subject: [PATCH 09/10] qt: Add a warning when cpu_override is enabled --- src/qt/qt_main.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/qt/qt_main.cpp b/src/qt/qt_main.cpp index 04fb01ffb..e3eeb3fc4 100644 --- a/src/qt/qt_main.cpp +++ b/src/qt/qt_main.cpp @@ -28,6 +28,8 @@ #include #include #include +#include +#include #ifdef QT_STATIC /* Static builds need plugin imports */ @@ -274,6 +276,21 @@ main(int argc, char *argv[]) main_window->installEventFilter(&socket); socket.connectToServer(qgetenv("86BOX_MANAGER_SOCKET")); } + + /* Warn the user about unsupported configs */ + if (cpu_override) { + QMessageBox warningbox(QMessageBox::Icon::Warning, QObject::tr("You are loading an unsupported configuration"), + QObject::tr("CPU type filtering based on selected machine is disabled for this emulated machine.\n\nThis makes it possible to choose a CPU that is otherwise incompatible with the selected machine. However, you may run into incompatibilities with the machine BIOS or other software.\n\nEnabling this setting is not officially supported and any bug reports filed may be closed as invalid."), + QMessageBox::NoButton, main_window); + warningbox.addButton(QObject::tr("Continue"), QMessageBox::AcceptRole); + warningbox.addButton(QObject::tr("Exit"), QMessageBox::RejectRole); + warningbox.exec(); + if (warningbox.result() == QDialog::Accepted) { + confirm_exit_cmdl = 0; /* skip the confirmation prompt without touching the config */ + emit main_window->close(); + } + } + // pc_reset_hard_init(); /* Set the PAUSE mode depending on the renderer. */ From f72585e9f9ad04d630126cae403a5fd3187e60f5 Mon Sep 17 00:00:00 2001 From: Alexander Babikov <2708460+lemondrops@users.noreply.github.com> Date: Wed, 5 Oct 2022 11:42:00 +0500 Subject: [PATCH 10/10] Make cpu_override also ignore CPU dynarec requirement --- src/qt/qt_settingsmachine.cpp | 2 +- src/win/win_settings.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/qt_settingsmachine.cpp b/src/qt/qt_settingsmachine.cpp index 6b021b288..475730db9 100644 --- a/src/qt/qt_settingsmachine.cpp +++ b/src/qt/qt_settingsmachine.cpp @@ -278,7 +278,7 @@ SettingsMachine::on_comboBoxSpeed_currentIndexChanged(int index) if (!(flags & CPU_SUPPORTS_DYNAREC)) { ui->checkBoxDynamicRecompiler->setChecked(false); ui->checkBoxDynamicRecompiler->setEnabled(false); - } else if (flags & CPU_REQUIRES_DYNAREC) { + } else if ((flags & CPU_REQUIRES_DYNAREC) && !cpu_override) { ui->checkBoxDynamicRecompiler->setChecked(true); ui->checkBoxDynamicRecompiler->setEnabled(false); } else { diff --git a/src/win/win_settings.c b/src/win/win_settings.c index adeefd8b4..bd539a1a8 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -748,7 +748,7 @@ win_settings_machine_recalc_cpu(HWND hdlg) cpu_flags = temp_cpu_f->cpus[temp_cpu].cpu_flags; if (!(cpu_flags & CPU_SUPPORTS_DYNAREC) && (cpu_flags & CPU_REQUIRES_DYNAREC)) fatal("Attempting to select a CPU that requires the recompiler and does not support it at the same time\n"); - if (!(cpu_flags & CPU_SUPPORTS_DYNAREC) || (cpu_flags & CPU_REQUIRES_DYNAREC)) { + if (!(cpu_flags & CPU_SUPPORTS_DYNAREC) || ((cpu_flags & CPU_REQUIRES_DYNAREC) && !cpu_override))) { if (!(cpu_flags & CPU_SUPPORTS_DYNAREC)) temp_dynarec = 0; if (cpu_flags & CPU_REQUIRES_DYNAREC)