From 5a189d49c3061789cba98357c847d610e604cf8e Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 28 Jan 2026 09:14:05 +0100 Subject: [PATCH] 808x and Vx0: Fix the remaining multiple definitions. --- src/cpu/cpu.h | 1 + src/cpu/vx0.c | 10 ---------- src/cpu/vx0_biu.c | 26 ++++++++++++------------- src/cpu/x87_ops.h | 32 +++++++++++++++---------------- src/dma.c | 4 ++-- src/include/86box/86box.h | 3 +++ src/video/vid_cga_compaq_plasma.c | 6 +++++- src/video/vid_cga_ncr.c | 6 +++++- src/video/vid_cga_olivetti.c | 6 +++++- 9 files changed, 50 insertions(+), 44 deletions(-) diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 8e74bc78a..92d60f708 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -729,6 +729,7 @@ extern int idivl(int32_t val); extern void resetmcr(void); extern void resetx86(void); extern void refreshread(void); +extern void refreshread_vx0(void); extern void resetreadlookup(void); extern void softresetx86(void); extern void hardresetx86(void); diff --git a/src/cpu/vx0.c b/src/cpu/vx0.c index bd1a8da20..94a5fc56f 100644 --- a/src/cpu/vx0.c +++ b/src/cpu/vx0.c @@ -222,10 +222,6 @@ const uint8_t opf_0f[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* F0 */ 0, 0, 0, 0, 0, 0, 0, 0 }; /* F8 */ -uint8_t use_custom_nmi_vector = 0; - -uint32_t custom_nmi_vector = 0x00000000; - /* Is the CPU 8088 or 8086. */ int is8086 = 0; int nx = 0; @@ -422,12 +418,6 @@ sync_to_i8080(void) emulated_processor.interrupt_delay = noint; } -uint16_t -get_last_addr(void) -{ - return last_addr; -} - static void set_ip(uint16_t new_ip) { diff --git a/src/cpu/vx0_biu.c b/src/cpu/vx0_biu.c index b52b14245..aba09d359 100644 --- a/src/cpu/vx0_biu.c +++ b/src/cpu/vx0_biu.c @@ -287,6 +287,15 @@ bus_inw(uint16_t port) return ret; } +void +resub_cycles_vx0(int old_cycles) +{ + if (old_cycles > cycles) + wait_states = old_cycles - cycles; + + cycles = old_cycles; +} + static void bus_do_io(int io_type) { @@ -310,7 +319,7 @@ bus_do_io(int io_type) AL = bus_inb((uint16_t) cpu_state.eaaddr); } - resub_cycles(old_cycles); + resub_cycles_vx0(old_cycles); } static void @@ -370,7 +379,7 @@ bus_do_mem(int io_type) mem_data = (mem_data & 0xff00) | ((uint16_t) bus_readb(mem_seg, (uint32_t) mem_addr)); } - resub_cycles(old_cycles); + resub_cycles_vx0(old_cycles); } static void @@ -510,15 +519,6 @@ do_bus_access(void) } } -void -resub_cycles(int old_cycles) -{ - if (old_cycles > cycles) - wait_states = old_cycles - cycles; - - cycles = old_cycles; -} - static uint8_t biu_queue_has_room(void) { @@ -715,7 +715,7 @@ wait(int c) /* This is for external subtraction of cycles, ie. wait states. */ void -sub_cycles(int c) +sub_cycles_vx0(int c) { cycles -= c; } @@ -1143,7 +1143,7 @@ biu_suspend_fetch(void) /* Memory refresh read - called by reads and writes on DMA channel 0. */ void -refreshread(void) +refreshread_vx0(void) { if (dma_state == DMA_STATE_IDLE) { dma_state = DMA_STATE_TIMER; diff --git a/src/cpu/x87_ops.h b/src/cpu/x87_ops.h index f74e5e91a..49b5c2378 100644 --- a/src/cpu/x87_ops.h +++ b/src/cpu/x87_ops.h @@ -581,7 +581,7 @@ FPU_ILLEGAL_a32(uint32_t fetchdat) #define ILLEGAL_a16 FPU_ILLEGAL_a16 #ifdef FPU_8087 -const OpFn OP_TABLE(sf_fpu_8087_d8)[32] = { +static const OpFn OP_TABLE(sf_fpu_8087_d8)[32] = { // clang-format off sf_FADDs_a16, sf_FMULs_a16, sf_FCOMs_a16, sf_FCOMPs_a16, sf_FSUBs_a16, sf_FSUBRs_a16, sf_FDIVs_a16, sf_FDIVRs_a16, sf_FADDs_a16, sf_FMULs_a16, sf_FCOMs_a16, sf_FCOMPs_a16, sf_FSUBs_a16, sf_FSUBRs_a16, sf_FDIVs_a16, sf_FDIVRs_a16, @@ -590,7 +590,7 @@ const OpFn OP_TABLE(sf_fpu_8087_d8)[32] = { // clang-format on }; -const OpFn OP_TABLE(sf_fpu_8087_d9)[256] = { +static const OpFn OP_TABLE(sf_fpu_8087_d9)[256] = { // clang-format off sf_FLDs_a16, sf_FLDs_a16, sf_FLDs_a16, sf_FLDs_a16, sf_FLDs_a16, sf_FLDs_a16, sf_FLDs_a16, sf_FLDs_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, @@ -630,7 +630,7 @@ const OpFn OP_TABLE(sf_fpu_8087_d9)[256] = { // clang-format on }; -const OpFn OP_TABLE(sf_fpu_8087_da)[256] = { +static const OpFn OP_TABLE(sf_fpu_8087_da)[256] = { // clang-format off sf_FADDil_a16, sf_FADDil_a16, sf_FADDil_a16, sf_FADDil_a16, sf_FADDil_a16, sf_FADDil_a16, sf_FADDil_a16, sf_FADDil_a16, sf_FMULil_a16, sf_FMULil_a16, sf_FMULil_a16, sf_FMULil_a16, sf_FMULil_a16, sf_FMULil_a16, sf_FMULil_a16, sf_FMULil_a16, @@ -670,7 +670,7 @@ const OpFn OP_TABLE(sf_fpu_8087_da)[256] = { // clang-format on }; -const OpFn OP_TABLE(sf_fpu_8087_db)[256] = { +static const OpFn OP_TABLE(sf_fpu_8087_db)[256] = { // clang-format off sf_FILDil_a16, sf_FILDil_a16, sf_FILDil_a16, sf_FILDil_a16, sf_FILDil_a16, sf_FILDil_a16, sf_FILDil_a16, sf_FILDil_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, @@ -710,7 +710,7 @@ const OpFn OP_TABLE(sf_fpu_8087_db)[256] = { // clang-format on }; -const OpFn OP_TABLE(sf_fpu_8087_dc)[32] = { +static const OpFn OP_TABLE(sf_fpu_8087_dc)[32] = { // clang-format off sf_FADDd_a16, sf_FMULd_a16, sf_FCOMd_a16, sf_FCOMPd_a16, sf_FSUBd_a16, sf_FSUBRd_a16, sf_FDIVd_a16, sf_FDIVRd_a16, sf_FADDd_a16, sf_FMULd_a16, sf_FCOMd_a16, sf_FCOMPd_a16, sf_FSUBd_a16, sf_FSUBRd_a16, sf_FDIVd_a16, sf_FDIVRd_a16, @@ -719,7 +719,7 @@ const OpFn OP_TABLE(sf_fpu_8087_dc)[32] = { // clang-format on }; -const OpFn OP_TABLE(sf_fpu_8087_dd)[256] = { +static const OpFn OP_TABLE(sf_fpu_8087_dd)[256] = { // clang-format off sf_FLDd_a16, sf_FLDd_a16, sf_FLDd_a16, sf_FLDd_a16, sf_FLDd_a16, sf_FLDd_a16, sf_FLDd_a16, sf_FLDd_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, @@ -759,7 +759,7 @@ const OpFn OP_TABLE(sf_fpu_8087_dd)[256] = { // clang-format on }; -const OpFn OP_TABLE(sf_fpu_8087_de)[256] = { +static const OpFn OP_TABLE(sf_fpu_8087_de)[256] = { // clang-format off sf_FADDiw_a16, sf_FADDiw_a16, sf_FADDiw_a16, sf_FADDiw_a16, sf_FADDiw_a16, sf_FADDiw_a16, sf_FADDiw_a16, sf_FADDiw_a16, sf_FMULiw_a16, sf_FMULiw_a16, sf_FMULiw_a16, sf_FMULiw_a16, sf_FMULiw_a16, sf_FMULiw_a16, sf_FMULiw_a16, sf_FMULiw_a16, @@ -799,7 +799,7 @@ const OpFn OP_TABLE(sf_fpu_8087_de)[256] = { // clang-format on }; -const OpFn OP_TABLE(sf_fpu_8087_df)[256] = { +static const OpFn OP_TABLE(sf_fpu_8087_df)[256] = { // clang-format off sf_FILDiw_a16, sf_FILDiw_a16, sf_FILDiw_a16, sf_FILDiw_a16, sf_FILDiw_a16, sf_FILDiw_a16, sf_FILDiw_a16, sf_FILDiw_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, @@ -839,7 +839,7 @@ const OpFn OP_TABLE(sf_fpu_8087_df)[256] = { // clang-format on }; -const OpFn OP_TABLE(fpu_8087_d8)[32] = { +static const OpFn OP_TABLE(fpu_8087_d8)[32] = { // clang-format off opFADDs_a16, opFMULs_a16, opFCOMs_a16, opFCOMPs_a16, opFSUBs_a16, opFSUBRs_a16, opFDIVs_a16, opFDIVRs_a16, opFADDs_a16, opFMULs_a16, opFCOMs_a16, opFCOMPs_a16, opFSUBs_a16, opFSUBRs_a16, opFDIVs_a16, opFDIVRs_a16, @@ -848,7 +848,7 @@ const OpFn OP_TABLE(fpu_8087_d8)[32] = { // clang-format on }; -const OpFn OP_TABLE(fpu_8087_d9)[256] = { +static const OpFn OP_TABLE(fpu_8087_d9)[256] = { // clang-format off opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, opFLDs_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, @@ -888,7 +888,7 @@ const OpFn OP_TABLE(fpu_8087_d9)[256] = { // clang-format on }; -const OpFn OP_TABLE(fpu_8087_da)[256] = { +static const OpFn OP_TABLE(fpu_8087_da)[256] = { // clang-format off opFADDil_a16, opFADDil_a16, opFADDil_a16, opFADDil_a16, opFADDil_a16, opFADDil_a16, opFADDil_a16, opFADDil_a16, opFMULil_a16, opFMULil_a16, opFMULil_a16, opFMULil_a16, opFMULil_a16, opFMULil_a16, opFMULil_a16, opFMULil_a16, @@ -928,7 +928,7 @@ const OpFn OP_TABLE(fpu_8087_da)[256] = { // clang-format on }; -const OpFn OP_TABLE(fpu_8087_db)[256] = { +static const OpFn OP_TABLE(fpu_8087_db)[256] = { // clang-format off opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, opFILDil_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, @@ -968,7 +968,7 @@ const OpFn OP_TABLE(fpu_8087_db)[256] = { // clang-format on }; -const OpFn OP_TABLE(fpu_8087_dc)[32] = { +static const OpFn OP_TABLE(fpu_8087_dc)[32] = { // clang-format off opFADDd_a16, opFMULd_a16, opFCOMd_a16, opFCOMPd_a16, opFSUBd_a16, opFSUBRd_a16, opFDIVd_a16, opFDIVRd_a16, opFADDd_a16, opFMULd_a16, opFCOMd_a16, opFCOMPd_a16, opFSUBd_a16, opFSUBRd_a16, opFDIVd_a16, opFDIVRd_a16, @@ -977,7 +977,7 @@ const OpFn OP_TABLE(fpu_8087_dc)[32] = { // clang-format on }; -const OpFn OP_TABLE(fpu_8087_dd)[256] = { +static const OpFn OP_TABLE(fpu_8087_dd)[256] = { // clang-format off opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, opFLDd_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, @@ -1017,7 +1017,7 @@ const OpFn OP_TABLE(fpu_8087_dd)[256] = { // clang-format on }; -const OpFn OP_TABLE(fpu_8087_de)[256] = { +static const OpFn OP_TABLE(fpu_8087_de)[256] = { // clang-format off opFADDiw_a16, opFADDiw_a16, opFADDiw_a16, opFADDiw_a16, opFADDiw_a16, opFADDiw_a16, opFADDiw_a16, opFADDiw_a16, opFMULiw_a16, opFMULiw_a16, opFMULiw_a16, opFMULiw_a16, opFMULiw_a16, opFMULiw_a16, opFMULiw_a16, opFMULiw_a16, @@ -1057,7 +1057,7 @@ const OpFn OP_TABLE(fpu_8087_de)[256] = { // clang-format on }; -const OpFn OP_TABLE(fpu_8087_df)[256] = { +static const OpFn OP_TABLE(fpu_8087_df)[256] = { // clang-format off opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, opFILDiw_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, ILLEGAL_a16, diff --git a/src/dma.c b/src/dma.c index bfc294f2a..5dfd70ae8 100644 --- a/src/dma.c +++ b/src/dma.c @@ -1503,7 +1503,7 @@ dma_channel_read_only(int channel) dma_channel_advance(channel); if (!dma_at && !channel) - refreshread(); + is_nec ? refreshread_vx0() : refreshread(); if (!dma_c->size) { temp = _dma_read(dma_c->ac, dma_c); @@ -1611,7 +1611,7 @@ dma_channel_read(int channel) dma_channel_advance(channel); if (!dma_at && !channel) - refreshread(); + is_nec ? refreshread_vx0() : refreshread(); if (!dma_c->size) { temp = _dma_read(dma_c->ac, dma_c); diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index d32e13895..9cb91e7c6 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -315,6 +315,9 @@ extern uint16_t get_last_addr(void); extern void sub_cycles(int c); extern void resub_cycles(int old_cycles); +extern void sub_cycles_vx0(int c); +extern void resub_cycles_vx0(int old_cycles); + extern void ack_pause(void); extern void do_pause(int p); diff --git a/src/video/vid_cga_compaq_plasma.c b/src/video/vid_cga_compaq_plasma.c index b894daa9f..9eea61e0f 100644 --- a/src/video/vid_cga_compaq_plasma.c +++ b/src/video/vid_cga_compaq_plasma.c @@ -106,7 +106,11 @@ compaq_plasma_waitstates(UNUSED(void *priv)) int ws; ws = ws_array[cycles & 0xf]; - sub_cycles(ws); + + if (is_nec) + sub_cycles_vx0(ws); + else + sub_cycles(ws); } static void diff --git a/src/video/vid_cga_ncr.c b/src/video/vid_cga_ncr.c index cda38036b..dabbd85bf 100644 --- a/src/video/vid_cga_ncr.c +++ b/src/video/vid_cga_ncr.c @@ -91,7 +91,11 @@ nga_waitstates(UNUSED(void *priv)) int ws; ws = ws_array[cycles & 0xf]; - sub_cycles(ws); + + if (is_nec) + sub_cycles_vx0(ws); + else + sub_cycles(ws); } void diff --git a/src/video/vid_cga_olivetti.c b/src/video/vid_cga_olivetti.c index 0279621a1..ae539d084 100644 --- a/src/video/vid_cga_olivetti.c +++ b/src/video/vid_cga_olivetti.c @@ -157,7 +157,11 @@ ogc_waitstates(UNUSED(void *priv)) int ws; ws = ws_array[cycles & 0xf]; - sub_cycles(ws); + + if (is_nec) + sub_cycles_vx0(ws); + else + sub_cycles(ws); } void