diff --git a/src/86box.c b/src/86box.c index 235a1fd5d..147233b21 100644 --- a/src/86box.c +++ b/src/86box.c @@ -17,8 +17,8 @@ * Copyright 2008-2020 Sarah Walker. * Copyright 2016-2020 Miran Grca. * Copyright 2017-2020 Fred N. van Kempen. - * Copyright 2021 Laci bá' - * Copyright 2021 dob205 + * Copyright 2021 Laci bá' + * Copyright 2021 dob205 */ #include #include diff --git a/src/codegen/codegen_ops_fpu.h b/src/codegen/codegen_ops_fpu.h index 58a5adf7d..4ffbb45a0 100644 --- a/src/codegen/codegen_ops_fpu.h +++ b/src/codegen/codegen_ops_fpu.h @@ -667,14 +667,16 @@ ropFCHS(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeb return op_pc; \ } +// clang-format off opFLDimm(1, 1.0) - opFLDimm(L2T, 3.3219280948873623) - opFLDimm(L2E, 1.4426950408889634); +opFLDimm(L2T, 3.3219280948873623) +opFLDimm(L2E, 1.4426950408889634); opFLDimm(PI, 3.141592653589793); opFLDimm(EG2, 0.3010299956639812); opFLDimm(Z, 0.0) +// clang-format on - static uint32_t ropFLDLN2(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) +static uint32_t ropFLDLN2(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) { FP_ENTER(); FP_LOAD_IMM_Q(0x3fe62e42fefa39f0ull); diff --git a/src/codegen/codegen_x86-64.c b/src/codegen/codegen_x86-64.c index 6939819d4..4a184b981 100644 --- a/src/codegen/codegen_x86-64.c +++ b/src/codegen/codegen_x86-64.c @@ -485,48 +485,51 @@ codegen_flush(void) return; } +// clang-format off static int opcode_modrm[256] = { - 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*00*/ - 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*10*/ - 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 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/*d0*/ - 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, /*e0*/ - 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0 /*f0*/ + 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, /*c0*/ + 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, /*d0*/ + 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, /*e0*/ + 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0 /*f0*/ }; +// clang-format off void codegen_debug(void) diff --git a/src/codegen/codegen_x86.c b/src/codegen/codegen_x86.c index 61b473fe7..bd9793732 100644 --- a/src/codegen/codegen_x86.c +++ b/src/codegen/codegen_x86.c @@ -1627,48 +1627,51 @@ codegen_flush(void) return; } +// clang-format off static int opcode_modrm[256] = { - 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*00*/ - 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*10*/ - 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*20*/ - 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*30*/ + 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*00*/ + 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*10*/ + 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*20*/ + 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*30*/ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*40*/ - 0, 0, 0, 0, 0, 0, 0, 0,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en_new/codegen.c b/src/codegen_new/codegen.c index 2f178bc74..bf6ad123c 100644 --- a/src/codegen_new/codegen.c +++ b/src/codegen_new/codegen.c @@ -322,48 +322,51 @@ codegen_generate_ea(ir_data_t *ir, x86seg *op_ea_seg, uint32_t fetchdat, int op_ return codegen_generate_ea_16_long(ir, op_ea_seg, fetchdat, op_ssegs, op_pc); } +// clang-format off static uint8_t opcode_modrm[256] = { - 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*00*/ - 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*10*/ - 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*20*/ - 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*30*/ + 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*00*/ + 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*10*/ + 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*20*/ + 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*30*/ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*40*/ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*50*/ - 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, /*60*/ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*70*/ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*40*/ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*50*/ + 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 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1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, /*b0*/ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*80*/ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*90*/ + 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, /*a0*/ + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, /*b0*/ - 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, /*c0*/ - 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, /*d0*/ - 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, /*e0*/ - 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0 /*f0*/ + 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, /*c0*/ + 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, /*d0*/ + 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, /*e0*/ + 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0 /*f0*/ }; +// clang-format on void codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_pc, uint32_t old_pc) diff --git a/src/codegen_new/codegen_ops_3dnow.c b/src/codegen_new/codegen_ops_3dnow.c index ff0c136e2..c2b04584c 100644 --- a/src/codegen_new/codegen_ops_3dnow.c +++ b/src/codegen_new/codegen_ops_3dnow.c @@ -37,16 +37,18 @@ return op_pc + 2; \ } +// clang-format off ropParith(PFADD) - ropParith(PFCMPEQ) - ropParith(PFCMPGE) - ropParith(PFCMPGT) - ropParith(PFMAX) - ropParith(PFMIN) - ropParith(PFMUL) - ropParith(PFSUB) +ropParith(PFCMPEQ) +ropParith(PFCMPGE) +ropParith(PFCMPGT) +ropParith(PFMAX) +ropParith(PFMIN) +ropParith(PFMUL) +ropParith(PFSUB) +// clang-format on - uint32_t ropPF2ID(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc) +uint32_t ropPF2ID(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc) { int dest_reg = (fetchdat >> 3) & 7; diff --git a/src/codegen_new/codegen_ops_fpu_arith.c b/src/codegen_new/codegen_ops_fpu_arith.c index e9739f830..98d77250c 100644 --- a/src/codegen_new/codegen_ops_fpu_arith.c +++ b/src/codegen_new/codegen_ops_fpu_arith.c @@ -423,8 +423,10 @@ ropFUCOMPP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, return op_pc + 1; \ } +// clang-format off ropF_arith_mem(s, uop_MEM_LOAD_SINGLE) - ropF_arith_mem(d, uop_MEM_LOAD_DOUBLE) +ropF_arith_mem(d, uop_MEM_LOAD_DOUBLE) +// clang-format on #define ropFI_arith_mem(name, temp_reg) \ uint32_t ropFIADD##name(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc) \ diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 5030d9ff7..1ab06205f 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -1170,7 +1170,7 @@ cpu_set(void) #endif if ((cpu_s->cpu_type == CPU_K6_2P) || (cpu_s->cpu_type == CPU_K6_3P)) { - x86_opcodes_3DNOW = ops_3DNOWE; + x86_opcodes_3DNOW = ops_3DNOWE; #ifdef USE_DYNAREC x86_dynarec_opcodes_3DNOW = dynarec_ops_3DNOWE; #endif diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index a28618fe1..307865629 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -172,36 +172,42 @@ typedef struct { const cpu_legacy_table_t **tables; } cpu_legacy_machine_t; -#define C_FLAG 0x0001 -#define P_FLAG 0x0004 -#define A_FLAG 0x0010 -#define Z_FLAG 0x0040 -#define N_FLAG 0x0080 -#define T_FLAG 0x0100 -#define I_FLAG 0x0200 -#define D_FLAG 0x0400 -#define V_FLAG 0x0800 -#define NT_FLAG 0x4000 -#define MD_FLAG 0x8000 +#define C_FLAG 0x0001 +#define P_FLAG 0x0004 +#define A_FLAG 0x0010 +#define Z_FLAG 0x0040 +#define N_FLAG 0x0080 +#define T_FLAG 0x0100 +#define I_FLAG 0x0200 +#define D_FLAG 0x0400 +#define V_FLAG 0x0800 +#define NT_FLAG 0x4000 +#define MD_FLAG 0x8000 -#define RF_FLAG 0x0001 /* in EFLAGS */ -#define VM_FLAG 0x0002 /* in EFLAGS */ -#define VIF_FLAG 0x0008 /* in EFLAGS */ -#define VIP_FLAG 0x0010 /* in EFLAGS */ -#define VID_FLAG 0x0020 /* in EFLAGS */ +#define RF_FLAG 0x0001 /* in EFLAGS */ +#define VM_FLAG 0x0002 /* in EFLAGS */ +#define VIF_FLAG 0x0008 /* in EFLAGS */ +#define VIP_FLAG 0x0010 /* in EFLAGS */ +#define VID_FLAG 0x0020 /* in EFLAGS */ -#define WP_FLAG 0x10000 /* in CR0 */ -#define CR4_VME (1 << 0) -#define CR4_PVI (1 << 1) -#define CR4_PSE (1 << 4) -#define CR4_PAE (1 << 5) -#define CR4_PGE (1 << 7) +#define WP_FLAG 0x10000 /* in CR0 */ -#define CPL ((cpu_state.seg_cs.access >> 5) & 3) +#define CR4_VME (1 << 0) /* Virtual 8086 Mode Extensions */ +#define CR4_PVI (1 << 1) /* Protected-mode Virtual Interrupts */ +#define CR4_TSD (1 << 2) /* Time Stamp Disable */ +#define CR4_DE (1 << 3) /* Debugging Extensions */ +#define CR4_PSE (1 << 4) /* Page Size Extension */ +#define CR4_PAE (1 << 5) /* Physical Address Extension */ +#define CR4_MCE (1 << 6) /* Machine Check Exception */ +#define CR4_PGE (1 << 7) /* Page Global Enabled */ +#define CR4_PCE (1 << 8) /* Performance-Monitoring Counter enable */ +#define CR4_OSFXSR (1 << 9) /* Operating system support for FXSAVE and FXRSTOR instructions */ -#define IOPL ((cpu_state.flags >> 12) & 3) +#define CPL ((cpu_state.seg_cs.access >> 5) & 3) -#define IOPLp ((!(msw & 1)) || (CPL <= IOPL)) +#define IOPL ((cpu_state.flags >> 12) & 3) + +#define IOPLp ((!(msw & 1)) || (CPL <= IOPL)) typedef union { uint32_t l; @@ -468,15 +474,9 @@ COMPILE_TIME_ASSERT(sizeof(cpu_state_t) <= 128) # define fpu_cycles cpu_state._fpu_cycles #endif -#define cpu_rm cpu_state.rm_data.rm_mod_reg.rm -#define cpu_mod cpu_state.rm_data.rm_mod_reg.mod -#define cpu_reg cpu_state.rm_data.rm_mod_reg.reg - -#define CR4_TSD (1 << 2) -#define CR4_DE (1 << 3) -#define CR4_MCE (1 << 6) -#define CR4_PCE (1 << 8) -#define CR4_OSFXSR (1 << 9) +#define cpu_rm cpu_state.rm_data.rm_mod_reg.rm +#define cpu_mod cpu_state.rm_data.rm_mod_reg.mod +#define cpu_reg cpu_state.rm_data.rm_mod_reg.reg /* Global variables. */ extern cpu_state_t cpu_state; diff --git a/src/cpu/x87_ops_arith.h b/src/cpu/x87_ops_arith.h index f5e5d7696..e2dbbdb8f 100644 --- a/src/cpu/x87_ops_arith.h +++ b/src/cpu/x87_ops_arith.h @@ -125,25 +125,27 @@ return 0; \ } +// clang-format off opFPU(s, x87_ts, 16, t.i, geteal, t.s, _32) #ifndef FPU_8087 opFPU(s, x87_ts, 32, t.i, geteal, t.s, _32) #endif - opFPU(d, x87_td, 16, t.i, geteaq, t.d, _64) + opFPU(d, x87_td, 16, t.i, geteaq, t.d, _64) #ifndef FPU_8087 - opFPU(d, x87_td, 32, t.i, geteaq, t.d, _64) + opFPU(d, x87_td, 32, t.i, geteaq, t.d, _64) #endif - opFPU(iw, uint16_t, 16, t, geteaw, (double) (int16_t) t, _i16) +opFPU(iw, uint16_t, 16, t, geteaw, (double) (int16_t) t, _i16) #ifndef FPU_8087 - opFPU(iw, uint16_t, 32, t, geteaw, (double) (int16_t) t, _i16) + opFPU(iw, uint16_t, 32, t, geteaw, (double) (int16_t) t, _i16) #endif - opFPU(il, uint32_t, 16, t, geteal, (double) (int32_t) t, _i32) + opFPU(il, uint32_t, 16, t, geteal, (double) (int32_t) t, _i32) #ifndef FPU_8087 - opFPU(il, uint32_t, 32, t, geteal, (double) (int32_t) t, _i32) + opFPU(il, uint32_t, 32, t, geteal, (double) (int32_t) t, _i32) #endif +// clang-format on - static int opFADD(uint32_t fetchdat) +static int opFADD(uint32_t fetchdat) { FP_ENTER(); cpu_state.pc++; diff --git a/src/include/86box/config.h b/src/include/86box/config.h index 9946a0da3..dd873d168 100644 --- a/src/include/86box/config.h +++ b/src/include/86box/config.h @@ -28,109 +28,109 @@ extern "C" { #if 0 typedef struct { - uint8_t id, - uint8_t bus_type, /* Bus type: IDE, SCSI, etc. */ - bus, :4, /* ID of the bus (for example, for IDE, - 0 = primary, 1 = secondary, etc. */ - bus_id, :4, /* ID of the device on the bus */ - uint8_t type, /* Type flags, interpretation depends - on the device */ - uint8_t is_image; /* This is only used for CD-ROM: - 0 = Image; - 1 = Host drive */ + uint8_t id, + uint8_t bus_type, /* Bus type: IDE, SCSI, etc. */ + bus, : 4, /* ID of the bus (for example, for IDE, + 0 = primary, 1 = secondary, etc. */ + bus_id, : 4, /* ID of the device on the bus */ + uint8_t type, /* Type flags, interpretation depends + on the device */ + uint8_t is_image; /* This is only used for CD-ROM: + 0 = Image; + 1 = Host drive */ - wchar_t path[1024]; /* Name of current image file or - host drive */ + wchar_t path[1024]; /* Name of current image file or + host drive */ - uint32_t spt, /* Physical geometry parameters */ - hpc, - tracks; + uint32_t spt, /* Physical geometry parameters */ + hpc, + tracks; } storage_cfg_t; typedef struct { /* General configuration */ - int vid_resize, /* Window is resizable or not */ - vid_renderer, /* Renderer */ - vid_fullscreen_scale, /* Full screen scale type */ - vid_fullscreen_start, /* Start emulator in full screen */ - vid_force_43, /* Force 4:3 display ratio in windowed mode */ - vid_scale, /* Windowed mode scale */ - vid_overscan, /* EGA/(S)VGA overscan enabled */ - vid_cga_contrast, /* CGA alternate contrast enabled */ - vid_grayscale, /* Video is grayscale */ - vid_grayscale_type, /* Video grayscale type */ - vid_invert_display, /* Invert display */ - rctrl_is_lalt, /* Right CTRL is left ALT */ - update_icons, /* Update status bar icons */ - window_remember, /* Remember window position and size */ - window_w, /* Window coordinates */ - window_h, - window_x, - window_y, - sound_gain; /* Sound gain */ + int vid_resize, /* Window is resizable or not */ + vid_renderer, /* Renderer */ + vid_fullscreen_scale, /* Full screen scale type */ + vid_fullscreen_start, /* Start emulator in full screen */ + vid_force_43, /* Force 4:3 display ratio in windowed mode */ + vid_scale, /* Windowed mode scale */ + vid_overscan, /* EGA/(S)VGA overscan enabled */ + vid_cga_contrast, /* CGA alternate contrast enabled */ + vid_grayscale, /* Video is grayscale */ + vid_grayscale_type, /* Video grayscale type */ + vid_invert_display, /* Invert display */ + rctrl_is_lalt, /* Right CTRL is left ALT */ + update_icons, /* Update status bar icons */ + window_remember, /* Remember window position and size */ + window_w, /* Window coordinates */ + window_h, + window_x, + window_y, + sound_gain; /* Sound gain */ # ifdef USE_LANGUAGE - uint16_t language_id; /* Language ID (0x0409 = English (US)) */ + uint16_t language_id; /* Language ID (0x0409 = English (US)) */ # endif /* Machine cateogory */ - int machine, /* Machine */ - cpu, /* CPU */ + int machine, /* Machine */ + cpu, /* CPU */ # ifdef USE_DYNAREC - cpu_use_dynarec, /* CPU recompiler enabled */ + cpu_use_dynarec, /* CPU recompiler enabled */ # endif - wait_states, /* CPU wait states */ - enable_external_fpu, /* FPU enabled */ - time_sync; /* Time sync enabled */ - uint32_t mem_size; /* Memory size */ + wait_states, /* CPU wait states */ + enable_external_fpu, /* FPU enabled */ + time_sync; /* Time sync enabled */ + uint32_t mem_size; /* Memory size */ /* Video category */ - int video_card, /* Video card */ - voodoo_enabled; /* Voodoo enabled */ + int video_card, /* Video card */ + voodoo_enabled; /* Voodoo enabled */ /* Input devices category */ - int mouse_type, /* Mouse type */ - joystick_type; /* Joystick type */ + int mouse_type, /* Mouse type */ + joystick_type; /* Joystick type */ /* Sound category */ - int sound_card, /* Sound card */ - midi_device, /* Midi device */ - mpu_401, /* Standalone MPU-401 enabled */ - ssi_2001_enabled, /* SSI-2001 enabled */ - game_blaster_enabled, /* Game blaster enabled */ - gus_enabled, /* Gravis Ultrasound enabled */ - opl_type, /* OPL emulation type */ - sound_is_float; /* Sound is 32-bit float or 16-bit integer */ + int sound_card, /* Sound card */ + midi_device, /* Midi device */ + mpu_401, /* Standalone MPU-401 enabled */ + ssi_2001_enabled, /* SSI-2001 enabled */ + game_blaster_enabled, /* Game blaster enabled */ + gus_enabled, /* Gravis Ultrasound enabled */ + opl_type, /* OPL emulation type */ + sound_is_float; /* Sound is 32-bit float or 16-bit integer */ /* Network category */ - int network_type, /* Network type (SLiRP or PCap) */ - network_card; /* Network card */ - char network_host[520]; /* PCap device */ + int network_type, /* Network type (SLiRP or PCap) */ + network_card; /* Network card */ + char network_host[520]; /* PCap device */ /* Ports category */ - char parallel_devices[PARALLEL_MAX][32]; /* LPT device names */ + char parallel_devices[PARALLEL_MAX][32]; /* LPT device names */ # ifdef USE_SERIAL_DEVICES - char serial_devices[SERIAL_MAX][32]; /* Serial device names */ + char serial_devices[SERIAL_MAX][32]; /* Serial device names */ # endif /* Other peripherals category */ - int fdc_type, /* Floppy disk controller type */ - hdc, /* Hard disk controller */ - scsi_card, /* SCSI controller */ - ide_ter_enabled, /* Tertiary IDE controller enabled */ - ide_qua_enabled, /* Quaternary IDE controller enabled */ - bugger_enabled, /* ISA bugger device enabled */ - isa_rtc_type, /* ISA RTC card */ - isa_mem_type[ISAMEM_MAX]; /* ISA memory boards */ + int fdc_type, /* Floppy disk controller type */ + hdc, /* Hard disk controller */ + scsi_card, /* SCSI controller */ + ide_ter_enabled, /* Tertiary IDE controller enabled */ + ide_qua_enabled, /* Quaternary IDE controller enabled */ + bugger_enabled, /* ISA bugger device enabled */ + isa_rtc_type, /* ISA RTC card */ + isa_mem_type[ISAMEM_MAX]; /* ISA memory boards */ /* Hard disks category */ - storage_cfg_t hdd[HDD_NUM]; /* Hard disk drives */ + storage_cfg_t hdd[HDD_NUM]; /* Hard disk drives */ /* Floppy drives category */ - storage_cfg_t fdd[FDD_NUM]; /* Floppy drives */ + storage_cfg_t fdd[FDD_NUM]; /* Floppy drives */ /* Other removable devices category */ - storage_cfg_t cdrom[CDROM_NUM], /* CD-ROM drives */ - storage_cfg_t rdisk[ZIP_NUM]; /* Removable disk drives */ + storage_cfg_t cdrom[CDROM_NUM], /* CD-ROM drives */ + storage_cfg_t rdisk[ZIP_NUM]; /* Removable disk drives */ } config_t; #endif diff --git a/src/include/86box/disksizes.h b/src/include/86box/disksizes.h new file mode 100644 index 000000000..e47b82943 --- /dev/null +++ b/src/include/86box/disksizes.h @@ -0,0 +1,70 @@ +/* + * 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. + * + * Header of the emulation of the PC speaker. + * + * + * + * Authors: Jasmine Iwanek + * + * Copyright 2022 Jasmine Iwanek + */ + +#ifndef DISK_SIZES_H +#define DISK_SIZES_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + int hole; + int sides; + int data_rate; + int encoding; + int rpm; + int tracks; + int sectors; /* For IMG and Japanese FDI only. */ + int sector_len; /* For IMG and Japanese FDI only. */ + int media_desc; + int spc; + int num_fats; + int spfat; + int root_dir_entries; +} disk_size_t; + +static const disk_size_t disk_sizes[14] = { +// clang-format off +// { 1, 1, 2, 1, 1, 77, 26, 0, 0, 4, 2, 6, 68 }, /* 250k 8" */ +// { 1, 2, 2, 1, 1, 77, 26, 0, 0, 4, 2, 6, 68 }, /* 500k 8" */ +// { 1, 1, 2, 1, 1, 77, 8, 3, 0, 1, 2, 2, 192 }, /* 616k 8" */ +// { 1, 2, 0, 1, 1, 77, 8, 3, 0, 1, 2, 2, 192 }, /* 1232k 8" */ + { 0, 1, 2, 1, 0, 40, 8, 2, 0xfe, 2, 2, 1, 64 }, /* 160k */ + { 0, 1, 2, 1, 0, 40, 9, 2, 0xfc, 2, 2, 1, 64 }, /* 180k */ + { 0, 2, 2, 1, 0, 40, 8, 2, 0xff, 2, 2, 1, 112 }, /* 320k */ + { 0, 2, 2, 1, 0, 40, 9, 2, 0xfd, 2, 2, 2, 112 }, /* 360k */ + { 0, 2, 2, 1, 0, 80, 8, 2, 0xfb, 2, 2, 2, 112 }, /* 640k */ + { 0, 2, 2, 1, 0, 80, 9, 2, 0xf9, 2, 2, 3, 112 }, /* 720k */ + { 1, 2, 0, 1, 1, 80, 15, 2, 0xf9, 1, 2, 7, 224 }, /* 1.2M */ + { 1, 2, 0, 1, 1, 77, 8, 3, 0xfe, 1, 2, 2, 192 }, /* 1.25M */ + { 1, 2, 0, 1, 0, 80, 18, 2, 0xf0, 1, 2, 9, 224 }, /* 1.44M */ + { 1, 2, 0, 1, 0, 80, 21, 2, 0xf0, 2, 2, 5, 16 }, /* DMF cluster 1024 */ + { 1, 2, 0, 1, 0, 80, 21, 2, 0xf0, 4, 2, 3, 16 }, /* DMF cluster 2048 */ + { 2, 2, 3, 1, 0, 80, 36, 2, 0xf0, 2, 2, 9, 240 }, /* 2.88M */ + { 0, 64, 0, 0, 0, 96, 32, 2, 0, 0, 0, 0, 0 }, /* ZIP 100 */ + { 0, 64, 0, 0, 0, 239, 32, 2, 0, 0, 0, 0, 0 }, /* ZIP 250 */ +// { 0, 8, 0, 0, 0, 963, 32, 2, 0, 0, 0, 0, 0 }, /* LS-120 */ +// { 0, 32, 0, 0, 0, 262, 56, 2, 0, 0, 0, 0, 0 } /* LS-240 */ +// clang-format on +}; + +#ifdef __cplusplus +} +#endif + +#endif /*DISK_SIZES_H*/ diff --git a/src/include/86box/hdc.h b/src/include/86box/hdc.h index 68b75b97b..8eb5134b8 100644 --- a/src/include/86box/hdc.h +++ b/src/include/86box/hdc.h @@ -28,6 +28,7 @@ * least 7 devices, with each device being \ * able to support 8 units, but hey... */ +/* Controller types. */ #define HDC_NONE 0 #define HDC_INTERNAL 1 diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index df740ee2a..2807c1060 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -832,14 +832,14 @@ const machine_t machines[] = { .min_voltage = 0, .max_voltage = 0, .min_multi = 0, - .max_multi = 0, + .max_multi = 0 }, .bus_flags = MACHINE_PC, .flags = MACHINE_FLAGS_NONE, .ram = { .min = 128, .max = 640, - .step = 64, + .step = 64 }, .nvrmask = 0, .kbc = KBC_IBM_PC_XT, @@ -1231,7 +1231,7 @@ const machine_t machines[] = { .max_multi = 0 }, .bus_flags = MACHINE_PC, - MACHINE_FLAGS_NONE, + .flags = MACHINE_FLAGS_NONE, .ram = { .min = 256, .max = 640, @@ -9585,7 +9585,7 @@ const machine_t machines[] = { .min_voltage = 2800, .max_voltage = 3520, .min_multi = 1.5, - .max_multi = 5.5, + .max_multi = 5.5 }, .bus_flags = MACHINE_PS2_PCI, .flags = MACHINE_IDE_DUAL, @@ -11831,7 +11831,7 @@ const machine_t machines[] = { .min_voltage = 1300, .max_voltage = 3500, .min_multi = MACHINE_MULTIPLIER_FIXED, - .max_multi = MACHINE_MULTIPLIER_FIXED, + .max_multi = MACHINE_MULTIPLIER_FIXED }, .bus_flags = MACHINE_PS2_A97, .flags = MACHINE_IDE_DUAL | MACHINE_AG, diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt index 98252d49e..dc03cb417 100644 --- a/src/network/CMakeLists.txt +++ b/src/network/CMakeLists.txt @@ -13,7 +13,7 @@ # Copyright 2020,2021 David Hrdlička. # -add_library(net OBJECT network.c net_pcap.c net_slirp.c net_dp8390.c net_3c501.c +add_library(net OBJECT network.c net_pcap.c net_slirp.c net_dp8390.c net_3c501.c net_3c503.c net_ne2000.c net_pcnet.c net_wd8003.c net_plip.c net_event.c) option(SLIRP_EXTERNAL "Link against the system-provided libslirp library" OFF) diff --git a/src/network/net_pcnet.c b/src/network/net_pcnet.c index e1f62c874..7b48b063f 100644 --- a/src/network/net_pcnet.c +++ b/src/network/net_pcnet.c @@ -1486,7 +1486,7 @@ pcnetAsyncTransmit(nic_t *dev) */ if (tmd.tmd1.stp && tmd.tmd1.enp) { const int cb = 4096 - tmd.tmd1.bcnt; - pcnet_log("%s: pcnetAsyncTransmit: stp&enp: cb=%d xmtrc=%#x\n", dev->name, cb, CSR_XMTRC(dev)); + pcnet_log(3, "%s: pcnetAsyncTransmit: stp&enp: cb=%d xmtrc=%#x\n", dev->name, cb, CSR_XMTRC(dev)); if ((pcnetIsLinkUp(dev) || fLoopback)) { diff --git a/src/network/slirp/CMakeLists.txt b/src/network/slirp/CMakeLists.txt index f3fa9348b..a2c82e642 100644 --- a/src/network/slirp/CMakeLists.txt +++ b/src/network/slirp/CMakeLists.txt @@ -13,9 +13,12 @@ # Copyright 2020,2021 David Hrdlička. # -add_library(slirp STATIC arp_table.c bootp.c cksum.c dnssearch.c if.c ip_icmp.c - ip_input.c ip_output.c mbuf.c misc.c sbuf.c slirp.c socket.c tcp_input.c - tcp_output.c tcp_subr.c tcp_timer.c udp.c util.c version.c) +add_library(slirp STATIC arp_table.c bootp.c cksum.c dnssearch.c if.c + ip_icmp.c ip_input.c ip_output.c + mbuf.c misc.c sbuf.c slirp.c socket.c + tcp_input.c tcp_output.c tcp_subr.c tcp_timer.c + udp.c + util.c version.c) if(WIN32) target_link_libraries(slirp wsock32 iphlpapi) diff --git a/src/qt/qt_newfloppydialog.cpp b/src/qt/qt_newfloppydialog.cpp index a445c47d3..cbb021963 100644 --- a/src/qt/qt_newfloppydialog.cpp +++ b/src/qt/qt_newfloppydialog.cpp @@ -60,21 +60,29 @@ struct disk_size_t { }; static const disk_size_t disk_sizes[14] = { - {0, 1, 2, 1, 0, 40, 8, 2, 0xfe, 2, 2, 1, 64 }, /* 160k */ - { 0, 1, 2, 1, 0, 40, 9, 2, 0xfc, 2, 2, 1, 64 }, /* 180k */ - { 0, 2, 2, 1, 0, 40, 8, 2, 0xff, 2, 2, 1, 112}, /* 320k */ - { 0, 2, 2, 1, 0, 40, 9, 2, 0xfd, 2, 2, 2, 112}, /* 360k */ - { 0, 2, 2, 1, 0, 80, 8, 2, 0xfb, 2, 2, 2, 112}, /* 640k */ - { 0, 2, 2, 1, 0, 80, 9, 2, 0xf9, 2, 2, 3, 112}, /* 720k */ - { 1, 2, 0, 1, 1, 80, 15, 2, 0xf9, 1, 2, 7, 224}, /* 1.2M */ - { 1, 2, 0, 1, 1, 77, 8, 3, 0xfe, 1, 2, 2, 192}, /* 1.25M */ - { 1, 2, 0, 1, 0, 80, 18, 2, 0xf0, 1, 2, 9, 224}, /* 1.44M */ - { 1, 2, 0, 1, 0, 80, 21, 2, 0xf0, 2, 2, 5, 16 }, /* DMF cluster 1024 */ - { 1, 2, 0, 1, 0, 80, 21, 2, 0xf0, 4, 2, 3, 16 }, /* DMF cluster 2048 */ - { 2, 2, 3, 1, 0, 80, 36, 2, 0xf0, 2, 2, 9, 240}, /* 2.88M */ - { 0, 64, 0, 0, 0, 96, 32, 2, 0, 0, 0, 0, 0 }, /* ZIP 100 */ - { 0, 64, 0, 0, 0, 239, 32, 2, 0, 0, 0, 0, 0 } -}; /* ZIP 250 */ +// clang-format off +// { 1, 1, 2, 1, 1, 77, 26, 0, 0, 4, 2, 6, 68 }, /* 250k 8" */ +// { 1, 2, 2, 1, 1, 77, 26, 0, 0, 4, 2, 6, 68 }, /* 500k 8" */ +// { 1, 1, 2, 1, 1, 77, 8, 3, 0, 1, 2, 2, 192 }, /* 616k 8" */ +// { 1, 2, 0, 1, 1, 77, 8, 3, 0, 1, 2, 2, 192 }, /* 1232k 8" */ + { 0, 1, 2, 1, 0, 40, 8, 2, 0xfe, 2, 2, 1, 64 }, /* 160k */ + { 0, 1, 2, 1, 0, 40, 9, 2, 0xfc, 2, 2, 1, 64 }, /* 180k */ + { 0, 2, 2, 1, 0, 40, 8, 2, 0xff, 2, 2, 1, 112 }, /* 320k */ + { 0, 2, 2, 1, 0, 40, 9, 2, 0xfd, 2, 2, 2, 112 }, /* 360k */ + { 0, 2, 2, 1, 0, 80, 8, 2, 0xfb, 2, 2, 2, 112 }, /* 640k */ + { 0, 2, 2, 1, 0, 80, 9, 2, 0xf9, 2, 2, 3, 112 }, /* 720k */ + { 1, 2, 0, 1, 1, 80, 15, 2, 0xf9, 1, 2, 7, 224 }, /* 1.2M */ + { 1, 2, 0, 1, 1, 77, 8, 3, 0xfe, 1, 2, 2, 192 }, /* 1.25M */ + { 1, 2, 0, 1, 0, 80, 18, 2, 0xf0, 1, 2, 9, 224 }, /* 1.44M */ + { 1, 2, 0, 1, 0, 80, 21, 2, 0xf0, 2, 2, 5, 16 }, /* DMF cluster 1024 */ + { 1, 2, 0, 1, 0, 80, 21, 2, 0xf0, 4, 2, 3, 16 }, /* DMF cluster 2048 */ + { 2, 2, 3, 1, 0, 80, 36, 2, 0xf0, 2, 2, 9, 240 }, /* 2.88M */ + { 0, 64, 0, 0, 0, 96, 32, 2, 0, 0, 0, 0, 0 }, /* ZIP 100 */ + { 0, 64, 0, 0, 0, 239, 32, 2, 0, 0, 0, 0, 0 }, /* ZIP 250 */ +// { 0, 8, 0, 0, 0, 963, 32, 2, 0, 0, 0, 0, 0 }, /* LS-120 */ +// { 0, 32, 0, 0, 0, 262, 56, 2, 0, 0, 0, 0, 0 } /* LS-240 */ +// clang-format on +}; static const QStringList rpmModes = { "Perfect RPM", @@ -548,7 +556,7 @@ NewFloppyDialog::createZipSectorImage(const QString &filename, const disk_size_t empty[0x5003] = empty[0x1D003] = 0xFF; /* Root directory = 0x35000 - Data = 0x39000 */ + Data = 0x39000 */ } else { /* ZIP 250 */ /* MBR */ @@ -570,7 +578,7 @@ NewFloppyDialog::createZipSectorImage(const QString &filename, const disk_size_t memset(&(empty[0x0200]), 0x48, 0x3E00); /* The second sector begins with some strange data - in my reference image. */ + in my reference image. */ *(uint64_t *) &(empty[0x0200]) = 0x3831393230334409LL; *(uint64_t *) &(empty[0x0208]) = 0x6A57766964483130LL; *(uint64_t *) &(empty[0x0210]) = 0x3C3A34676063653FLL; @@ -619,7 +627,7 @@ NewFloppyDialog::createZipSectorImage(const QString &filename, const disk_size_t empty[0x4203] = empty[0x22003] = 0xFF; /* Root directory = 0x3FE00 - Data = 0x38200 */ + Data = 0x38200 */ } pbar.setMaximum(pbar_max); diff --git a/src/scsi/scsi.c b/src/scsi/scsi.c index 5f9abe8d6..4e82f67fa 100644 --- a/src/scsi/scsi.c +++ b/src/scsi/scsi.c @@ -41,9 +41,6 @@ #include <86box/scsi_ncr53c8xx.h> #include <86box/scsi_pcscsi.h> #include <86box/scsi_spock.h> -#ifdef WALTJE -# include "scsi_wd33c93.h" -#endif int scsi_card_current[SCSI_BUS_MAX] = { 0, 0 }; @@ -85,9 +82,6 @@ static SCSI_CARD scsi_cards[] = { { &scsi_rt1000mc_device, }, { &scsi_t128_device, }, { &scsi_t130b_device, }, -#ifdef WALTJE - { &scsi_wd33c93_device, }, -#endif { &aha1640_device, }, { &buslogic_640a_device, }, { &ncr53c90_mca_device, }, diff --git a/src/unix/CMakeLists.txt b/src/unix/CMakeLists.txt index 5301c9268..5fbcf0329 100644 --- a/src/unix/CMakeLists.txt +++ b/src/unix/CMakeLists.txt @@ -11,8 +11,8 @@ # Authors: Cacodemon345 # David Hrdlička, # -# Copyright 2021 Cacodemon345. -# Copyright 2021 David Hrdlička. +# Copyright 2021 Cacodemon345. +# Copyright 2021 David Hrdlička. # add_library(plat OBJECT unix.c) diff --git a/src/video/vid_voodoo_banshee.c b/src/video/vid_voodoo_banshee.c index 4170dd345..386ac8575 100644 --- a/src/video/vid_voodoo_banshee.c +++ b/src/video/vid_voodoo_banshee.c @@ -1567,7 +1567,7 @@ banshee_reg_writel(uint32_t addr, uint32_t val, void *p) break; case 0x0600000: - case 0x0700000: /*Texture download*/ + case 0x0700000: /*TMU0 Texture download*/ voodoo->tex_count++; voodoo_queue_command(voodoo, (addr & 0x1ffffc) | FIFO_WRITEL_TEX, val); break; diff --git a/src/win/CMakeLists.txt b/src/win/CMakeLists.txt index 34e6dde9b..a0a4c8e14 100644 --- a/src/win/CMakeLists.txt +++ b/src/win/CMakeLists.txt @@ -10,7 +10,7 @@ # # Authors: David Hrdlička, # -# Copyright 2020,2021 David Hrdlička. +# Copyright 2020-2021 David Hrdlička. # enable_language(RC) diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index a800dd957..4ac33d40f 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -644,12 +644,17 @@ SCSIOBJ := scsi.o scsi_device.o \ scsi_ncr5380.o scsi_ncr53c8xx.o \ scsi_pcscsi.o scsi_spock.o +SLIRPOBJ := arp_table.o bootp.o cksum.o dnssearch.o if.o \ + ip_icmp.o ip_input.o ip_output.o \ + mbuf.o misc.o sbuf.o slirp.o socket.o \ + tcp_input.o tcp_output.o tcp_subr.o tcp_timer.o \ + udp.o \ + util.o version.o \ + NETOBJ := network.o \ net_pcap.o \ net_slirp.o tinyglib.o \ - arp_table.o bootp.o cksum.o dnssearch.o if.o ip_icmp.o ip_input.o \ - ip_output.o mbuf.o misc.o sbuf.o slirp.o socket.o tcp_input.o \ - tcp_output.o tcp_subr.o tcp_timer.o udp.o util.o version.o \ + ${SLIRPOBJ} \ net_dp8390.o net_3c501.o \ net_3c503.o net_ne2000.o \ net_pcnet.o net_wd8003.o \ diff --git a/src/win/win_new_floppy.c b/src/win/win_new_floppy.c index 33807a78e..6e3f765f0 100644 --- a/src/win/win_new_floppy.c +++ b/src/win/win_new_floppy.c @@ -26,6 +26,7 @@ #include #include #include <86box/86box.h> +#include <86box/disksizes.h> #include <86box/plat.h> #include <86box/random.h> #include <86box/ui.h> @@ -34,43 +35,6 @@ #include <86box/zip.h> #include <86box/win.h> -typedef struct { - int hole; - int sides; - int data_rate; - int encoding; - int rpm; - int tracks; - int sectors; /* For IMG and Japanese FDI only. */ - int sector_len; /* For IMG and Japanese FDI only. */ - int media_desc; - int spc; - int num_fats; - int spfat; - int root_dir_entries; -} disk_size_t; - -static const disk_size_t disk_sizes[14] = { - // { 1, 1, 2, 1, 1, 77, 26, 0, 0, 4, 2, 6, 68 }, /* 250k 8" */ - // { 1, 2, 2, 1, 1, 77, 26, 0, 0, 4, 2, 6, 68 }, /* 500k 8" */ - // { 1, 1, 2, 1, 1, 77, 8, 3, 0, 1, 2, 2, 192 }, /* 616k 8" */ - // { 1, 2, 0, 1, 1, 77, 8, 3, 0, 1, 2, 2, 192 }, /* 1232k 8" */ - {0, 1, 2, 1, 0, 40, 8, 2, 0xfe, 1, 2, 1, 64 }, /* 160k */ - { 0, 1, 2, 1, 0, 40, 9, 2, 0xfc, 1, 2, 2, 64 }, /* 180k */ - { 0, 2, 2, 1, 0, 40, 8, 2, 0xff, 2, 2, 1, 112}, /* 320k */ - { 0, 2, 2, 1, 0, 40, 9, 2, 0xfd, 2, 2, 2, 112}, /* 360k */ - { 0, 2, 2, 1, 0, 80, 8, 2, 0xfb, 2, 2, 2, 112}, /* 640k */ - { 0, 2, 2, 1, 0, 80, 9, 2, 0xf9, 2, 2, 3, 112}, /* 720k */ - { 1, 2, 0, 1, 1, 80, 15, 2, 0xf9, 1, 2, 7, 224}, /* 1.2M */ - { 1, 2, 0, 1, 1, 77, 8, 3, 0xfe, 1, 2, 2, 192}, /* 1.25M */ - { 1, 2, 0, 1, 0, 80, 18, 2, 0xf0, 1, 2, 9, 224}, /* 1.44M */ - { 1, 2, 0, 1, 0, 80, 21, 2, 0xf0, 2, 2, 5, 16 }, /* DMF cluster 1024 */ - { 1, 2, 0, 1, 0, 80, 21, 2, 0xf0, 4, 2, 3, 16 }, /* DMF cluster 2048 */ - { 2, 2, 3, 1, 0, 80, 36, 2, 0xf0, 2, 2, 9, 240}, /* 2.88M */ - { 0, 64, 0, 0, 0, 96, 32, 2, 0, 0, 0, 0, 0 }, /* ZIP 100 */ - { 0, 64, 0, 0, 0, 239, 32, 2, 0, 0, 0, 0, 0 } -}; /* ZIP 250 */ - static unsigned char *empty; static int