diff --git a/src/config.c b/src/config.c index 84fc478..3df0274 100644 --- a/src/config.c +++ b/src/config.c @@ -12,7 +12,7 @@ * on Windows XP, possibly Vista and several UNIX systems. * Use the -DANSI_CFG for use on these systems. * - * Version: @(#)config.c 1.0.47 2019/05/04 + * Version: @(#)config.c 1.0.48 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -48,6 +48,7 @@ #include #include "emu.h" #include "config.h" +#include "timer.h" #include "cpu/cpu.h" #include "nvr.h" #include "device.h" @@ -1124,22 +1125,22 @@ load_floppy(config_t *cfg, const char *cat) int c; for (c = 0; c < FDD_NUM; c++) { - sprintf(temp, "fdd_%i_type", c+1); + sprintf(temp, "fdd_%02i_type", c+1); p = config_get_string(cat, temp, (c < 2) ? "525_2dd" : "none"); fdd_set_type(c, fdd_get_from_internal_name(p)); if (fdd_get_type(c) > 13) fdd_set_type(c, 13); /* Try to make paths relative, and copy to destination. */ - sprintf(temp, "fdd_%i_fn", c + 1); + sprintf(temp, "fdd_%02i_fn", c + 1); wp = config_get_wstring(cat, temp, L""); pc_path(floppyfns[c], sizeof_w(floppyfns[c]), wp); - sprintf(temp, "fdd_%i_writeprot", c+1); + sprintf(temp, "fdd_%02i_writeprot", c+1); ui_writeprot[c] = !!config_get_int(cat, temp, 0); - sprintf(temp, "fdd_%i_turbo", c + 1); + sprintf(temp, "fdd_%02i_turbo", c + 1); fdd_set_turbo(c, !!config_get_int(cat, temp, 0)); - sprintf(temp, "fdd_%i_check_bpb", c+1); + sprintf(temp, "fdd_%02i_check_bpb", c+1); fdd_set_check_bpb(c, !!config_get_int(cat, temp, 1)); /* @@ -1148,23 +1149,23 @@ load_floppy(config_t *cfg, const char *cat) * saved. */ if (fdd_get_type(c) == ((c < 2) ? 2 : 0)) { - sprintf(temp, "fdd_%i_type", c+1); + sprintf(temp, "fdd_%02i_type", c+1); config_delete_var(cat, temp); } if (wcslen(floppyfns[c]) == 0) { - sprintf(temp, "fdd_%i_fn", c+1); + sprintf(temp, "fdd_%02i_fn", c+1); config_delete_var(cat, temp); } if (! ui_writeprot[c]) { - sprintf(temp, "fdd_%i_writeprot", c+1); + sprintf(temp, "fdd_%02i_writeprot", c+1); config_delete_var(cat, temp); } if (! fdd_get_turbo(c)) { - sprintf(temp, "fdd_%i_turbo", c+1); + sprintf(temp, "fdd_%02i_turbo", c+1); config_delete_var(cat, temp); } if (! fdd_get_check_bpb(c)) { - sprintf(temp, "fdd_%i_check_bpb", c+1); + sprintf(temp, "fdd_%02i_check_bpb", c+1); config_delete_var(cat, temp); } } @@ -1179,37 +1180,37 @@ save_floppy(const config_t *cfg, const char *cat) int c; for (c = 0; c < FDD_NUM; c++) { - sprintf(temp, "fdd_%i_type", c+1); + sprintf(temp, "fdd_%02i_type", c+1); if (fdd_get_type(c) == ((c < 2) ? 2 : 0)) config_delete_var(cat, temp); else config_set_string(cat, temp, fdd_get_internal_name(fdd_get_type(c))); - sprintf(temp, "fdd_%i_fn", c+1); + sprintf(temp, "fdd_%02i_fn", c+1); if (wcslen(floppyfns[c]) == 0) { config_delete_var(cat, temp); ui_writeprot[c] = 0; - sprintf(temp, "fdd_%i_writeprot", c+1); + sprintf(temp, "fdd_%02i_writeprot", c+1); config_delete_var(cat, temp); } else config_set_wstring(cat, temp, floppyfns[c]); - sprintf(temp, "fdd_%i_writeprot", c+1); + sprintf(temp, "fdd_%02i_writeprot", c+1); if (ui_writeprot[c] == 0) config_delete_var(cat, temp); else config_set_int(cat, temp, ui_writeprot[c]); - sprintf(temp, "fdd_%i_turbo", c+1); + sprintf(temp, "fdd_%02i_turbo", c+1); if (fdd_get_turbo(c) == 0) config_delete_var(cat, temp); else config_set_int(cat, temp, fdd_get_turbo(c)); - sprintf(temp, "fdd_%i_check_bpb", c+1); + sprintf(temp, "fdd_%02i_check_bpb", c+1); if (fdd_get_check_bpb(c) == 1) config_delete_var(cat, temp); else diff --git a/src/cpu/386.c b/src/cpu/386.c index cd31ad1..ee5cd8f 100644 --- a/src/cpu/386.c +++ b/src/cpu/386.c @@ -8,7 +8,7 @@ * * Implementation of 80286+ CPU interpreter. * - * Version: @(#)386.c 1.0.9 2019/04/21 + * Version: @(#)386.c 1.0.10 2019/05/17 * * Authors: Fred N. van Kempen, * Sarah Walker, @@ -46,16 +46,16 @@ # define INFINITY (__builtin_inff()) #endif #include "../emu.h" +#include "../timer.h" +#include "../mem.h" +#include "../devices/system/nmi.h" +#include "../devices/system/pic.h" +#include "../devices/system/pit.h" +#include "../devices/floppy/fdd.h" +#include "../devices/floppy/fdc.h" #include "cpu.h" #include "x86.h" #include "x87.h" -#include "../devices/system/nmi.h" -#include "../mem.h" -#include "../devices/system/pic.h" -#include "../devices/system/pit.h" -#include "../timer.h" -#include "../devices/floppy/fdd.h" -#include "../devices/floppy/fdc.h" #include "386_common.h" diff --git a/src/cpu/386_common.h b/src/cpu/386_common.h index 15a149b..bef43ab 100644 --- a/src/cpu/386_common.h +++ b/src/cpu/386_common.h @@ -8,13 +8,13 @@ * * Common 386 CPU code. * - * Version: @(#)386_common.h 1.0.3 2018/05/09 + * Version: @(#)386_common.h 1.0.4 2019/05/17 * * Authors: Sarah Walker, * Miran Grca, * - * Copyright 2008-2018 Sarah Walker. - * Copyright 2016-2018 Miran Grca. + * Copyright 2008-2019 Sarah Walker. + * Copyright 2016-2019 Miran Grca. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,9 +38,6 @@ extern uint16_t ea_rseg; #undef readmemb -#undef writememb - - #define readmemb(s,a) ((readlookup2[(uint32_t)((s)+(a))>>12]==(uintptr_t)-1 || \ (s)==0xFFFFFFFF) \ ? readmemb386l(s,a) \ @@ -50,6 +47,7 @@ extern uint16_t ea_rseg; ? readmemql(s,a) \ : *(uint64_t *)(readlookup2[(uint32_t)((s)+(a))>>12]+(uint32_t)((s)+(a)))) +#undef writememb #define writememb(s,a,v) if (writelookup2[(uint32_t)((s)+(a))>>12]==(uintptr_t)-1 || (s)==0xFFFFFFFF) writememb386l(s,a,v); else *(uint8_t *)(writelookup2[(uint32_t)((s) + (a)) >> 12] + (uint32_t)((s) + (a))) = v #define writememw(s,a,v) if (writelookup2[(uint32_t)((s)+(a))>>12]==(uintptr_t)-1 || (s)==0xFFFFFFFF || (((s)+(a)) & 1)) writememwl(s,a,v); else *(uint16_t *)(writelookup2[(uint32_t)((s) + (a)) >> 12] + (uint32_t)((s) + (a))) = v @@ -57,75 +55,84 @@ extern uint16_t ea_rseg; #define writememq(s,a,v) if (writelookup2[(uint32_t)((s)+(a))>>12]==(uintptr_t)-1 || (s)==0xFFFFFFFF || (((s)+(a)) & 7)) writememql(s,a,v); else *(uint64_t *)(writelookup2[(uint32_t)((s) + (a)) >> 12] + (uint32_t)((s) + (a))) = v -#define check_io_perm(port) if (msw&1 && ((CPL > IOPL) || (eflags&VM_FLAG))) \ +#define check_io_perm(port) \ + if (msw&1 && ((CPL > IOPL) || (eflags&VM_FLAG))) \ + { \ + int tempi = checkio(port); \ + if (cpu_state.abrt) return 1; \ + if (tempi) \ { \ - int tempi = checkio(port); \ - if (cpu_state.abrt) return 1; \ - if (tempi) \ - { \ - x86gpf("check_io_perm(): no permission",0); \ - return 1; \ - } \ - } + x86gpf("check_io_perm(): no permission",0); \ + return 1; \ + } \ + } -#define checkio_perm(port) if (msw&1 && ((CPL > IOPL) || (eflags&VM_FLAG))) \ +#define checkio_perm(port) \ + if (msw&1 && ((CPL > IOPL) || (eflags&VM_FLAG))) \ + { \ + tempi = checkio(port); \ + if (cpu_state.abrt) break; \ + if (tempi) \ { \ - tempi = checkio(port); \ - if (cpu_state.abrt) break; \ - if (tempi) \ - { \ - x86gpf("checkio_perm(): no permission",0); \ - break; \ - } \ - } + x86gpf("checkio_perm(): no permission",0); \ + break; \ + } \ + } -#define CHECK_READ(chseg, low, high) \ - if ((low < (chseg)->limit_low) || (high > (chseg)->limit_high) || ((msw & 1) && !(eflags & VM_FLAG) && (((chseg)->access & 10) == 8))) \ - { \ - x86gpf("Limit check (READ)", 0); \ - return 1; \ - } \ - if (msw&1 && !(eflags&VM_FLAG) && !((chseg)->access & 0x80)) \ - { \ - if ((chseg) == &_ss) \ - x86ss(NULL,(chseg)->seg & 0xfffc); \ - else \ - x86np("Read from seg not present", (chseg)->seg & 0xfffc); \ - return 1; \ - } +#define CHECK_READ(chseg, low, high) \ + if ((low < (chseg)->limit_low) || \ + (high > (chseg)->limit_high) || \ + ((msw & 1) && !(eflags & VM_FLAG) && \ + (((chseg)->access & 10) == 8))) \ + { \ + x86gpf("Limit check (READ)", 0); \ + return 1; \ + } \ + if (msw&1 && !(eflags&VM_FLAG) && !((chseg)->access & 0x80)) \ + { \ + if ((chseg) == &_ss) \ + x86ss(NULL,(chseg)->seg & 0xfffc); \ + else \ + x86np("Read from seg not present", (chseg)->seg & 0xfffc); \ + return 1; \ + } #define CHECK_WRITE(chseg, low, high) \ - if ((low < (chseg)->limit_low) || (high > (chseg)->limit_high) || !((chseg)->access & 2) || ((msw & 1) && !(eflags & VM_FLAG) && ((chseg)->access & 8))) \ - { \ - x86gpf("Limit check (WRITE)", 0); \ - return 1; \ - } \ - if (msw&1 && !(eflags&VM_FLAG) && !((chseg)->access & 0x80)) \ - { \ - if ((chseg) == &_ss) \ - x86ss(NULL,(chseg)->seg & 0xfffc); \ - else \ - x86np("Write to seg not present", (chseg)->seg & 0xfffc); \ - return 1; \ - } + if ((low < (chseg)->limit_low) || \ + (high > (chseg)->limit_high) || \ + !((chseg)->access & 2) || ((msw & 1) && \ + !(eflags & VM_FLAG) && ((chseg)->access & 8))) \ + { \ + x86gpf("Limit check (WRITE)", 0); \ + return 1; \ + } \ + if (msw&1 && !(eflags&VM_FLAG) && !((chseg)->access & 0x80)) \ + { \ + if ((chseg) == &_ss) \ + x86ss(NULL,(chseg)->seg & 0xfffc); \ + else \ + x86np("Write to seg not present", (chseg)->seg & 0xfffc); \ + return 1; \ + } -#define CHECK_WRITE_REP(chseg, low, high) \ - if ((low < (chseg)->limit_low) || ((unsigned)high > (chseg)->limit_high)) \ - { \ - x86gpf("Limit check (WRITE REP)", 0); \ - break; \ - } \ - if (msw&1 && !(eflags&VM_FLAG) && !((chseg)->access & 0x80)) \ - { \ - if ((chseg) == &_ss) \ - x86ss(NULL,(chseg)->seg & 0xfffc); \ - else \ - x86np("Write (REP) to seg not present", (chseg)->seg & 0xfffc); \ - break; \ - } +#define CHECK_WRITE_REP(chseg, low, high) \ + if ((low < (chseg)->limit_low) || \ + ((unsigned)high > (chseg)->limit_high)) \ + { \ + x86gpf("Limit check (WRITE REP)", 0); \ + break; \ + } \ + if (msw&1 && !(eflags&VM_FLAG) && !((chseg)->access & 0x80)) \ + { \ + if ((chseg) == &_ss) \ + x86ss(NULL,(chseg)->seg & 0xfffc); \ + else \ + x86np("Write (REP) to seg not present", (chseg)->seg & 0xfffc); \ + break; \ + } -#define NOTRM if (!(msw & 1) || (eflags & VM_FLAG))\ +#define NOTRM if (!(msw & 1) || (eflags & VM_FLAG)) \ { \ x86_int(6); \ return 1; \ @@ -270,9 +277,15 @@ static INLINE void seteaq(uint64_t v) writememql(easeg, cpu_state.eaaddr, v); } -#define seteab(v) if (cpu_mod!=3) { if (eal_w) *(uint8_t *)eal_w=v; else writememb386l(easeg,cpu_state.eaaddr,v); } else if (cpu_rm&4) cpu_state.regs[cpu_rm&3].b.h=v; else cpu_state.regs[cpu_rm].b.l=v -#define seteaw(v) if (cpu_mod!=3) { if (eal_w) *(uint16_t *)eal_w=v; else writememwl(easeg,cpu_state.eaaddr,v); } else cpu_state.regs[cpu_rm].w=v -#define seteal(v) if (cpu_mod!=3) { if (eal_w) *eal_w=v; else writememll(easeg,cpu_state.eaaddr,v); } else cpu_state.regs[cpu_rm].l=v +#if 0 +# define seteab(v) if (cpu_mod!=3) { if (eal_w) *(uint8_t *)eal_w=v; else writememb386l(easeg,cpu_state.eaaddr,v); } else if (cpu_rm&4) cpu_state.regs[cpu_rm&3].b.h=v; else cpu_state.regs[cpu_rm].b.l=v +# define seteaw(v) if (cpu_mod!=3) { if (eal_w) *(uint16_t *)eal_w=v; else writememwl(easeg,cpu_state.eaaddr,v); } else cpu_state.regs[cpu_rm].w=v +# define seteal(v) if (cpu_mod!=3) { if (eal_w) *eal_w=v; else writememll(easeg,cpu_state.eaaddr,v); } else cpu_state.regs[cpu_rm].l=v +#else +# define seteab(v) if (cpu_mod!=3) { CHECK_WRITE(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr); if (eal_w) *(uint8_t *)eal_w=v; else { writememb386l(easeg,cpu_state.eaaddr,v); } } else if (cpu_rm&4) cpu_state.regs[cpu_rm&3].b.h=v; else cpu_state.regs[cpu_rm].b.l=v +# define seteaw(v) if (cpu_mod!=3) { CHECK_WRITE(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 1); if (eal_w) *(uint16_t *)eal_w=v; else { writememwl(easeg,cpu_state.eaaddr,v); } } else cpu_state.regs[cpu_rm].w=v +# define seteal(v) if (cpu_mod!=3) { CHECK_WRITE(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 3); if (eal_w) *eal_w=v; else { writememll(easeg,cpu_state.eaaddr,v); } } else cpu_state.regs[cpu_rm].l=v +#endif #define seteab_mem(v) if (eal_w) *(uint8_t *)eal_w=v; else writememb386l(easeg,cpu_state.eaaddr,v); #define seteaw_mem(v) if (eal_w) *(uint16_t *)eal_w=v; else writememwl(easeg,cpu_state.eaaddr,v); diff --git a/src/cpu/386_dynarec.c b/src/cpu/386_dynarec.c index 20e2666..011a869 100644 --- a/src/cpu/386_dynarec.c +++ b/src/cpu/386_dynarec.c @@ -8,7 +8,7 @@ * * Implementation of the CPU's dynamic recompiler. * - * Version: @(#)386_dynarec.c 1.0.10 2019/04/27 + * Version: @(#)386_dynarec.c 1.0.11 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -46,19 +46,19 @@ # define INFINITY (__builtin_inff()) #endif #include "../emu.h" -#include "cpu.h" -#include "x86.h" -#include "x86_ops.h" -#include "x87.h" +#include "../timer.h" #include "../io.h" +#include "cpu.h" #include "../mem.h" #include "../devices/system/nmi.h" #include "../devices/system/pic.h" -#include "../timer.h" -#ifdef USE_DYNAREC -#include "codegen.h" -#endif +#include "x86.h" +#include "x86_ops.h" +#include "x87.h" #include "386_common.h" +#ifdef USE_DYNAREC +# include "codegen.h" +#endif #define CPU_BLOCK_END() cpu_block_end = 1 diff --git a/src/cpu/808x.c b/src/cpu/808x.c index d1e774d..b1bfe84 100644 --- a/src/cpu/808x.c +++ b/src/cpu/808x.c @@ -8,7 +8,7 @@ * * 808x CPU emulation. * - * Version: @(#)808x.c 1.0.19 2019/05/15 + * Version: @(#)808x.c 1.0.20 2019/05/17 * * Authors: Miran Grca, * Andrew Jenner (reenigne), @@ -294,11 +294,16 @@ static void set_pzs(int bits); static int irq_pending(void) { - if ((nmi && nmi_enable && nmi_mask) || - ((flags & I_FLAG) && (pic.pend & ~pic.mask) && !noint)) - return 1; + int temp; - return 0; + if (takeint && !noint) + temp = 1; + else + temp = (nmi && nmi_enable && nmi_mask) || ((flags & T_FLAG) && !noint); + + takeint = (flags & I_FLAG) && (pic.pend &~ pic.mask); + + return temp; } @@ -1500,6 +1505,8 @@ opcodestart: } else loadseg(do_pop(), _opseg[(opcode >> 3) & 0x03]); cpu_wait(1, 0); + + /* All POP segment instructions suppress interrupts for one instruction. */ noint = 1; break; @@ -2588,14 +2595,14 @@ opcodestart: AX = cpu_data; DX = cpu_dest; cpu_data |= DX; - set_co_do_mul((DX != ((AX & 0x8000) == 0) || ((rmdat & 0x38) == 0x20) ? 0 : 0xffff)); + set_co_do_mul(DX != ((AX & 0x8000) == 0 || (rmdat & 0x38) == 0x20 ? 0 : 0xffff)); } else { do_mul(AL, cpu_data); AL = (uint8_t)cpu_data; AH = (uint8_t)cpu_dest; if (! is_nec) cpu_data |= AH; - set_co_do_mul(AH != (((AL & 0x80) == 0) || ((rmdat & 0x38) == 0x20) ? 0 : 0xff)); + set_co_do_mul(AH != ((AL & 0x80) == 0 || (rmdat & 0x38) == 0x20 ? 0 : 0xff)); } set_zf(bits); if (cpu_mod != 3) @@ -2860,6 +2867,7 @@ cpu_reset(int hard) mmu_perm = 4; pfq_size = (is8086) ? 6 : 4; } + takeint = 0; x86seg_reset(); #ifdef USE_DYNAREC diff --git a/src/cpu/codegen.h b/src/cpu/codegen.h index e1ffd5d..d3742c7 100644 --- a/src/cpu/codegen.h +++ b/src/cpu/codegen.h @@ -8,7 +8,7 @@ * * Definitions for the code generator. * - * Version: @(#)codegen.h 1.0.5 2019/03/21 + * Version: @(#)codegen.h 1.0.6 2019/05/17 * * Authors: Sarah Walker, * Miran Grca, diff --git a/src/cpu/codegen_ops.c b/src/cpu/codegen_ops.c index 498eff1..40a2859 100644 --- a/src/cpu/codegen_ops.c +++ b/src/cpu/codegen_ops.c @@ -8,7 +8,7 @@ * * Instruction parsing and generation. * - * Version: @(#)codegen_ops.c 1.0.3 2019/03/21 + * Version: @(#)codegen_ops.c 1.0.4 2019/05/17 * * Authors: Sarah Walker, * Miran Grca, diff --git a/src/cpu/codegen_x86.c b/src/cpu/codegen_x86.c index 3a012f0..f01bdb8 100644 --- a/src/cpu/codegen_x86.c +++ b/src/cpu/codegen_x86.c @@ -8,7 +8,7 @@ * * Dynamic Recompiler for Intel 32-bit systems. * - * Version: @(#)codegen_x86.c 1.0.5 2019/03/21 + * Version: @(#)codegen_x86.c 1.0.6 2019/05/17 * * Authors: Fred N. van Kempen, * Sarah Walker, diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index b93d55d..a18520f 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -8,7 +8,7 @@ * * Definitions for the CPU module. * - * Version: @(#)cpu.h 1.0.13 2019/05/13 + * Version: @(#)cpu.h 1.0.14 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -399,8 +399,13 @@ extern x86seg _oldds; #define gs _gs.base -#define ISA_CYCLES_SHIFT 6 -#define ISA_CYCLES(x) ((x * isa_cycles) >> ISA_CYCLES_SHIFT) +#if 1 +# define ISA_CYCLES_SHIFT 6 +# define ISA_CYCLES(x) ((x * isa_cycles) >> ISA_CYCLES_SHIFT) +#else +# define ISA_CYCLES(x) (x * isa_cycles) +#endif + extern int cpu_cycles_read, cpu_cycles_read_l, cpu_cycles_write, cpu_cycles_write_l; diff --git a/src/cpu/cpu_table.c b/src/cpu/cpu_table.c index 30d7c9e..ef5fe6e 100644 --- a/src/cpu/cpu_table.c +++ b/src/cpu/cpu_table.c @@ -8,7 +8,7 @@ * * Define all known processor types. * - * Version: @(#)cpu_table.c 1.0.9 2019/05/09 + * Version: @(#)cpu_table.c 1.0.10 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, diff --git a/src/cpu/x86.h b/src/cpu/x86.h index 254c577..e25da44 100644 --- a/src/cpu/x86.h +++ b/src/cpu/x86.h @@ -8,7 +8,7 @@ * * Definitions for the X86 architecture. * - * Version: @(#)x86.h 1.0.1 2018/02/19 + * Version: @(#)x86.h 1.0.2 2019/05/17 * * Authors: Sarah Walker, * Miran Grca, diff --git a/src/cpu/x86_ops_misc.h b/src/cpu/x86_ops_misc.h index 74dc1c7..b76545a 100644 --- a/src/cpu/x86_ops_misc.h +++ b/src/cpu/x86_ops_misc.h @@ -8,7 +8,7 @@ * * Miscellaneous x86 CPU Instructions. * - * Version: @(#)x86_ops_misc.h 1.0.4 2019/02/28 + * Version: @(#)x86_ops_misc.h 1.0.5 2019/05/17 * * Authors: Sarah Walker, * Miran Grca, diff --git a/src/cpu/x86_ops_mov.h b/src/cpu/x86_ops_mov.h index 0bbba81..2c9e85a 100644 --- a/src/cpu/x86_ops_mov.h +++ b/src/cpu/x86_ops_mov.h @@ -8,7 +8,7 @@ * * Miscellaneous x86 CPU Instructions. * - * Version: @(#)x86_ops_mov.h 1.0.3 2018/07/28 + * Version: @(#)x86_ops_mov.h 1.0.4 2019/05/17 * * Authors: Sarah Walker, * Miran Grca, diff --git a/src/cpu/x86_ops_shift.h b/src/cpu/x86_ops_shift.h index f0bef71..2015ebc 100644 --- a/src/cpu/x86_ops_shift.h +++ b/src/cpu/x86_ops_shift.h @@ -8,7 +8,7 @@ * * Miscellaneous x86 CPU Instructions. * - * Version: @(#)x86_ops_shift.h 1.0.1 2018/02/14 + * Version: @(#)x86_ops_shift.h 1.0.2 2019/05/17 * * Authors: Sarah Walker, * Miran Grca, diff --git a/src/cpu/x86seg.c b/src/cpu/x86seg.c index b8b424c..25ffb9c 100644 --- a/src/cpu/x86seg.c +++ b/src/cpu/x86seg.c @@ -8,7 +8,7 @@ * * x86 CPU segment emulation. * - * Version: @(#)x86seg.c 1.0.7 2019/04/29 + * Version: @(#)x86seg.c 1.0.8 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -44,9 +44,10 @@ #include #define HAVE_STDARG_H #include "../emu.h" -#include "cpu.h" +#include "../timer.h" #include "../mem.h" #include "../nvr.h" +#include "cpu.h" #include "x86.h" #include "386.h" #include "386_common.h" @@ -349,7 +350,11 @@ void loadseg(uint16_t seg, x86seg *s) addr=seg&~7; if (seg&4) { +#if 0 if (addr>=ldt.limit) +#else + if ((addr+7)>ldt.limit) +#endif { x86gpf("loadseg(): Bigger than LDT limit",seg&~3); return; @@ -358,7 +363,11 @@ void loadseg(uint16_t seg, x86seg *s) } else { +#if 0 if (addr>=gdt.limit) +#else + if ((addr+7)>gdt.limit) +#endif { x86gpf("loadseg(): Bigger than GDT limit",seg&~3); return; @@ -1110,7 +1119,11 @@ void loadcscall(uint16_t seg) addr=newss&~7; if (newss&4) { +#if 0 if (addr>=ldt.limit) +#else + if ((addr+7)>ldt.limit) +#endif { x86abort("Bigger than LDT limit %04X %08X %04X CSC SS\n",newss,addr,ldt.limit); x86ts(NULL,newss&~3); @@ -1120,7 +1133,11 @@ void loadcscall(uint16_t seg) } else { +#if 0 if (addr>=gdt.limit) +#else + if ((addr+7)>gdt.limit) +#endif { x86abort("Bigger than GDT limit %04X %04X CSC\n",newss,gdt.limit); x86ts(NULL,newss&~3); diff --git a/src/cpu/x87_ops.h b/src/cpu/x87_ops.h index 88148cb..4867ff5 100644 --- a/src/cpu/x87_ops.h +++ b/src/cpu/x87_ops.h @@ -8,7 +8,7 @@ * * x87 FPU instructions core. * - * Version: @(#)x87_ops.h 1.0.8 2019/03/21 + * Version: @(#)x87_ops.h 1.0.9 2019/05/17 * * Authors: Fred N. van Kempen, * Sarah Walker, @@ -369,8 +369,10 @@ static INLINE uint16_t x87_compare(double a, double b) return result & (C0|C2|C3); #endif - /* Generic C version is known to give incorrect results in some - * situations, eg comparison of infinity (Unreal) */ + /* + * Generic C version is known to give incorrect results + * in some situations, eg comparison of infinity (Unreal). + */ if (!is386) { if (((a == INFINITY) || (a == -INFINITY)) && ((b == INFINITY) || (b == -INFINITY))) diff --git a/src/devices/cdrom/cdrom.h b/src/devices/cdrom/cdrom.h index 17d0cb8..011767f 100644 --- a/src/devices/cdrom/cdrom.h +++ b/src/devices/cdrom/cdrom.h @@ -8,12 +8,12 @@ * * Definitions for the CDROM module.. * - * Version: @(#)cdrom.h 1.0.16 2018/10/25 + * Version: @(#)cdrom.h 1.0.17 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, * - * Copyright 2017,2018 Fred N. van Kempen. + * Copyright 2017-2019 Fred N. van Kempen. * Copyright 2016-2018 Miran Grca. * * This program is free software; you can redistribute it and/or modify @@ -138,7 +138,7 @@ typedef struct cdrom { } bus_id; FILE *img_fp; - int img_is_iso; + int img_type; int host_drive, prev_host_drive; int cd_status, prev_status, diff --git a/src/devices/cdrom/cdrom_dosbox.cpp b/src/devices/cdrom/cdrom_dosbox.cpp index 7b7f2fa..146a0d7 100644 --- a/src/devices/cdrom/cdrom_dosbox.cpp +++ b/src/devices/cdrom/cdrom_dosbox.cpp @@ -15,7 +15,7 @@ * **NOTE** This code will very soon be replaced with a C variant, so * no more changes will be done. * - * Version: @(#)cdrom_dosbox.cpp 1.0.14 2019/04/12 + * Version: @(#)cdrom_dosbox.cpp 1.0.15 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -60,8 +60,11 @@ #include #include "../../emu.h" #include "../../plat.h" +#include "cdrom.h" +#include "cdrom_image.h" #include "cdrom_dosbox.h" + using namespace std; @@ -147,14 +150,16 @@ CDROM_Interface_Image::InitNewMedia(void) bool -CDROM_Interface_Image::SetDevice(const wchar_t *path, int forceCD) +CDROM_Interface_Image::SetDevice(const wchar_t *path, int type, int forceCD) { (void)forceCD; - if (CueLoadSheet(path)) return true; + if (type == IMAGE_TYPE_NONE || type == IMAGE_TYPE_CUE) + if (CueLoadSheet(path)) return true; + + if (type == IMAGE_TYPE_NONE || type == IMAGE_TYPE_ISO) + if (IsoLoadFile(path)) return true; - if (IsoLoadFile(path)) return true; - return false; } @@ -400,9 +405,12 @@ CDROM_Interface_Image::IsoLoadFile(const wchar_t *filename) track.sectorSize = RAW_SECTOR_SIZE; track.mode2 = true; } else { - /* Unknown mode: Assume regular 2048-byte sectors, this is needed so Apple Rhapsody ISO's can be mounted. */ - track.sectorSize = COOKED_SECTOR_SIZE; - track.mode2 = false; + /* + * Unknown mode: assume regular 2048-byte sectors. + * (This is needed so Apple Rhapsody ISO's can be mounted.) + */ + track.sectorSize = COOKED_SECTOR_SIZE; + track.mode2 = false; } track.length = track.file->getLength() / track.sectorSize; diff --git a/src/devices/cdrom/cdrom_dosbox.h b/src/devices/cdrom/cdrom_dosbox.h index 8f1c525..be79109 100644 --- a/src/devices/cdrom/cdrom_dosbox.h +++ b/src/devices/cdrom/cdrom_dosbox.h @@ -8,7 +8,7 @@ * * Definitions for the CD-ROM image file handling module. * - * Version: @(#)cdrom_dosbox.h 1.0.4 2019/03/07 + * Version: @(#)cdrom_dosbox.h 1.0.5 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -84,7 +84,7 @@ public: virtual ~CDROM_Interface(void) {}; - virtual bool SetDevice(const wchar_t *path, int forceCD) = 0; + virtual bool SetDevice(const wchar_t *path, int type, int forceCD) = 0; virtual bool GetUPC(uint8_t& attr, char* upc) = 0; @@ -139,7 +139,7 @@ public: CDROM_Interface_Image(); virtual ~CDROM_Interface_Image(void); void InitNewMedia(void); - bool SetDevice(const wchar_t* path, int forceCD); + bool SetDevice(const wchar_t* path, int type, int forceCD); bool GetUPC(uint8_t& attr, char* upc); bool GetAudioTracks(int& stTrack, int& end, TMSF& leadOut); bool GetAudioTrackInfo(int track, int& number, TMSF& start, uint8_t& attr); diff --git a/src/devices/cdrom/cdrom_image.cpp b/src/devices/cdrom/cdrom_image.cpp index 87ace52..e9e2e78 100644 --- a/src/devices/cdrom/cdrom_image.cpp +++ b/src/devices/cdrom/cdrom_image.cpp @@ -8,7 +8,7 @@ * * CD-ROM image support. * - * Version: @(#)cdrom_image.cpp 1.0.20 2019/03/05 + * Version: @(#)cdrom_image.cpp 1.0.21 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -143,7 +143,7 @@ audio_callback(cdrom_t *dev, int16_t *output, int len) CDROM_Interface_Image *img = (CDROM_Interface_Image *)dev->local; int ret = 1; - if (!dev->sound_on || (dev->cd_state != CD_PLAYING) || dev->img_is_iso) { + if (!dev->sound_on || (dev->cd_state != CD_PLAYING) || dev->img_type == IMAGE_TYPE_ISO) { DEBUG("image_audio_callback(i): Not playing\n", dev->id); if (dev->cd_state == CD_PLAYING) dev->seek_pos += (len >> 11); @@ -253,7 +253,7 @@ audio_pause(cdrom_t *dev) { CDROM_Interface_Image *img = (CDROM_Interface_Image *)dev->local; - if (!img || dev->img_is_iso) return; + if (!img || dev->img_type == IMAGE_TYPE_ISO) return; if (dev->cd_state == CD_PLAYING) dev->cd_state = CD_PAUSED; @@ -265,7 +265,7 @@ audio_resume(cdrom_t *dev) { CDROM_Interface_Image *img = (CDROM_Interface_Image *)dev->local; - if (!img || dev->img_is_iso) return; + if (!img || dev->img_type == IMAGE_TYPE_ISO) return; if (dev->cd_state == CD_PAUSED) dev->cd_state = CD_PLAYING; @@ -285,7 +285,7 @@ image_ready(cdrom_t *dev) static int -image_get_last_block(cdrom_t *dev) +image_get_capacity(cdrom_t *dev) { CDROM_Interface_Image *img = (CDROM_Interface_Image *)dev->local; int first_track, last_track; @@ -326,7 +326,7 @@ image_getcurrentsubchannel(cdrom_t *dev, uint8_t *b, int msf) img->GetAudioSub(cdpos, attr, track, index, relPos, absPos); - if (dev->img_is_iso) + if (dev->img_type == IMAGE_TYPE_ISO) ret = 0x15; else { if (dev->cd_state == CD_PLAYING) @@ -378,7 +378,7 @@ image_is_track_audio(cdrom_t *dev, uint32_t pos, int is_msf) int m, s, f; int number; - if (!img || dev->img_is_iso) return 0; + if (!img || dev->img_type == IMAGE_TYPE_ISO) return 0; if (is_msf) { m = (pos >> 16) & 0xff; @@ -494,7 +494,7 @@ read_mode1(cdrom_t *dev, int flags, uint32_t lba, uint32_t msf, int mode2, uint8 { CDROM_Interface_Image *img = (CDROM_Interface_Image *)dev->local; - if ((dev->img_is_iso) || (img->GetSectorSize(lba) == 2048)) + if ((dev->img_type == IMAGE_TYPE_ISO) || (img->GetSectorSize(lba) == 2048)) read_sector_to_buffer(dev, raw_buffer, msf, lba, mode2, 2048); else if (img->GetSectorSize(lba) == 2352) img->ReadSector(raw_buffer, true, lba); @@ -547,7 +547,7 @@ read_mode2_non_xa(cdrom_t *dev, int flags, uint32_t lba, uint32_t msf, int mode2 { CDROM_Interface_Image *img = (CDROM_Interface_Image *)dev->local; - if ((dev->img_is_iso) || (img->GetSectorSize(lba) == 2336)) + if ((dev->img_type == IMAGE_TYPE_ISO) || (img->GetSectorSize(lba) == 2336)) read_sector_to_buffer(dev, raw_buffer, msf, lba, mode2, 2336); else if (img->GetSectorSize(lba) == 2352) img->ReadSector(raw_buffer, true, lba); @@ -592,7 +592,7 @@ read_mode2_xa_form1(cdrom_t *dev, int flags, uint32_t lba, uint32_t msf, int mod { CDROM_Interface_Image *img = (CDROM_Interface_Image *)dev->local; - if ((dev->img_is_iso) || (img->GetSectorSize(lba) == 2048)) + if ((dev->img_type == IMAGE_TYPE_ISO) || (img->GetSectorSize(lba) == 2048)) read_sector_to_buffer(dev, raw_buffer, msf, lba, mode2, 2048); else if (img->GetSectorSize(lba) == 2352) img->ReadSector(raw_buffer, true, lba); @@ -643,7 +643,7 @@ read_mode2_xa_form2(cdrom_t *dev, int flags, uint32_t lba, uint32_t msf, int mod { CDROM_Interface_Image *img = (CDROM_Interface_Image *)dev->local; - if ((dev->img_is_iso) || (img->GetSectorSize(lba) == 2324)) + if ((dev->img_type == IMAGE_TYPE_ISO) || (img->GetSectorSize(lba) == 2324)) read_sector_to_buffer(dev, raw_buffer, msf, lba, mode2, 2324); else if (img->GetSectorSize(lba) == 2352) img->ReadSector(raw_buffer, true, lba); @@ -709,7 +709,7 @@ image_readsector_raw(cdrom_t *dev, uint8_t *buffer, int sector, int is_msf, msf = cdrom_lba_to_msf_accurate(sector); } - if (dev->img_is_iso) { + if (dev->img_type == IMAGE_TYPE_ISO) { audio = 0; mode2 = img->IsMode2(lba) ? 1 : 0; } else { @@ -734,7 +734,7 @@ image_readsector_raw(cdrom_t *dev, uint8_t *buffer, int sector, int is_msf, DEBUG("CD-ROM %i: Attempting to read an unrecognized sector type from an image\n", dev->id); return 0; } else if (type == 1) { - if (!audio || dev->img_is_iso) { + if (!audio || dev->img_type == IMAGE_TYPE_ISO) { DEBUG("CD-ROM %i: [Audio] Attempting to read an audio sector from a data image\n", dev->id); return 0; } @@ -985,7 +985,7 @@ image_status(cdrom_t *dev) if (!img) return CD_STATUS_EMPTY; - if (dev->img_is_iso) + if (dev->img_type == IMAGE_TYPE_ISO) return ret; if (img->HasAudioTracks()) { @@ -1014,7 +1014,7 @@ image_stop(cdrom_t *dev) { CDROM_Interface_Image *img = (CDROM_Interface_Image *)dev->local; - if (!img || dev->img_is_iso) return; + if (!img || dev->img_type == IMAGE_TYPE_ISO) return; dev->cd_state = CD_STOPPED; } @@ -1043,7 +1043,7 @@ image_media_type_id(cdrom_t *dev) if (image_size(dev) > 405000) return 65; /* DVD. */ - if (dev->img_is_iso) + if (dev->img_type == IMAGE_TYPE_ISO) return 1; /* Data CD. */ return 3; /* Mixed mode CD. */ @@ -1087,16 +1087,18 @@ cdrom_image_open(cdrom_t *dev, const wchar_t *fn) wcscpy(dev->image_path, fn); if (! wcscasecmp(plat_get_extension(fn), L"ISO")) - dev->img_is_iso = 1; + dev->img_type = 1; + else if (! wcscasecmp(plat_get_extension(fn), L"CUE")) + dev->img_type = 2; else - dev->img_is_iso = 0; + dev->img_type = 0; /* Create new instance of the CDROM_Image class. */ img = new CDROM_Interface_Image(); dev->local = img; /* Open the image. */ - if (! img->SetDevice(fn, false)) { + if (! img->SetDevice(fn, dev->img_type, false)) { image_close(dev); dev->ops = NULL; dev->host_drive = 0; @@ -1111,7 +1113,9 @@ cdrom_image_open(cdrom_t *dev, const wchar_t *fn) dev->cd_state = CD_STOPPED; dev->seek_pos = 0; dev->cd_buflen = 0; - dev->cdrom_capacity = image_get_last_block(dev) + 1; + dev->cdrom_capacity = image_get_capacity(dev); + DEBUG("CD-ROM: capacity %i sectors (%i bytes)\n", + dev->cdrom_capacity, dev->cdrom_capacity << 11); return 0; } diff --git a/src/devices/cdrom/cdrom_image.h b/src/devices/cdrom/cdrom_image.h index f2e7b89..a55d9bf 100644 --- a/src/devices/cdrom/cdrom_image.h +++ b/src/devices/cdrom/cdrom_image.h @@ -8,13 +8,15 @@ * * Definitions for the CD-ROM image file handlers. * - * Version: @(#)cdrom_image.h 1.0.7 2018/10/17 + * Version: @(#)cdrom_image.h 1.0.8 2019/05/17 * - * Authors: Miran Grca, + * Authors: Fred N. van Kempen, + * Miran Grca, * RichardG, * bit * - * Copyright 2016-2018 Miran Grca. + * Copyright 2019 Fred N. van Kempen. + * Copyright 2016-2019 Miran Grca. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,6 +40,14 @@ # define CDROM_IMAGE_H +/* Define the supported image formats. */ +enum { + IMAGE_TYPE_NONE = 0, + IMAGE_TYPE_ISO, + IMAGE_TYPE_CUE +}; + + #ifdef __cplusplus extern "C" { #endif diff --git a/src/devices/cdrom/cdrom_speed.c b/src/devices/cdrom/cdrom_speed.c index e5672ee..0912ac0 100644 --- a/src/devices/cdrom/cdrom_speed.c +++ b/src/devices/cdrom/cdrom_speed.c @@ -32,11 +32,11 @@ * * We discard the latter two ones. * - * Version: @(#)cdrom_speed.c 1.0.2 2018/10/05 + * Version: @(#)cdrom_speed.c 1.0.3 2019/05/17 * * Author: Fred N. van Kempen, * - * Copyright 2017,2018 Fred N. van Kempen. + * Copyright 2017-2019 Fred N. van Kempen. * * Redistribution and use in source and binary forms, with * or without modification, are permitted provided that the @@ -73,7 +73,7 @@ #include #include #include "../../emu.h" -#include "../../version.h" +#include "../../timer.h" #include "../../ui/ui.h" #include "../../plat.h" #include "../scsi/scsi_device.h" diff --git a/src/devices/chipsets/sis471.c b/src/devices/chipsets/sis471.c index 3730feb..0158522 100644 --- a/src/devices/chipsets/sis471.c +++ b/src/devices/chipsets/sis471.c @@ -8,7 +8,7 @@ * * Emulation of the SiS 85C471 System Controller chip. * - * Version: @(#)sis471.c 1.0.15 2019/05/13 + * Version: @(#)sis471.c 1.0.16 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -40,6 +40,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../cpu/cpu.h" #include "../../io.h" #include "../../device.h" diff --git a/src/devices/disk/hdc.c b/src/devices/disk/hdc.c index d56a7bf..6e8fd17 100644 --- a/src/devices/disk/hdc.c +++ b/src/devices/disk/hdc.c @@ -8,7 +8,7 @@ * * Common code to handle all sorts of disk controllers. * - * Version: @(#)hdc.c 1.0.20 2019/05/03 + * Version: @(#)hdc.c 1.0.21 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -47,7 +47,6 @@ #include "../../device.h" #include "hdc.h" #include "hdd.h" -#include "hdc_ide.h" #ifdef ENABLE_HDC_LOG diff --git a/src/devices/disk/hdc.h b/src/devices/disk/hdc.h index df682ab..400e71a 100644 --- a/src/devices/disk/hdc.h +++ b/src/devices/disk/hdc.h @@ -8,7 +8,7 @@ * * Definitions for the common disk controller handler. * - * Version: @(#)hdc.h 1.0.16 2019/04/23 + * Version: @(#)hdc.h 1.0.17 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -76,7 +76,6 @@ extern const device_t xtide_acculogic_device; /* xtide_ps2 */ extern const device_t ide_isa_device; /* isa_ide */ extern const device_t ide_isa_2ch_device; /* isa_ide_2ch */ -extern const device_t ide_isa_2ch_opt_device; /* isa_ide_2ch_opt */ extern const device_t ide_vlb_device; /* vlb_ide */ extern const device_t ide_vlb_2ch_device; /* vlb_ide_2ch */ extern const device_t ide_pci_device; /* pci_ide */ diff --git a/src/devices/disk/hdc_esdi_at.c b/src/devices/disk/hdc_esdi_at.c index 5b7a3b4..b357caf 100644 --- a/src/devices/disk/hdc_esdi_at.c +++ b/src/devices/disk/hdc_esdi_at.c @@ -8,7 +8,7 @@ * * Driver for the ESDI controller (WD1007-vse1) for PC/AT. * - * Version: @(#)hdc_esdi_at.c 1.0.17 2019/05/13 + * Version: @(#)hdc_esdi_at.c 1.0.18 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -46,12 +46,12 @@ #include #define dbglog hdc_log #include "../../emu.h" +#include "../../timer.h" #include "../../cpu/cpu.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" #include "../../device.h" -#include "../../timer.h" #include "../../ui/ui.h" #include "../../plat.h" #include "../system/pic.h" @@ -116,7 +116,7 @@ typedef struct { uint16_t buffer[256]; int irqstat; - int64_t callback; + tmrval_t callback; drive_t drives[2]; diff --git a/src/devices/disk/hdc_esdi_mca.c b/src/devices/disk/hdc_esdi_mca.c index 0f9e76b..9906a70 100644 --- a/src/devices/disk/hdc_esdi_mca.c +++ b/src/devices/disk/hdc_esdi_mca.c @@ -52,7 +52,7 @@ * however, are auto-configured by the system software as * shown above. * - * Version: @(#)hdc_esdi_mca.c 1.0.18 2019/05/13 + * Version: @(#)hdc_esdi_mca.c 1.0.19 2019/05/17 * * Authors: Fred N. van Kempen, * Sarah Walker, @@ -85,10 +85,10 @@ #include #define dbglog hdc_log #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../plat.h" #include "../../ui/ui.h" @@ -144,7 +144,7 @@ typedef struct { int cmd_state; int in_reset; - int64_t callback; + tmrval_t callback; uint32_t rba; diff --git a/src/devices/disk/hdc_ide.h b/src/devices/disk/hdc_ide.h index e698838..3486a06 100644 --- a/src/devices/disk/hdc_ide.h +++ b/src/devices/disk/hdc_ide.h @@ -8,7 +8,7 @@ * * Definitions for the IDE module. * - * Version: @(#)hdc_ide.h 1.0.13 2019/05/13 + * Version: @(#)hdc_ide.h 1.0.15 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -119,7 +119,7 @@ typedef struct { extern int ideboard; extern ide_t *ide_drives[IDE_NUM+XTIDE_NUM]; -extern int64_t idecallback[5]; +extern tmrval_t idecallback[5]; extern void ide_irq_raise(ide_t *); @@ -151,9 +151,7 @@ extern void ide_pri_disable(void); extern void ide_sec_enable(void); extern void ide_sec_disable(void); -extern void ide_set_callback(uint8_t channel, int64_t callback); -extern void secondary_ide_check(void); - +extern void ide_set_callback(uint8_t channel, tmrval_t callback); extern void ide_padstr(char *str, const char *src, int len); extern void ide_padstr8(uint8_t *buf, int buf_size, const char *src); diff --git a/src/devices/disk/hdc_ide_ata.c b/src/devices/disk/hdc_ide_ata.c index 820f2cf..0d97675 100644 --- a/src/devices/disk/hdc_ide_ata.c +++ b/src/devices/disk/hdc_ide_ata.c @@ -14,7 +14,7 @@ * Devices currently implemented are hard disk, CD-ROM and * ZIP IDE/ATAPI devices. * - * Version: @(#)hdc_ide_ata.c 1.0.33 2019/05/13 + * Version: @(#)hdc_ide_ata.c 1.0.35 2019/05/17 * * Authors: Miran Grca, * Sarah Walker, @@ -53,11 +53,11 @@ #define dbglog hdc_log #include "../../emu.h" #include "../../version.h" +#include "../../timer.h" #include "../../cpu/cpu.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../ui/ui.h" #include "../../plat.h" @@ -138,7 +138,7 @@ typedef struct { int bit32, cur_dev, irq; - int64_t callback; + tmrval_t callback; } ide_board_t; static ide_board_t *ide_boards[4]; @@ -150,7 +150,6 @@ int (*ide_bus_master_write)(int channel, uint8_t *data, int transfer_length, pri void (*ide_bus_master_set_irq)(int channel, priv_t priv); priv_t ide_bus_master_priv[2]; int ide_inited = 0; -int ide_sec_optional = 0; int ide_ter_enabled = 0, ide_qua_enabled = 0; static uint16_t ide_base_main[4] = { 0x1f0, 0x170, 0x168, 0x1e8 }; @@ -169,7 +168,7 @@ getstat(ide_t *ide) } -int64_t +tmrval_t ide_get_period(ide_t *ide, int size) { double period = 10.0 / 3.0; @@ -249,12 +248,12 @@ ide_get_period(ide_t *ide, int size) period *= (double) TIMER_USEC; period *= (double) size; - return (int64_t) period; + return (tmrval_t) period; } #if 0 -int64_t +tmrval_t ide_get_seek_time(ide_t *ide, uint32_t new_pos) { double dusec, time; @@ -276,7 +275,7 @@ ide_get_seek_time(ide_t *ide, uint32_t new_pos) t = ABS(t - nt); time += ((40000.0 * dusec) / ((double) ide->tracks)) * ((double) t); } - return (int64_t) time; + return (tmrval_t) time; } #endif @@ -954,7 +953,7 @@ ide_board_init(int board) void -ide_set_callback(uint8_t board, int64_t callback) +ide_set_callback(uint8_t board, tmrval_t callback) { ide_board_t *dev = ide_boards[board]; @@ -2395,7 +2394,7 @@ ide_clear_bus_master(void) } -void * +priv_t ide_xtide_init(void) { ide_board_t *dev; @@ -2445,16 +2444,6 @@ ide_set_bus_master(int (*read)(int channel, uint8_t *data, int transfer_length, } -void -secondary_ide_check(void) -{ - /* If secondary IDE is optional and the secondary master is not present or not ATAPI, - disable secondary IDE. */ - if (ide_sec_optional && (!ide_drives[4] || (ide_drives[4]->type != IDE_ATAPI))) - ide_remove_handlers(1); -} - - static priv_t ide_init(const device_t *info, void *parent) { @@ -2463,7 +2452,6 @@ ide_init(const device_t *info, void *parent) switch(info->local & 255) { case 0: /* ISA, single-channel */ case 2: /* ISA, dual-channel */ - case 3: /* ISA, dual-channel, optional 2nd channel */ case 4: /* VLB, single-channel */ case 6: /* VLB, dual-channel */ case 8: /* PCI, single-channel */ @@ -2510,8 +2498,6 @@ ide_init(const device_t *info, void *parent) ide_board_init(1); - ide_sec_optional = (info->local & 1); - ide_inited |= 2; } break; @@ -2615,16 +2601,6 @@ const device_t ide_isa_2ch_device = { NULL }; -const device_t ide_isa_2ch_opt_device = { - "PC/AT IDE Controller (Single/Dual)", - DEVICE_ISA | DEVICE_AT, - (HDD_BUS_IDE << 8) | 3, - NULL, - ide_init, ide_close, ide_reset, - NULL, NULL, NULL, NULL, - NULL -}; - const device_t ide_vlb_device = { "IDE Controller", DEVICE_VLB | DEVICE_AT, diff --git a/src/devices/disk/hdc_ide_xta.c b/src/devices/disk/hdc_ide_xta.c index 0bd642d..bf6d2ee 100644 --- a/src/devices/disk/hdc_ide_xta.c +++ b/src/devices/disk/hdc_ide_xta.c @@ -46,7 +46,7 @@ * * NOTE: The XTA interface is 0-based for sector numbers !! * - * Version: @(#)hdc_ide_xta.c 1.0.15 2019/05/13 + * Version: @(#)hdc_ide_xta.c 1.0.16 2019/05/17 * * Author: Fred N. van Kempen, * @@ -94,10 +94,10 @@ #include #define dbglog hdc_log #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../ui/ui.h" #include "../../plat.h" @@ -258,7 +258,8 @@ typedef struct { uint8_t sense; /* current SENSE ERROR value */ uint8_t status; /* current operational status */ uint8_t intr; - int64_t callback; + + tmrval_t callback; /* Data transfer. */ int16_t buf_idx, /* buffer index and pointer */ diff --git a/src/devices/disk/hdc_st506_at.c b/src/devices/disk/hdc_st506_at.c index 5460d7e..0797115 100644 --- a/src/devices/disk/hdc_st506_at.c +++ b/src/devices/disk/hdc_st506_at.c @@ -12,7 +12,7 @@ * based design. Most cards were WD1003-WA2 or -WAH, where the * -WA2 cards had a floppy controller as well (to save space.) * - * Version: @(#)hdc_st506_at.c 1.0.16 2019/05/13 + * Version: @(#)hdc_st506_at.c 1.0.17 2019/05/17 * * Authors: Fred N. van Kempen, * Sarah Walker, @@ -48,9 +48,9 @@ #include #define dbglog hdc_log #include "../../emu.h" +#include "../../timer.h" #include "../../cpu/cpu.h" #include "../../io.h" -#include "../../timer.h" #include "../../device.h" #include "../../ui/ui.h" #include "../../plat.h" @@ -119,7 +119,8 @@ typedef struct { pad; int pos; /* offset within data buffer */ - int64_t callback; /* callback delay timer */ + + tmrval_t callback; /* callback delay timer */ uint16_t buffer[256]; /* data buffer (16b wide) */ diff --git a/src/devices/disk/hdc_st506_xt.c b/src/devices/disk/hdc_st506_xt.c index 2c6f698..90e5c79 100644 --- a/src/devices/disk/hdc_st506_xt.c +++ b/src/devices/disk/hdc_st506_xt.c @@ -41,7 +41,7 @@ * Since all controllers (including the ones made by DTC) use * (mostly) the same API, we keep them all in this module. * - * Version: @(#)hdc_st506_xt.c 1.0.21 2019/05/13 + * Version: @(#)hdc_st506_xt.c 1.0.22 2019/05/17 * * Authors: Fred N. van Kempen, * Sarah Walker, @@ -77,10 +77,10 @@ #include #define dbglog hdc_log #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../ui/ui.h" #include "../../plat.h" @@ -252,7 +252,8 @@ typedef struct { uint8_t error; uint8_t status; int8_t cyl_off; /* for ST-11, cylinder0 offset */ - int64_t callback; + + tmrval_t callback; uint8_t command[6]; /* current command request */ int drive_sel; diff --git a/src/devices/disk/hdc_xtide.c b/src/devices/disk/hdc_xtide.c index 72e4cb9..a835d29 100644 --- a/src/devices/disk/hdc_xtide.c +++ b/src/devices/disk/hdc_xtide.c @@ -24,7 +24,7 @@ * FIXME: Make sure this works with the new IDE stuff, the AT and PS/2 * controllers do not have dev->ide set to anything... * - * Version: @(#)hdc_xtide.c 1.0.13 2019/05/13 + * Version: @(#)hdc_xtide.c 1.0.14 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -57,6 +57,7 @@ #include #define dbglog hdc_log #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" diff --git a/src/devices/disk/zip.c b/src/devices/disk/zip.c index a258a07..0ab5b62 100644 --- a/src/devices/disk/zip.c +++ b/src/devices/disk/zip.c @@ -9,7 +9,7 @@ * Implementation of the Iomega ZIP drive with SCSI(-like) * commands, for both ATAPI and SCSI usage. * - * Version: @(#)zip.c 1.0.25 2018/11/02 + * Version: @(#)zip.c 1.0.26 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -840,7 +840,7 @@ command_common(zip_t *dev) period = 1000000.0 / bytes_per_second; dusec = (double) TIMER_USEC; dusec = dusec * period * ((double)dev->packet_len); - dev->callback = (int64_t)dusec; + dev->callback = (tmrval_t)dusec; } set_callback(dev); diff --git a/src/devices/disk/zip.h b/src/devices/disk/zip.h index 044b158..c2f8ac6 100644 --- a/src/devices/disk/zip.h +++ b/src/devices/disk/zip.h @@ -9,7 +9,7 @@ * Implementation of the Iomega ZIP drive with SCSI(-like) * commands, for both ATAPI and SCSI usage. * - * Version: @(#)zip.h 1.0.12 2018/10/26 + * Version: @(#)zip.h 1.0.13 2019/05/17 * * Author: Miran Grca, * @@ -105,7 +105,7 @@ typedef struct { packet_len, pos, seek_pos; - int64_t callback; + tmrval_t callback; mode_sense_pages_t ms_pages_saved; diff --git a/src/devices/floppy/fdc.c b/src/devices/floppy/fdc.c index 10a53cb..07c7976 100644 --- a/src/devices/floppy/fdc.c +++ b/src/devices/floppy/fdc.c @@ -9,7 +9,7 @@ * Implementation of the NEC uPD-765 and compatible floppy disk * controller. * - * Version: @(#)fdc.c 1.0.23 2019/05/13 + * Version: @(#)fdc.c 1.0.24 2019/05/17 * * Authors: Miran Grca, * Sarah Walker, @@ -44,11 +44,11 @@ #define HAVE_STDARG_H #define dbglog fdc_log #include "../../emu.h" +#include "../../timer.h" #include "../../cpu/cpu.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../ui/ui.h" #include "../system/dma.h" diff --git a/src/devices/floppy/fdd_86f.c b/src/devices/floppy/fdd_86f.c index b2ea763..a70f161 100644 --- a/src/devices/floppy/fdd_86f.c +++ b/src/devices/floppy/fdd_86f.c @@ -10,7 +10,7 @@ * data in the form of FM/MFM-encoded transitions) which also * forms the core of the emulator's floppy disk emulation. * - * Version: @(#)fdd_86f.c 1.0.18 2019/04/08 + * Version: @(#)fdd_86f.c 1.0.19 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -45,7 +45,6 @@ #define HAVE_STDARG_H #define dbglog d86f_log #include "../../emu.h" -#include "../../nvr.h" #include "../../random.h" #include "../../ui/ui.h" #include "../../plat.h" diff --git a/src/devices/misc/isartc.c b/src/devices/misc/isartc.c index b420c82..3e1dc42 100644 --- a/src/devices/misc/isartc.c +++ b/src/devices/misc/isartc.c @@ -28,7 +28,7 @@ * NOTE: The IRQ functionalities have been implemented, but not yet * tested, as I need to write test software for them first :) * - * Version: @(#)isartc.c 1.0.9 2019/05/13 + * Version: @(#)isartc.c 1.0.10 2019/05/17 * * Author: Fred N. van Kempen, * @@ -72,6 +72,7 @@ #include #include "../../emu.h" #include "../../config.h" +#include "../../timer.h" #include "../../cpu/cpu.h" #include "../../io.h" #include "../../device.h" diff --git a/src/devices/scsi/scsi.c b/src/devices/scsi/scsi.c index abb57bd..3e64e04 100644 --- a/src/devices/scsi/scsi.c +++ b/src/devices/scsi/scsi.c @@ -8,7 +8,7 @@ * * Handling of the SCSI controllers. * - * Version: @(#)scsi.c 1.0.17 2019/05/03 + * Version: @(#)scsi.c 1.0.18 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -45,6 +45,7 @@ #define dbglog scsi_card_log #include "../../emu.h" #include "../../config.h" +#include "../../timer.h" #include "../../device.h" #include "../../plat.h" #include "../disk/hdc.h" diff --git a/src/devices/scsi/scsi_aha154x.c b/src/devices/scsi/scsi_aha154x.c index 0992462..7dc9c57 100644 --- a/src/devices/scsi/scsi_aha154x.c +++ b/src/devices/scsi/scsi_aha154x.c @@ -10,7 +10,7 @@ * made by Adaptec, Inc. These controllers were designed for * the ISA bus. * - * Version: @(#)scsi_aha154x.c 1.0.15 2019/05/05 + * Version: @(#)scsi_aha154x.c 1.0.16 2019/05/17 * * Based on original code from TheCollector1995 and Miran Grca. * @@ -46,12 +46,12 @@ #include #define dbglog scsi_card_log #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" #include "../../device.h" #include "../../nvr.h" -#include "../../timer.h" #include "../../plat.h" #include "../system/dma.h" #include "../system/pic.h" diff --git a/src/devices/scsi/scsi_buslogic.c b/src/devices/scsi/scsi_buslogic.c index 1754335..466b586 100644 --- a/src/devices/scsi/scsi_buslogic.c +++ b/src/devices/scsi/scsi_buslogic.c @@ -13,7 +13,7 @@ * 1 - BT-545S ISA; * 2 - BT-958D PCI * - * Version: @(#)scsi_buslogic.c 1.0.17 2019/05/05 + * Version: @(#)scsi_buslogic.c 1.0.18 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -47,10 +47,10 @@ #include #define dbglog scsi_card_log #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../nvr.h" #include "../../plat.h" diff --git a/src/devices/scsi/scsi_cdrom.c b/src/devices/scsi/scsi_cdrom.c index f713b83..92eef72 100644 --- a/src/devices/scsi/scsi_cdrom.c +++ b/src/devices/scsi/scsi_cdrom.c @@ -8,7 +8,7 @@ * * Emulation of SCSI (and ATAPI) CD-ROM drives. * - * Version: @(#)scsi_cdrom.c 1.0.12 2019/02/10 + * Version: @(#)scsi_cdrom.c 1.0.13 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -717,9 +717,9 @@ command_common(scsi_cdrom_t *dev) /* Seek time is in us. */ period = cdrom_seek_time(dev->drv); DEBUG("CD-ROM %i: Seek period: %" PRIu64 " us\n", - dev->id, (int64_t)period); + dev->id, (tmrval_t)period); period = period * ((double) TIMER_USEC); - dev->callback += ((int64_t) period); + dev->callback += ((tmrval_t)period); set_callback(dev); return; @@ -729,9 +729,9 @@ command_common(scsi_cdrom_t *dev) /* Seek time is in us. */ period = cdrom_seek_time(dev->drv); DEBUG("CD-ROM %i: Seek period: %" PRIu64 " us\n", - dev->id, (int64_t) period); + dev->id, (tmrval_t)period); period = period * ((double) TIMER_USEC); - dev->callback += ((int64_t) period); + dev->callback += ((tmrval_t)period); /*FALLTHROUGH*/ case 0x25: @@ -745,7 +745,7 @@ command_common(scsi_cdrom_t *dev) case 0xb9: case 0xbe: if (dev->current_cdb[0] == 0x42) - dev->callback += 200LL * CDROM_TIME; + dev->callback += (tmrval_t)200 * CDROM_TIME; /* Account for seek time. */ bytes_per_second = 176.0 * 1024.0; @@ -763,11 +763,11 @@ command_common(scsi_cdrom_t *dev) } period = 1000000.0 / bytes_per_second; - DEBUG("CD-ROM %i: Byte transfer period: %" PRIu64 " us\n", dev->id, (int64_t) period); + DEBUG("CD-ROM %i: Byte transfer period: %" PRIu64 " us\n", dev->id, (tmrval_t) period); period = period * (double) (dev->packet_len); - DEBUG("CD-ROM %i: Sector transfer period: %" PRIu64 " us\n", dev->id, (int64_t) period); + DEBUG("CD-ROM %i: Sector transfer period: %" PRIu64 " us\n", dev->id, (tmrval_t) period); dusec = period * ((double) TIMER_USEC); - dev->callback += ((int64_t) dusec); + dev->callback += ((tmrval_t) dusec); } set_callback(dev); diff --git a/src/devices/scsi/scsi_cdrom.h b/src/devices/scsi/scsi_cdrom.h index f8c4962..1c007bf 100644 --- a/src/devices/scsi/scsi_cdrom.h +++ b/src/devices/scsi/scsi_cdrom.h @@ -8,12 +8,12 @@ * * Definitions for the SCSI CD-ROM module. * - * Version: @(#)scsi_cdrom.h 1.0.3 2018/10/19 + * Version: @(#)scsi_cdrom.h 1.0.4 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, * - * Copyright 2017,2018 Fred N. van Kempen. + * Copyright 2017-2019 Fred N. van Kempen. * Copyright 2016-2018 Miran Grca. * * This program is free software; you can redistribute it and/or modify @@ -66,7 +66,7 @@ typedef struct { uint32_t sector_pos, sector_len, packet_len, pos; - int64_t callback; + tmrval_t callback; int media_status, data_pos, request_pos, total_read, @@ -83,7 +83,4 @@ typedef struct { #define scsi_cdrom_ascq dev->sense[13] -//extern void scsi_cdrom_reset(void *p); - - #endif /*EMU_SCSI_CDROM_H*/ diff --git a/src/devices/scsi/scsi_device.c b/src/devices/scsi/scsi_device.c index 4f4b799..ef87716 100644 --- a/src/devices/scsi/scsi_device.c +++ b/src/devices/scsi/scsi_device.c @@ -8,7 +8,7 @@ * * The generic SCSI device command handler. * - * Version: @(#)scsi_device.c 1.0.14 2019/04/23 + * Version: @(#)scsi_device.c 1.0.15 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #define HAVE_STDARG_H #define dbglog scsi_log #include "../../emu.h" +#include "../../timer.h" #include "../../device.h" #include "../disk/hdd.h" #include "scsi.h" @@ -89,7 +90,7 @@ target_err_stat_to_scsi(scsi_device_t *dev) } -int64_t +tmrval_t scsi_device_get_callback(scsi_device_t *dev) { scsi_device_data_t *sdd = (scsi_device_data_t *)dev->p; @@ -97,7 +98,7 @@ scsi_device_get_callback(scsi_device_t *dev) if (sdd) return sdd->callback; - return -1LL; + return (tmrval_t)-1; } diff --git a/src/devices/scsi/scsi_device.h b/src/devices/scsi/scsi_device.h index 3d67de5..94cfc4c 100644 --- a/src/devices/scsi/scsi_device.h +++ b/src/devices/scsi/scsi_device.h @@ -8,12 +8,12 @@ * * Definitions for the generic SCSI device command handler. * - * Version: @(#)scsi_device.h 1.0.7 2019/04/23 + * Version: @(#)scsi_device.h 1.0.8 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, * - * Copyright 2017,2018 Fred N. van Kempen. + * Copyright 2017-2019 Fred N. van Kempen. * Copyright 2016-2018 Miran Grca. * * This program is free software; you can redistribute it and/or modify @@ -343,7 +343,7 @@ typedef struct { uint32_t sector_pos, sector_len, packet_len, pos; - int64_t callback; + tmrval_t callback; } scsi_device_data_t; @@ -359,7 +359,7 @@ extern int mode_select_terminate(int force); extern int mode_select_write(uint8_t val); extern uint8_t *scsi_device_sense(scsi_device_t *dev); -extern int64_t scsi_device_get_callback(scsi_device_t *dev); +extern tmrval_t scsi_device_get_callback(scsi_device_t *dev); extern void scsi_device_request_sense(scsi_device_t *dev, uint8_t *buffer, uint8_t alloc_length); diff --git a/src/devices/scsi/scsi_disk.c b/src/devices/scsi/scsi_disk.c index 4c3b2ca..b4fcac3 100644 --- a/src/devices/scsi/scsi_disk.c +++ b/src/devices/scsi/scsi_disk.c @@ -12,7 +12,7 @@ * until this is fixed, we return the actual device properties, * and keep the sense data unmodifyable. * - * Version: @(#)scsi_disk.c 1.0.23 2019/04/23 + * Version: @(#)scsi_disk.c 1.0.24 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, diff --git a/src/devices/scsi/scsi_disk.h b/src/devices/scsi/scsi_disk.h index ea667c8..8a8e555 100644 --- a/src/devices/scsi/scsi_disk.h +++ b/src/devices/scsi/scsi_disk.h @@ -8,12 +8,12 @@ * * Emulation of SCSI fixed and removable disks. * - * Version: @(#)scsi_disk.h 1.0.6 2018/10/25 + * Version: @(#)scsi_disk.h 1.0.7 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, * - * Copyright 2017,2018 Fred N. van Kempen. + * Copyright 2017-2019 Fred N. van Kempen. * Copyright 2016-2018 Miran Grca. * * This program is free software; you can redistribute it and/or modify @@ -63,7 +63,7 @@ typedef struct { uint32_t sector_pos, sector_len, packet_len, pos; - int64_t callback; + tmrval_t callback; } scsi_disk_t; diff --git a/src/devices/scsi/scsi_ncr5380.c b/src/devices/scsi/scsi_ncr5380.c index eb0c980..5b497c8 100644 --- a/src/devices/scsi/scsi_ncr5380.c +++ b/src/devices/scsi/scsi_ncr5380.c @@ -11,7 +11,7 @@ * * NOTE: This code now only supports targets at LUN=0 !! * - * Version: @(#)scsi_ncr5380.c 1.0.18 2019/05/13 + * Version: @(#)scsi_ncr5380.c 1.0.19 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -48,12 +48,12 @@ #include #define dbglog scsi_card_log #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" #include "../../device.h" #include "../../nvr.h" -#include "../../timer.h" #include "../../plat.h" #include "../system/dma.h" #include "../system/pic.h" @@ -159,8 +159,8 @@ typedef struct { int buffer_pos; int buffer_host_pos; - int64_t timer_period; - int64_t timer_enabled; + tmrval_t timer_period; + tmrval_t timer_enabled; double period; ncr_t ncr; @@ -327,7 +327,7 @@ ncr_callback(void *priv) ncr_t *ncr = &ncr_dev->ncr; scsi_device_t *dev = &scsi_devices[ncr->target_id][ncr->target_lun]; int req_len, c = 0; - int64_t p; + tmrval_t p; uint8_t temp, data; DEBUG("NCR: DMA mode=%d\n", ncr->dma_mode); @@ -335,7 +335,7 @@ ncr_callback(void *priv) ncr_dev->timer_enabled = 0; if (((ncr->state == STATE_DATAIN) || (ncr->state == STATE_DATAOUT)) && (ncr->dma_mode != DMA_IDLE)) - ncr_dev->timer_period = (int64_t) ncr_dev->period; + ncr_dev->timer_period = (tmrval_t) ncr_dev->period; else ncr_dev->timer_period += 40LL * TIMER_USEC; diff --git a/src/devices/scsi/scsi_ncr53c810.c b/src/devices/scsi/scsi_ncr53c810.c index f34aecb..53cbe01 100644 --- a/src/devices/scsi/scsi_ncr53c810.c +++ b/src/devices/scsi/scsi_ncr53c810.c @@ -10,7 +10,7 @@ * NCR and later Symbios and LSI. This controller was designed * for the PCI bus. * - * Version: @(#)scsi_ncr53c810.c 1.0.16 2019/05/13 + * Version: @(#)scsi_ncr53c810.c 1.0.17 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -48,10 +48,10 @@ #include #define dbglog scsi_card_log #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../nvr.h" #include "../../plat.h" @@ -300,8 +300,8 @@ typedef struct { uint8_t regop; uint32_t adder; - int64_t timer_period; - int64_t timer_enabled; + tmrval_t timer_period; + tmrval_t timer_enabled; } ncr53c810_t; @@ -685,7 +685,7 @@ ncr53c810_do_command(ncr53c810_t *dev, uint8_t id) scsi_device_t *sd; uint8_t buf[12]; double period; - int64_t p; + tmrval_t p; memset(buf, 0, 12); DMAPageRead(dev->dnad, buf, MIN(12, dev->dbc)); @@ -730,7 +730,7 @@ ncr53c810_do_command(ncr53c810_t *dev, uint8_t id) p = scsi_device_get_callback(sd); if (p <= 0LL) { period = ((double) sd->buffer_length) * 0.1 * ((double) TIMER_USEC); /* Fast SCSI: 10000000 bytes per second */ - dev->timer_period += (int64_t) period; + dev->timer_period += (tmrval_t) period; } else dev->timer_period += p; return(1); @@ -740,7 +740,7 @@ ncr53c810_do_command(ncr53c810_t *dev, uint8_t id) p = scsi_device_get_callback(sd); if (p <= 0LL) { period = ((double) sd->buffer_length) * 0.1 * ((double) TIMER_USEC); /* Fast SCSI: 10000000 bytes per second */ - dev->timer_period += (int64_t) period; + dev->timer_period += (tmrval_t) period; } else dev->timer_period += p; return(1); diff --git a/src/devices/scsi/scsi_x54x.c b/src/devices/scsi/scsi_x54x.c index f661c82..684db59 100644 --- a/src/devices/scsi/scsi_x54x.c +++ b/src/devices/scsi/scsi_x54x.c @@ -12,7 +12,7 @@ * * These controllers were designed for various buses. * - * Version: @(#)scsi_x54x.c 1.0.18 2019/05/13 + * Version: @(#)scsi_x54x.c 1.0.19 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -47,10 +47,10 @@ #include #define dbglog scsi_card_log #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../nvr.h" #include "../../plat.h" @@ -595,7 +595,7 @@ cmd_done(x54x_t *dev, int suppress) static void add_to_period(x54x_t *dev, int TransferLength) { - dev->temp_period += (int64_t)TransferLength; + dev->temp_period += (tmrval_t)TransferLength; } @@ -956,7 +956,7 @@ scsi_cmd(x54x_t *dev) int target_data_len, target_cdb_len = 12; uint8_t temp_cdb[12]; int32_t *BufLen; - int64_t p; + tmrval_t p; scsi_device_t *sd; sd = &scsi_devices[req->TargetID][req->LUN]; @@ -1299,7 +1299,7 @@ cmd_callback(priv_t priv) } period = (1000000.0 / dev->ha_bps) * ((double) TIMER_USEC) * ((double) dev->temp_period); - dev->timer_period = dev->media_period + ((int64_t) period) + (40LL * TIMER_USEC); + dev->timer_period = dev->media_period + ((tmrval_t) period) + (40LL * TIMER_USEC); DEBUG("Temporary period: %" PRId64 " us (%" PRIi64 " periods)\n", dev->timer_period, dev->temp_period); diff --git a/src/devices/scsi/scsi_x54x.h b/src/devices/scsi/scsi_x54x.h index 5c65515..7f1d07e 100644 --- a/src/devices/scsi/scsi_x54x.h +++ b/src/devices/scsi/scsi_x54x.h @@ -8,7 +8,7 @@ * * Definitions for the common AHA/BL code. * - * Version: @(#)scsi_x54x.h 1.0.8 2019/05/13 + * Version: @(#)scsi_x54x.h 1.0.9 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -379,23 +379,23 @@ typedef struct { typedef struct { int8_t type; /* type of device */ - char vendor[16]; /* name of device vendor */ - char name[16]; /* name of device */ - - int64_t timer_period, temp_period; - uint8_t callback_phase; - int64_t media_period; - double ha_bps; /* bytes per second */ - int8_t Irq; - uint8_t IrqEnabled; - int8_t DmaChannel; int8_t HostID; uint32_t Base; + uint8_t IrqEnabled; + const wchar_t *bios_path; /* path to BIOS image file */ + + char name[16]; /* name of device */ + char vendor[16]; /* name of device vendor */ + + tmrval_t timer_period, + temp_period; + tmrval_t media_period; + double ha_bps; /* bytes per second */ + uint8_t pos_regs[8]; /* MCA */ - const wchar_t *bios_path; /* path to BIOS image file */ uint32_t rom_addr; /* address of BIOS ROM */ uint16_t rom_ioaddr; /* offset in BIOS of I/O addr */ uint16_t rom_shram; /* index to shared RAM */ @@ -409,12 +409,14 @@ typedef struct { wchar_t *nvr_path; /* path to NVR image file */ uint8_t *nvr; /* EEPROM buffer */ - int64_t ResetCB; + tmrval_t ResetCB; volatile uint8_t /* for multi-threading, keep */ Status, /* these volatile */ Interrupt; + uint8_t callback_phase; + Req_t Req; uint8_t Geometry; uint8_t Control; diff --git a/src/devices/sio/sio_acc3221.c b/src/devices/sio/sio_acc3221.c index 91c9aa0..b4ccf7e 100644 --- a/src/devices/sio/sio_acc3221.c +++ b/src/devices/sio/sio_acc3221.c @@ -8,7 +8,7 @@ * * Implementation of the ACC 3221 Super I/O Chip. * - * Version: @(#)sio_acc3221.c 1.0.2 2019/05/13 + * Version: @(#)sio_acc3221.c 1.0.3 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../device.h" #include "../system/pci.h" diff --git a/src/devices/sio/sio_fdc37c669.c b/src/devices/sio/sio_fdc37c669.c index 3086745..e17775a 100644 --- a/src/devices/sio/sio_fdc37c669.c +++ b/src/devices/sio/sio_fdc37c669.c @@ -8,7 +8,7 @@ * * Implementation of the SMC FDC37C669 Super I/O Chip. * - * Version: @(#)sio_fdc37c669.c 1.0.12 2019/05/13 + * Version: @(#)sio_fdc37c669.c 1.0.13 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -48,7 +48,6 @@ #include "../floppy/fdd.h" #include "../floppy/fdc.h" #include "../disk/hdc.h" -#include "../disk/hdc_ide.h" #include "../../plat.h" #include "sio.h" diff --git a/src/devices/sio/sio_fdc37c66x.c b/src/devices/sio/sio_fdc37c66x.c index d330d43..7002da0 100644 --- a/src/devices/sio/sio_fdc37c66x.c +++ b/src/devices/sio/sio_fdc37c66x.c @@ -9,7 +9,7 @@ * Implementation of the SMC FDC37C663 and FDC37C665 Super * I/O Chips. * - * Version: @(#)sio_fdc37c66x.c 1.0.12 2019/05/13 + * Version: @(#)sio_fdc37c66x.c 1.0.13 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -51,7 +51,6 @@ #include "../floppy/fdd.h" #include "../floppy/fdc.h" #include "../disk/hdc.h" -#include "../disk/hdc_ide.h" #include "../../plat.h" #include "sio.h" diff --git a/src/devices/sio/sio_fdc37c93x.c b/src/devices/sio/sio_fdc37c93x.c index e880e4b..a03e53d 100644 --- a/src/devices/sio/sio_fdc37c93x.c +++ b/src/devices/sio/sio_fdc37c93x.c @@ -9,7 +9,7 @@ * Implementation of the SMC FDC37C932FR and FDC37C935 Super * I/O Chips. * - * Version: @(#)sio_fdc37c93x.c 1.0.14 2019/05/13 + * Version: @(#)sio_fdc37c93x.c 1.0.15 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -49,7 +49,6 @@ #include "../floppy/fdd.h" #include "../floppy/fdc.h" #include "../disk/hdc.h" -#include "../disk/hdc_ide.h" #include "../../plat.h" #include "sio.h" diff --git a/src/devices/sio/sio_pc87306.c b/src/devices/sio/sio_pc87306.c index 47ff829..53e5b2a 100644 --- a/src/devices/sio/sio_pc87306.c +++ b/src/devices/sio/sio_pc87306.c @@ -8,7 +8,7 @@ * * Emulation of the NatSemi PC87306 Super I/O chip. * - * Version: @(#)sio_pc87306.c 1.0.12 2019/05/13 + * Version: @(#)sio_pc87306.c 1.0.13 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -48,7 +48,6 @@ #include "../floppy/fdd.h" #include "../floppy/fdc.h" #include "../disk/hdc.h" -#include "../disk/hdc_ide.h" #include "../../plat.h" #include "sio.h" diff --git a/src/devices/sound/nukedopl.h b/src/devices/sound/nukedopl.h index 1400ca0..73c8fd8 100644 --- a/src/devices/sound/nukedopl.h +++ b/src/devices/sound/nukedopl.h @@ -8,14 +8,14 @@ * * Definitions for the NukedOPL3 driver. * - * Version: @(#)nukedopl.h 1.0.2 2018/09/04 + * Version: @(#)nukedopl.h 1.0.3 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, * Sarah Walker, * Alexey Khokholov (Nuke.YKT) * - * Copyright 2017,2018 Fred N. van Kempen. + * Copyright 2017-2019 Fred N. van Kempen. * Copyright 2016-2018 Miran Grca. * Copyright 2008-2018 Sarah Walker. * Copyright 2013-2018 Alexey Khokholov. diff --git a/src/devices/sound/snd_ad1848.c b/src/devices/sound/snd_ad1848.c index 06cf538..c8ab8f3 100644 --- a/src/devices/sound/snd_ad1848.c +++ b/src/devices/sound/snd_ad1848.c @@ -8,7 +8,7 @@ * * Emulation of the AD1848 (Windows Sound System) CODEC. * - * Version: @(#)snd_ad1848.c 1.0.7 2019/04/25 + * Version: @(#)snd_ad1848.c 1.0.8 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -63,9 +63,9 @@ void ad1848_setdma(ad1848_t *ad1848, int dma_ch) ad1848->dma = dma_ch; } -uint8_t ad1848_read(uint16_t addr, void *p) +uint8_t ad1848_read(uint16_t addr, priv_t priv) { - ad1848_t *ad1848 = (ad1848_t *)p; + ad1848_t *ad1848 = (ad1848_t *)priv; uint8_t temp = 0xff; switch (addr & 3) { @@ -82,9 +82,9 @@ uint8_t ad1848_read(uint16_t addr, void *p) return temp; } -void ad1848_write(uint16_t addr, uint8_t val, void *p) +void ad1848_write(uint16_t addr, uint8_t val, priv_t priv) { - ad1848_t *ad1848 = (ad1848_t *)p; + ad1848_t *ad1848 = (ad1848_t *)priv; double freq; switch (addr & 3) { @@ -148,9 +148,9 @@ void ad1848_update(ad1848_t *ad1848) } } -static void ad1848_poll(void *p) +static void ad1848_poll(priv_t priv) { - ad1848_t *ad1848 = (ad1848_t *)p; + ad1848_t *ad1848 = (ad1848_t *)priv; if (ad1848->timer_latch) ad1848->timer_count += ad1848->timer_latch; diff --git a/src/devices/sound/snd_ad1848.h b/src/devices/sound/snd_ad1848.h index 833e187..4edb086 100644 --- a/src/devices/sound/snd_ad1848.h +++ b/src/devices/sound/snd_ad1848.h @@ -8,13 +8,13 @@ * * Definitions for the AD1848 driver. * - * Version: @(#)snd_ad1848.h 1.0.1 2018/02/14 + * Version: @(#)snd_ad1848.h 1.0.2 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, * Sarah Walker, * - * Copyright 2017,2018 Fred N. van Kempen. + * Copyright 2017-2019 Fred N. van Kempen. * Copyright 2016-2018 Miran Grca. * Copyright 2008-2018 Sarah Walker. * @@ -53,13 +53,13 @@ typedef struct ad1848_t int16_t out_l, out_r; - int64_t enable; + tmrval_t enable; int irq, dma; - int64_t freq; + tmrval_t freq; - int64_t timer_count, timer_latch; + tmrval_t timer_count, timer_latch; int16_t buffer[SOUNDBUFLEN * 2]; int pos; @@ -68,8 +68,8 @@ typedef struct ad1848_t void ad1848_setirq(ad1848_t *ad1848, int irq); void ad1848_setdma(ad1848_t *ad1848, int dma); -uint8_t ad1848_read(uint16_t addr, void *p); -void ad1848_write(uint16_t addr, uint8_t val, void *p); +uint8_t ad1848_read(uint16_t addr, priv_t); +void ad1848_write(uint16_t addr, uint8_t val, priv_t); void ad1848_update(ad1848_t *ad1848); void ad1848_speed_changed(ad1848_t *ad1848); diff --git a/src/devices/sound/snd_adlib.c b/src/devices/sound/snd_adlib.c index 91e10ed..ec12051 100644 --- a/src/devices/sound/snd_adlib.c +++ b/src/devices/sound/snd_adlib.c @@ -8,7 +8,7 @@ * * Implementation of the ADLIB sound device. * - * Version: @(#)snd_adlib.c 1.0.10 2019/05/13 + * Version: @(#)snd_adlib.c 1.0.11 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -43,6 +43,7 @@ #include #define dbglog sound_card_log #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../device.h" #include "../../plat.h" diff --git a/src/devices/sound/snd_adlibgold.c b/src/devices/sound/snd_adlibgold.c index 8129205..7df44ce 100644 --- a/src/devices/sound/snd_adlibgold.c +++ b/src/devices/sound/snd_adlibgold.c @@ -10,7 +10,7 @@ * * TODO: Stack allocation of big buffers (line 688 et al.) * - * Version: @(#)snd_adlibgold.c 1.0.14 2019/05/13 + * Version: @(#)snd_adlibgold.c 1.0.15 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -45,8 +45,8 @@ #include #define dbglog sound_card_log #include "../../emu.h" -#include "../../io.h" #include "../../timer.h" +#include "../../io.h" #include "../../device.h" #include "../../nvr.h" #include "../../plat.h" @@ -78,7 +78,7 @@ typedef struct { int16_t adgold_mma_out[2]; int adgold_mma_intpos[2]; - int64_t adgold_mma_timer_count; + tmrval_t adgold_mma_timer_count; struct { int timer0_latch, timer0_count; @@ -618,7 +618,7 @@ void adgold_timer_poll(priv_t priv) while (adgold->adgold_mma_timer_count <= 0LL) { - adgold->adgold_mma_timer_count += (int64_t)((double)TIMER_USEC * 1.88964); + adgold->adgold_mma_timer_count += (tmrval_t)((double)TIMER_USEC * 1.88964); if (adgold->adgold_mma_regs[0][8] & 0x01) /*Timer 0*/ { adgold->adgold_mma.timer0_count--; diff --git a/src/devices/sound/snd_audiopci.c b/src/devices/sound/snd_audiopci.c index fdc5e9d..c5f12ac 100644 --- a/src/devices/sound/snd_audiopci.c +++ b/src/devices/sound/snd_audiopci.c @@ -8,7 +8,7 @@ * * Implementation of the AudioPCI sound device. * - * Version: @(#)snd_audiopci.c 1.0.18 2019/05/13 + * Version: @(#)snd_audiopci.c 1.0.19 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -43,10 +43,10 @@ #include #define dbglog sound_card_log #include "../../emu.h" +#include "../../timer.h" #include "../../cpu/cpu.h" /* for the debugging stuff */ #include "../../io.h" #include "../../mem.h" -#include "../../timer.h" #include "../../device.h" #include "../../plat.h" #include "../system/nmi.h" @@ -93,7 +93,7 @@ typedef struct { uint16_t samp_ct, curr_samp_ct; - int64_t time, latch; + tmrval_t time, latch; uint32_t vf, ac; @@ -108,7 +108,7 @@ typedef struct { int32_t vol_l, vol_r; } dac[2], adc; - int64_t dac_latch, dac_time; + tmrval_t dac_latch, dac_time; int master_vol_l, master_vol_r; diff --git a/src/devices/sound/snd_cs423x.c b/src/devices/sound/snd_cs423x.c index 6736da5..a9a9f88 100644 --- a/src/devices/sound/snd_cs423x.c +++ b/src/devices/sound/snd_cs423x.c @@ -8,7 +8,7 @@ * * Implementation of Cirrus Logic Crystal 423x sound devices. * - * Version: @(#)snd_cs423x.c 1.0.3 2019/04/25 + * Version: @(#)snd_cs423x.c 1.0.4 2019/05/17 * * Authors: Altheos, * Fred N. van Kempen, @@ -54,9 +54,9 @@ #include #define dbglog sound_card_log #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../device.h" -#include "../../timer.h" #include "../system/dma.h" #include "../system/pic.h" #include "sound.h" @@ -89,7 +89,7 @@ cs423x_setdma(cs423x_t *dev, int dma_ch) uint8_t -cs423x_read(uint16_t addr, void *priv) +cs423x_read(uint16_t addr, priv_t priv) { cs423x_t *dev = (cs423x_t *)priv; uint8_t ret = 0xff; @@ -126,7 +126,7 @@ cs423x_read(uint16_t addr, void *priv) void -cs423x_write(uint16_t addr, uint8_t val, void *priv) +cs423x_write(uint16_t addr, uint8_t val, priv_t priv) { cs423x_t *dev = (cs423x_t *)priv; double freq; @@ -154,8 +154,8 @@ cs423x_write(uint16_t addr, uint8_t val, void *priv) case 6: freq /= 512; break; case 7: freq /= 2560; break; } - dev->freq = (int64_t)freq; - dev->timer_latch = (int64_t)((double)TIMER_USEC * (1000000.0 / (double)dev->freq)); + dev->freq = (tmrval_t)freq; + dev->timer_latch = (tmrval_t)((double)TIMER_USEC * (1000000.0 / (double)dev->freq)); break; case 9: @@ -208,7 +208,7 @@ cs423x_update(cs423x_t *dev) static void -cs423x_poll(void *priv) +cs423x_poll(priv_t priv) { cs423x_t *dev = (cs423x_t *)priv; int32_t temp; @@ -356,5 +356,5 @@ cs423x_init(cs423x_t *dev) void cs423x_speed_changed(cs423x_t *dev) { - dev->timer_latch = (int64_t)((double)TIMER_USEC * (1000000.0 / (double)dev->freq)); + dev->timer_latch = (tmrval_t)((double)TIMER_USEC * (1000000.0 / (double)dev->freq)); } diff --git a/src/devices/sound/snd_cs423x.h b/src/devices/sound/snd_cs423x.h index 68ee787..dc2251c 100644 --- a/src/devices/sound/snd_cs423x.h +++ b/src/devices/sound/snd_cs423x.h @@ -8,7 +8,7 @@ * * Definitions for the Crystal CS423x driver. * - * Version: @(#)snd_cs423x.h 1.0.1 2019/01/13 + * Version: @(#)snd_cs423x.h 1.0.2 2019/05/17 * * Authors: Altheos, * Fred N. van Kempen, @@ -65,13 +65,12 @@ typedef struct { int16_t out_l, out_r; - int64_t enable; - int irq, dma; - int64_t freq; + tmrval_t freq; - int64_t timer_count, + tmrval_t enable; + tmrval_t timer_count, timer_latch; int16_t buffer[SOUNDBUFLEN * 2]; diff --git a/src/devices/sound/snd_dbopl.cpp b/src/devices/sound/snd_dbopl.cpp index 45a0fad..2cbbd87 100644 --- a/src/devices/sound/snd_dbopl.cpp +++ b/src/devices/sound/snd_dbopl.cpp @@ -10,7 +10,7 @@ * * NOTE: See MSC_ macros for allocation on stack. --FvK * - * Version: @(#)snd_dbopl.cpp 1.0.9 2019/05/03 + * Version: @(#)snd_dbopl.cpp 1.0.10 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -45,6 +45,7 @@ #define dbglog sound_log #include "../../emu.h" #include "../../config.h" +#include "../../timer.h" #include "dbopl.h" #include "nukedopl.h" #include "sound.h" @@ -62,8 +63,8 @@ static struct uint8_t status; int is_opl3; - void (*timer_callback)(void *param, int timer, int64_t period); - void *timer_param; + void (*timer_callback)(priv_t param, int timer, tmrval_t period); + priv_t timer_param; } opl[2]; enum @@ -82,7 +83,7 @@ enum CTRL_TIMER1_CTRL = 0x01 }; -void opl_init(void (*timer_callback)(void *param, int timer, int64_t period), void *timer_param, int nr, int is_opl3) +void opl_init(void (*timer_callback)(priv_t param, int timer, tmrval_t period), priv_t timer_param, int nr, int is_opl3) { opl[nr].timer_callback = timer_callback; opl[nr].timer_param = timer_param; diff --git a/src/devices/sound/snd_emu8k.c b/src/devices/sound/snd_emu8k.c index 5693607..9b96c06 100644 --- a/src/devices/sound/snd_emu8k.c +++ b/src/devices/sound/snd_emu8k.c @@ -8,7 +8,7 @@ * * Implementation of Emu8000 emulator. * - * Version: @(#)snd_emu8k.c 1.0.15 2019/05/13 + * Version: @(#)snd_emu8k.c 1.0.16 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -46,10 +46,10 @@ #include #define dbglog sound_card_log #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../plat.h" #include "sound.h" @@ -210,7 +210,7 @@ static const int32_t env_decay_to_millis[128] = { /* Table represeting the LFO waveform (signed 16bits with 32768 max int. >> 15 to move back to +/-1 range). */ static int32_t *lfotable; /* Table to transform the speed parameter to emu8k_mem_internal_t range. */ -static int64_t *lfofreqtospeed; +static tmrval_t *lfofreqtospeed; /* LFO used for the chorus. a sine wave.(signed 16bits with 32768 max int. >> 15 to move back to +/-1 range). */ static double *chortable; @@ -2187,7 +2187,7 @@ void emu8k_init(emu8k_t *emu8k, const wchar_t *romfile, uint16_t emu_addr, int o env_mod_hertz_to_octave = (int32_t *)mem_alloc(65537*sizeof(int32_t)); env_attack_to_samples = (int32_t *)mem_alloc(128*sizeof(int32_t)); lfotable = (int32_t *)mem_alloc(65536*sizeof(int32_t)); - lfofreqtospeed = (int64_t *)mem_alloc(256*sizeof(int64_t)); + lfofreqtospeed = (tmrval_t *)mem_alloc(256*sizeof(tmrval_t)); chortable = (double *)mem_alloc(65536*sizeof(double)); int j=0; diff --git a/src/devices/sound/snd_emu8k.h b/src/devices/sound/snd_emu8k.h index b2c7f6a..12a5f61 100644 --- a/src/devices/sound/snd_emu8k.h +++ b/src/devices/sound/snd_emu8k.h @@ -8,13 +8,13 @@ * * Definitions for the Emu8K emulator. * - * Version: @(#)snd_emu8k.h 1.0.2 2018/09/22 + * Version: @(#)snd_emu8k.h 1.0.3 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, * Sarah Walker, * - * Copyright 2017,2018 Fred N. van Kempen. + * Copyright 2017-2019 Fred N. van Kempen. * Copyright 2016-2018 Miran Grca. * Copyright 2008-2018 Sarah Walker. * @@ -366,7 +366,7 @@ typedef struct emu8k_voice_t emu8k_envelope_t vol_envelope; emu8k_envelope_t mod_envelope; - int64_t lfo1_speed, lfo2_speed; + tmrval_t lfo1_speed, lfo2_speed; emu8k_mem_internal_t lfo1_count, lfo2_count; int32_t lfo1_delay_samples, lfo2_delay_samples; int vol_l, vol_r; diff --git a/src/devices/sound/snd_gus.c b/src/devices/sound/snd_gus.c index 5da46dd..336afa8 100644 --- a/src/devices/sound/snd_gus.c +++ b/src/devices/sound/snd_gus.c @@ -8,7 +8,7 @@ * * Implementation of the Gravis UltraSound sound device. * - * Version: @(#)snd_gus.c 1.0.14 2019/05/13 + * Version: @(#)snd_gus.c 1.0.15 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -43,8 +43,8 @@ #include #define dbglog sound_card_log #include "../../emu.h" -#include "../../io.h" #include "../../timer.h" +#include "../../io.h" #include "../../device.h" #include "../../plat.h" #include "../system/dma.h" @@ -120,7 +120,7 @@ typedef struct { int32_t out_l, out_r; - int64_t samp_timer, + tmrval_t samp_timer, samp_latch; uint8_t *ram; @@ -130,7 +130,7 @@ typedef struct { int irqnext; - int64_t timer_1, + tmrval_t timer_1, timer_2; int irq, @@ -1183,7 +1183,7 @@ gus_init(const device_t *info, UNUSED(void *parent)) dev->voices = 14; - dev->samp_timer = dev->samp_latch = (int64_t)(TIMER_USEC * (1000000.0 / 44100.0)); + dev->samp_timer = dev->samp_latch = (tmrval_t)(TIMER_USEC * (1000000.0 / 44100.0)); dev->t1l = dev->t2l = 0xff; diff --git a/src/devices/sound/snd_lpt_dac.c b/src/devices/sound/snd_lpt_dac.c index 6a57a70..d29c821 100644 --- a/src/devices/sound/snd_lpt_dac.c +++ b/src/devices/sound/snd_lpt_dac.c @@ -8,7 +8,7 @@ * * Implemantation of LPT-based sound devices. * - * Version: @(#)snd_lpt_dac.c 1.0.10 2019/04/11 + * Version: @(#)snd_lpt_dac.c 1.0.11 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -43,8 +43,8 @@ #include #define dbglog sound_card_log #include "../../emu.h" -#include "../../cpu/cpu.h" #include "../../timer.h" +#include "../../cpu/cpu.h" #include "../ports/parallel_dev.h" #include "sound.h" #include "filters.h" @@ -76,7 +76,7 @@ dac_update(lpt_dac_t *dev) static void -dac_write_data(uint8_t val, void *priv) +write_data(uint8_t val, priv_t priv) { lpt_dac_t *dev = (lpt_dac_t *)priv; @@ -96,7 +96,7 @@ dac_write_data(uint8_t val, void *priv) static void -dac_write_ctrl(uint8_t val, void *priv) +write_ctrl(uint8_t val, priv_t priv) { lpt_dac_t *dev = (lpt_dac_t *)priv; @@ -106,14 +106,14 @@ dac_write_ctrl(uint8_t val, void *priv) static uint8_t -dac_read_status(void *priv) +read_status(priv_t priv) { return(0x00); } static void -dac_get_buffer(int32_t *buffer, int len, void *priv) +get_buffer(int32_t *buffer, int len, priv_t priv) { lpt_dac_t *dev = (lpt_dac_t *)priv; int c; @@ -129,13 +129,12 @@ dac_get_buffer(int32_t *buffer, int len, void *priv) } -static void * +static priv_t dac_init(const lpt_device_t *info) { lpt_dac_t *dev; - INFO("SOUND: LPT device '%s' [%d] initializing!\n", - info->name, info->type); + INFO("SOUND: LPT device '%s' [%d] initializing!\n", info->name, info->type); dev = (lpt_dac_t *)mem_alloc(sizeof(lpt_dac_t)); memset(dev, 0x00, sizeof(lpt_dac_t)); @@ -147,14 +146,14 @@ dac_init(const lpt_device_t *info) break; } - sound_add_handler(dac_get_buffer, dev); + sound_add_handler(get_buffer, (priv_t)dev); - return(dev); + return((priv_t)dev); } static void -dac_close(void *priv) +dac_close(priv_t priv) { lpt_dac_t *dev = (lpt_dac_t *)priv; @@ -169,9 +168,9 @@ const lpt_device_t lpt_dac_device = { 0, dac_init, dac_close, - dac_write_data, - dac_write_ctrl, - dac_read_status + write_data, + write_ctrl, + read_status }; const lpt_device_t lpt_dac_stereo_device = { @@ -179,7 +178,7 @@ const lpt_device_t lpt_dac_stereo_device = { 1, dac_init, dac_close, - dac_write_data, - dac_write_ctrl, - dac_read_status + write_data, + write_ctrl, + read_status }; diff --git a/src/devices/sound/snd_lpt_dss.c b/src/devices/sound/snd_lpt_dss.c index 659c49a..d8b1420 100644 --- a/src/devices/sound/snd_lpt_dss.c +++ b/src/devices/sound/snd_lpt_dss.c @@ -8,7 +8,7 @@ * * Implementation of the LPT-based DSS sound device. * - * Version: @(#)snd_lpt_dss.c 1.0.11 2019/04/25 + * Version: @(#)snd_lpt_dss.c 1.0.12 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -43,8 +43,8 @@ #include #define dbglog sound_card_log #include "../../emu.h" -#include "../../cpu/cpu.h" #include "../../timer.h" +#include "../../cpu/cpu.h" #include "../ports/parallel_dev.h" #include "sound.h" #include "filters.h" @@ -58,7 +58,7 @@ typedef struct { uint8_t dac_val; - int64_t time; + tmrval_t time; int16_t buffer[SOUNDBUFLEN]; int pos; @@ -76,7 +76,7 @@ dss_update(dss_t *dev) static void -dss_write_data(uint8_t val, void *priv) +write_data(uint8_t val, priv_t priv) { dss_t *dev = (dss_t *)priv; @@ -90,24 +90,25 @@ dss_write_data(uint8_t val, void *priv) static void -dss_write_ctrl(uint8_t val, void *priv) +write_ctrl(uint8_t val, priv_t priv) { } static uint8_t -dss_read_status(void *priv) +read_status(priv_t priv) { dss_t *dev = (dss_t *)priv; if ((dev->write_idx - dev->read_idx) >= 16) - return 0x40; + return 0x40; + return 0; } static void -dss_get_buffer(int32_t *buffer, int len, void *priv) +get_buffer(int32_t *buffer, int len, priv_t priv) { dss_t *dev = (dss_t *)priv; int16_t val; @@ -127,7 +128,7 @@ dss_get_buffer(int32_t *buffer, int len, void *priv) static void -dss_callback(void *priv) +dss_callback(priv_t priv) { dss_t *dev = (dss_t *)priv; @@ -138,11 +139,11 @@ dss_callback(void *priv) dev->read_idx++; } - dev->time += (int64_t) (TIMER_USEC * (1000000.0 / 7000.0)); + dev->time += (tmrval_t) (TIMER_USEC * (1000000.0 / 7000.0)); } -static void * +static priv_t dss_init(const lpt_device_t *info) { dss_t *dev; @@ -153,16 +154,16 @@ dss_init(const lpt_device_t *info) memset(dev, 0x00, sizeof(dss_t)); dev->name = info->name; - sound_add_handler(dss_get_buffer, dev); + sound_add_handler(get_buffer, (priv_t)dev); - timer_add(dss_callback, dev, &dev->time, TIMER_ALWAYS_ENABLED); + timer_add(dss_callback, (priv_t)dev, &dev->time, TIMER_ALWAYS_ENABLED); - return dev; + return (priv_t)dev; } static void -dss_close(void *priv) +dss_close(priv_t priv) { dss_t *dev = (dss_t *)priv; @@ -177,7 +178,7 @@ const lpt_device_t dss_device = { 0, dss_init, dss_close, - dss_write_data, - dss_write_ctrl, - dss_read_status + write_data, + write_ctrl, + read_status }; diff --git a/src/devices/sound/snd_mpu401.c b/src/devices/sound/snd_mpu401.c index e7ddbdc..2fb4534 100644 --- a/src/devices/sound/snd_mpu401.c +++ b/src/devices/sound/snd_mpu401.c @@ -8,7 +8,7 @@ * * Roland MPU-401 emulation. * - * Version: @(#)snd_mpu401.c 1.0.15 2019/05/13 + * Version: @(#)snd_mpu401.c 1.0.16 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -47,8 +47,8 @@ #include #define dbglog sound_midi_log #include "../../emu.h" -#include "../../io.h" #include "../../timer.h" +#include "../../io.h" #include "../../device.h" #include "../../plat.h" #include "../system/pic.h" @@ -64,9 +64,9 @@ enum { }; -static int64_t mpu401_event_callback = 0LL; -static int64_t mpu401_eoi_callback = 0LL; -static int64_t mpu401_reset_callback = 0LL; +static tmrval_t mpu401_event_callback = 0; +static tmrval_t mpu401_eoi_callback = 0; +static tmrval_t mpu401_reset_callback = 0; static void MPU401_WriteCommand(mpu_t *, uint8_t); @@ -80,7 +80,7 @@ QueueByte(mpu_t *mpu, uint8_t data) mpu->state.block_ack = 0; return; } - + if ((mpu->queue_used == 0) && (mpu->mode == M_INTELLIGENT)) { mpu->state.irq_pending = 1; picint(1 << mpu->irq); @@ -216,7 +216,7 @@ MPU401_WriteCommand(mpu_t *mpu, uint8_t val) case 0x8: /* Play */ DEBUG("MPU-401:Intelligent mode playback started"); mpu->state.playing = 1; - mpu401_event_callback = (int64_t) ((MPU401_TIMECONSTANT / (mpu->clock.tempo*mpu->clock.timebase)) * 1000LL * TIMER_USEC); + mpu401_event_callback = (tmrval_t) ((MPU401_TIMECONSTANT / (mpu->clock.tempo*mpu->clock.timebase)) * 1000LL * TIMER_USEC); ClrQueue(mpu); break; } @@ -334,7 +334,7 @@ MPU401_WriteCommand(mpu_t *mpu, uint8_t val) case 0xff: /* Reset MPU-401 */ DEBUG("MPU-401:Reset %X\n", val); - mpu401_reset_callback = (int64_t) (MPU401_RESETBUSY * 33LL * TIMER_USEC); + mpu401_reset_callback = (tmrval_t) (MPU401_RESETBUSY * 33LL * TIMER_USEC); mpu->state.reset = 1; was_uart = (mpu->mode == M_UART); MPU401_Reset(mpu); @@ -875,12 +875,11 @@ MPU401_Event(priv_t priv) MPU401_EOIHandler(mpu); next_event: - /* mpu401_event_callback = 0LL; */ new_time = ((mpu->clock.tempo * mpu->clock.timebase * mpu->clock.tempo_rel) / 0x40); if (new_time == 0) - mpu401_event_callback = 0LL; + mpu401_event_callback = 0; else - mpu401_event_callback += (int64_t) ((MPU401_TIMECONSTANT / new_time) * 1000LL * TIMER_USEC); + mpu401_event_callback += (tmrval_t) ((MPU401_TIMECONSTANT / new_time) * 1000LL * TIMER_USEC); } diff --git a/src/devices/sound/snd_opl.c b/src/devices/sound/snd_opl.c index 1247354..6cb39f3 100644 --- a/src/devices/sound/snd_opl.c +++ b/src/devices/sound/snd_opl.c @@ -8,7 +8,7 @@ * * Interface to the actual OPL emulator. * - * Version: @(#)snd_opl.c 1.0.6 2019/04/25 + * Version: @(#)snd_opl.c 1.0.7 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -44,184 +44,232 @@ #include #define dbglog sound_card_log #include "../../emu.h" +#include "../../timer.h" #include "../../cpu/cpu.h" #include "../../io.h" -#include "../../timer.h" #include "sound.h" #include "snd_opl.h" #include "snd_dbopl.h" -uint8_t opl2_read(uint16_t a, void *priv) +static void +timer_callback00(priv_t priv) { - opl_t *opl = (opl_t *)priv; + opl_t *opl = (opl_t *)priv; - cycles -= ISA_CYCLES(8); - opl2_update2(opl); - return opl_read(0, a); -} -void opl2_write(uint16_t a, uint8_t v, void *priv) -{ - opl_t *opl = (opl_t *)priv; - - opl2_update2(opl); - opl_write(0, a, v); - opl_write(1, a, v); -} - -uint8_t opl2_l_read(uint16_t a, void *priv) -{ - opl_t *opl = (opl_t *)priv; - - cycles -= ISA_CYCLES(8); - opl2_update2(opl); - return opl_read(0, a); -} -void opl2_l_write(uint16_t a, uint8_t v, void *priv) -{ - opl_t *opl = (opl_t *)priv; - - opl2_update2(opl); - opl_write(0, a, v); -} - -uint8_t opl2_r_read(uint16_t a, void *priv) -{ - opl_t *opl = (opl_t *)priv; - - cycles -= ISA_CYCLES(8); - opl2_update2(opl); - return opl_read(1, a); -} -void opl2_r_write(uint16_t a, uint8_t v, void *priv) -{ - opl_t *opl = (opl_t *)priv; - - opl2_update2(opl); - opl_write(1, a, v); -} - -uint8_t opl3_read(uint16_t a, void *priv) -{ - opl_t *opl = (opl_t *)priv; - - cycles -= ISA_CYCLES(8); - opl3_update2(opl); - return opl_read(0, a); -} -void opl3_write(uint16_t a, uint8_t v, void *priv) -{ - opl_t *opl = (opl_t *)priv; - - opl3_update2(opl); - opl_write(0, a, v); + opl->timers_enable[0][0] = 0; + opl_timer_over(0, 0); } -void opl2_update2(opl_t *opl) +static void +timer_callback01(priv_t priv) { - if (opl->pos < sound_pos_global) - { - opl2_update(0, &opl->buffer[opl->pos*2], sound_pos_global - opl->pos); - opl2_update(1, &opl->buffer[opl->pos*2 + 1], sound_pos_global - opl->pos); - for (; opl->pos < sound_pos_global; opl->pos++) - { - opl->filtbuf[0] = opl->buffer[opl->pos*2] = (opl->buffer[opl->pos*2] / 2); - opl->filtbuf[1] = opl->buffer[opl->pos*2+1] = (opl->buffer[opl->pos*2+1] / 2); - } - } + opl_t *opl = (opl_t *)priv; + + opl->timers_enable[0][1] = 0; + opl_timer_over(0, 1); } -void opl3_update2(opl_t *opl) + +static void +timer_callback10(priv_t priv) { - if (opl->pos < sound_pos_global) - { - opl3_update(0, &opl->buffer[opl->pos*2], sound_pos_global - opl->pos); - for (; opl->pos < sound_pos_global; opl->pos++) - { - opl->filtbuf[0] = opl->buffer[opl->pos*2] = (opl->buffer[opl->pos*2] / 2); - opl->filtbuf[1] = opl->buffer[opl->pos*2+1] = (opl->buffer[opl->pos*2+1] / 2); - } - } + opl_t *opl = (opl_t *)priv; + + opl->timers_enable[1][0] = 0; + opl_timer_over(1, 0); } -void ym3812_timer_set_0(void *param, int timer, int64_t period) -{ - opl_t *opl = (opl_t *)param; - - opl->timers[0][timer] = period * TIMER_USEC * 20LL; - if (!opl->timers[0][timer]) opl->timers[0][timer] = 1; - opl->timers_enable[0][timer] = period ? 1 : 0; -} -void ym3812_timer_set_1(void *param, int timer, int64_t period) -{ - opl_t *opl = (opl_t *)param; - opl->timers[1][timer] = period * TIMER_USEC * 20LL; - if (!opl->timers[1][timer]) opl->timers[1][timer] = 1; - opl->timers_enable[1][timer] = period ? 1 : 0; +static void +timer_callback11(priv_t priv) +{ + opl_t *opl = (opl_t *)priv; + + opl->timers_enable[1][1] = 0; + opl_timer_over(1, 1); +} + + +void +opl2_update2(opl_t *opl) +{ + if (opl->pos < sound_pos_global) { + opl2_update(0, &opl->buffer[opl->pos*2], sound_pos_global - opl->pos); + opl2_update(1, &opl->buffer[opl->pos*2 + 1], sound_pos_global - opl->pos); + for (; opl->pos < sound_pos_global; opl->pos++) { + opl->filtbuf[0] = opl->buffer[opl->pos*2] = (opl->buffer[opl->pos*2] / 2); + opl->filtbuf[1] = opl->buffer[opl->pos*2+1] = (opl->buffer[opl->pos*2+1] / 2); + } + } } -void ymf262_timer_set(void *param, int timer, int64_t period) -{ - opl_t *opl = (opl_t *)param; - opl->timers[0][timer] = period * TIMER_USEC * 20LL; - if (!opl->timers[0][timer]) opl->timers[0][timer] = 1; - opl->timers_enable[0][timer] = period ? 1 : 0; +uint8_t +opl2_read(uint16_t a, priv_t priv) +{ + opl_t *opl = (opl_t *)priv; + + cycles -= ISA_CYCLES(8); + opl2_update2(opl); + + return opl_read(0, a); } -static void opl_timer_callback00(void *p) -{ - opl_t *opl = (opl_t *)p; - - opl->timers_enable[0][0] = 0; - opl_timer_over(0, 0); -} -static void opl_timer_callback01(void *p) -{ - opl_t *opl = (opl_t *)p; - - opl->timers_enable[0][1] = 0; - opl_timer_over(0, 1); -} -static void opl_timer_callback10(void *p) -{ - opl_t *opl = (opl_t *)p; - - opl->timers_enable[1][0] = 0; - opl_timer_over(1, 0); -} -static void opl_timer_callback11(void *p) -{ - opl_t *opl = (opl_t *)p; - - opl->timers_enable[1][1] = 0; - opl_timer_over(1, 1); -} - -void opl2_init(opl_t *opl) -{ - opl_init(ym3812_timer_set_0, opl, 0, 0); - opl_init(ym3812_timer_set_1, opl, 1, 0); - timer_add(opl_timer_callback00, opl, - &opl->timers[0][0], &opl->timers_enable[0][0]); - timer_add(opl_timer_callback01, opl, - &opl->timers[0][1], &opl->timers_enable[0][1]); - timer_add(opl_timer_callback10, opl, - &opl->timers[1][0], &opl->timers_enable[1][0]); - timer_add(opl_timer_callback11, opl, - &opl->timers[1][1], &opl->timers_enable[1][1]); +void +opl2_write(uint16_t a, uint8_t v, priv_t priv) +{ + opl_t *opl = (opl_t *)priv; + + opl2_update2(opl); + opl_write(0, a, v); + opl_write(1, a, v); } -void opl3_init(opl_t *opl) -{ - opl_init(ymf262_timer_set, opl, 0, 1); - timer_add(opl_timer_callback00, opl, - &opl->timers[0][0], &opl->timers_enable[0][0]); - timer_add(opl_timer_callback01, opl, - &opl->timers[0][1], &opl->timers_enable[0][1]); +uint8_t +opl2_l_read(uint16_t a, priv_t priv) +{ + opl_t *opl = (opl_t *)priv; + + cycles -= ISA_CYCLES(8); + opl2_update2(opl); + + return opl_read(0, a); +} + + +void +opl2_l_write(uint16_t a, uint8_t v, priv_t priv) +{ + opl_t *opl = (opl_t *)priv; + + opl2_update2(opl); + opl_write(0, a, v); +} + + +uint8_t +opl2_r_read(uint16_t a, priv_t priv) +{ + opl_t *opl = (opl_t *)priv; + + cycles -= ISA_CYCLES(8); + opl2_update2(opl); + + return opl_read(1, a); +} + + +void +opl2_r_write(uint16_t a, uint8_t v, priv_t priv) +{ + opl_t *opl = (opl_t *)priv; + + opl2_update2(opl); + opl_write(1, a, v); +} + + +void +opl3_update2(opl_t *opl) +{ + if (opl->pos < sound_pos_global) { + opl3_update(0, &opl->buffer[opl->pos*2], sound_pos_global - opl->pos); + + for (; opl->pos < sound_pos_global; opl->pos++) { + opl->filtbuf[0] = opl->buffer[opl->pos*2] = (opl->buffer[opl->pos*2] / 2); + opl->filtbuf[1] = opl->buffer[opl->pos*2+1] = (opl->buffer[opl->pos*2+1] / 2); + } + } +} + + +uint8_t +opl3_read(uint16_t a, priv_t priv) +{ + opl_t *opl = (opl_t *)priv; + + cycles -= ISA_CYCLES(8); + opl3_update2(opl); + + return opl_read(0, a); +} + + +void +opl3_write(uint16_t a, uint8_t v, priv_t priv) +{ + opl_t *opl = (opl_t *)priv; + + opl3_update2(opl); + opl_write(0, a, v); +} + + +void +ym3812_timer_set_0(priv_t param, int timer, tmrval_t period) +{ + opl_t *opl = (opl_t *)param; + + opl->timers[0][timer] = period * TIMER_USEC * 20LL; + if (! opl->timers[0][timer]) + opl->timers[0][timer] = 1; + opl->timers_enable[0][timer] = period ? 1 : 0; +} + + +void +ym3812_timer_set_1(priv_t param, int timer, tmrval_t period) +{ + opl_t *opl = (opl_t *)param; + + opl->timers[1][timer] = period * TIMER_USEC * 20LL; + if (! opl->timers[1][timer]) + opl->timers[1][timer] = 1; + opl->timers_enable[1][timer] = period ? 1 : 0; +} + + +void +ymf262_timer_set(priv_t param, int timer, tmrval_t period) +{ + opl_t *opl = (opl_t *)param; + + opl->timers[0][timer] = period * TIMER_USEC * 20LL; + if (! opl->timers[0][timer]) + opl->timers[0][timer] = 1; + opl->timers_enable[0][timer] = period ? 1 : 0; +} + + +void +opl2_init(opl_t *opl) +{ + opl_init(ym3812_timer_set_0, opl, 0, 0); + opl_init(ym3812_timer_set_1, opl, 1, 0); + + timer_add(timer_callback00, (priv_t)opl, + &opl->timers[0][0], &opl->timers_enable[0][0]); + timer_add(timer_callback01, (priv_t)opl, + &opl->timers[0][1], &opl->timers_enable[0][1]); + timer_add(timer_callback10, (priv_t)opl, + &opl->timers[1][0], &opl->timers_enable[1][0]); + timer_add(timer_callback11, (priv_t)opl, + &opl->timers[1][1], &opl->timers_enable[1][1]); +} + + +void +opl3_init(opl_t *opl) +{ + opl_init(ymf262_timer_set, opl, 0, 1); + + timer_add(timer_callback00, (priv_t)opl, + &opl->timers[0][0], &opl->timers_enable[0][0]); + timer_add(timer_callback01, (priv_t)opl, + &opl->timers[0][1], &opl->timers_enable[0][1]); } diff --git a/src/devices/sound/snd_opl.h b/src/devices/sound/snd_opl.h index d171a9c..a8c4836 100644 --- a/src/devices/sound/snd_opl.h +++ b/src/devices/sound/snd_opl.h @@ -8,14 +8,14 @@ * * Definitions for the OPL interface. * - * Version: @(#)snd_opl.h 1.0.1 2018/02/14 + * Version: @(#)snd_opl.h 1.0.2 2010/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, * TheCollector1995, * Sarah Walker, * - * Copyright 2017,2018 Fred N. van Kempen. + * Copyright 2017-2019 Fred N. van Kempen. * Copyright 2016-2018 Miran Grca. * Copyright 2008-2018 Sarah Walker. * @@ -41,36 +41,34 @@ # define SOUND_OPL_H -typedef struct opl_t -{ - int chip_nr[2]; - - int64_t timers[2][2]; - int64_t timers_enable[2][2]; +typedef struct { + int chip_nr[2]; - int16_t filtbuf[2]; + tmrval_t timers[2][2]; + tmrval_t timers_enable[2][2]; - int16_t buffer[SOUNDBUFLEN * 2]; - int pos; + int16_t filtbuf[2]; + + int pos; + int16_t buffer[SOUNDBUFLEN * 2]; } opl_t; -uint8_t opl2_read(uint16_t a, void *priv); -void opl2_write(uint16_t a, uint8_t v, void *priv); -uint8_t opl2_l_read(uint16_t a, void *priv); -void opl2_l_write(uint16_t a, uint8_t v, void *priv); -uint8_t opl2_r_read(uint16_t a, void *priv); -void opl2_r_write(uint16_t a, uint8_t v, void *priv); -uint8_t opl3_read(uint16_t a, void *priv); -void opl3_write(uint16_t a, uint8_t v, void *priv); -void opl2_poll(opl_t *opl, int16_t *bufl, int16_t *bufr); -void opl3_poll(opl_t *opl, int16_t *bufl, int16_t *bufr); +extern void opl2_poll(opl_t *opl, int16_t *bufl, int16_t *bufr); +extern void opl2_update2(opl_t *opl); +extern uint8_t opl2_read(uint16_t a, priv_t); +extern void opl2_write(uint16_t a, uint8_t v, priv_t); +extern uint8_t opl2_l_read(uint16_t a, priv_t); +extern void opl2_l_write(uint16_t a, uint8_t v, priv_t); +extern uint8_t opl2_r_read(uint16_t a, priv_t); +extern void opl2_r_write(uint16_t a, uint8_t v, priv_t); +extern void opl2_init(opl_t *opl); -void opl2_init(opl_t *opl); -void opl3_init(opl_t *opl); - -void opl2_update2(opl_t *opl); -void opl3_update2(opl_t *opl); +extern void opl3_poll(opl_t *opl, int16_t *bufl, int16_t *bufr); +extern void opl3_update2(opl_t *opl); +extern uint8_t opl3_read(uint16_t a, priv_t); +extern void opl3_write(uint16_t a, uint8_t v, priv_t); +extern void opl3_init(opl_t *opl); #endif /*SOUND_OPL_H*/ diff --git a/src/devices/sound/snd_pas16.c b/src/devices/sound/snd_pas16.c index 9ac3e3f..c301ab5 100644 --- a/src/devices/sound/snd_pas16.c +++ b/src/devices/sound/snd_pas16.c @@ -79,7 +79,7 @@ * FF88 - board model * 3 = PAS16 * - * Version: @(#)snd_pas16.c 1.0.15 2019/05/13 + * Version: @(#)snd_pas16.c 1.0.16 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -114,9 +114,9 @@ #include #define dbglog sound_card_log #include "../../emu.h" +#include "../../timer.h" #include "../../cpu/cpu.h" #include "../../io.h" -#include "../../timer.h" #include "../../device.h" #include "../../plat.h" #include "../system/clk.h" @@ -151,7 +151,7 @@ typedef struct pas16_t struct { uint32_t l[3]; - int64_t c[3]; + tmrval_t c[3]; uint8_t m[3]; uint8_t ctrl, ctrls[2]; int wp, rm[3], wm[3]; @@ -159,7 +159,7 @@ typedef struct pas16_t int thit[3]; int delay[3]; int rereadlatch[3]; - int64_t enable[3]; + tmrval_t enable[3]; } pit; opl_t opl; @@ -467,7 +467,7 @@ static void pas16_pit_out(uint16_t port, uint8_t val, priv_t priv) pas16->pit.thit[t] = 0; pas16->pit.c[t] = pas16->pit.l[t]; if (!t) - pas16->pit.c[t] *= (int64_t) (PITCONST * (1 << TIMER_SHIFT)); + pas16->pit.c[t] *= (tmrval_t) (PITCONST * (1 << TIMER_SHIFT)); pas16->pit.enable[t] = 1; break; case 2: @@ -475,7 +475,7 @@ static void pas16_pit_out(uint16_t port, uint8_t val, priv_t priv) pas16->pit.thit[t] = 0; pas16->pit.c[t] = pas16->pit.l[t]; if (!t) - pas16->pit.c[t] *= (int64_t) (PITCONST * (1 << TIMER_SHIFT)); + pas16->pit.c[t] *= (tmrval_t) (PITCONST * (1 << TIMER_SHIFT)); pas16->pit.enable[t] = 1; break; case 0: @@ -483,7 +483,7 @@ static void pas16_pit_out(uint16_t port, uint8_t val, priv_t priv) pas16->pit.l[t] |= (val << 8); pas16->pit.c[t] = pas16->pit.l[t]; if (!t) - pas16->pit.c[t] *= (int64_t) (PITCONST * (1 << TIMER_SHIFT)); + pas16->pit.c[t] *= (tmrval_t) (PITCONST * (1 << TIMER_SHIFT)); pas16->pit.thit[t] = 0; pas16->pit.wm[t] = 3; pas16->pit.enable[t] = 1; @@ -499,7 +499,7 @@ static void pas16_pit_out(uint16_t port, uint8_t val, priv_t priv) pas16->pit.l[t] |= 0x10000; pas16->pit.c[t] = pas16->pit.l[t]; if (!t) - pas16->pit.c[t] *= (int64_t) (PITCONST * (1 << TIMER_SHIFT)); + pas16->pit.c[t] *= (tmrval_t) (PITCONST * (1 << TIMER_SHIFT)); } break; } @@ -571,9 +571,9 @@ static void pas16_pcm_poll(priv_t priv) if (pas16->pit.m[0] & 2) { if (pas16->pit.l[0]) - pas16->pit.c[0] += (int64_t) ((pas16->pit.l[0] * PITCONST * (1 << TIMER_SHIFT))); + pas16->pit.c[0] += (tmrval_t) ((pas16->pit.l[0] * PITCONST * (1 << TIMER_SHIFT))); else - pas16->pit.c[0] += (int64_t) ((0x10000 * PITCONST * (1 << TIMER_SHIFT))); + pas16->pit.c[0] += (tmrval_t) ((0x10000 * PITCONST * (1 << TIMER_SHIFT))); } else { diff --git a/src/devices/sound/snd_sb.c b/src/devices/sound/snd_sb.c index cad495b..41deff2 100644 --- a/src/devices/sound/snd_sb.c +++ b/src/devices/sound/snd_sb.c @@ -8,7 +8,7 @@ * * Sound Blaster emulation. * - * Version: @(#)snd_sb.c 1.0.13 2019/05/13 + * Version: @(#)snd_sb.c 1.0.14 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -45,6 +45,7 @@ #include #define dbglog sound_card_log #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" diff --git a/src/devices/sound/snd_sb_dsp.h b/src/devices/sound/snd_sb_dsp.h index 4e6b102..d604247 100644 --- a/src/devices/sound/snd_sb_dsp.h +++ b/src/devices/sound/snd_sb_dsp.h @@ -8,13 +8,13 @@ * * Definitions for the SoundBlaster DSP driver. * - * Version: @(#)snd_sb_dsp.h 1.0.2 2018/09/05 + * Version: @(#)snd_sb_dsp.h 1.0.3 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, * Sarah Walker, * - * Copyright 2017,2018 Fred N. van Kempen. + * Copyright 2017-2019 Fred N. van Kempen. * Copyright 2016-2018 Miran Grca. * Copyright 2008-2018 Sarah Walker. * @@ -48,7 +48,7 @@ typedef struct sb_dsp_t int sb_8_dmanum; int sb_16_length, sb_16_format, sb_16_autoinit, sb_16_pause, sb_16_enable, sb_16_autolen, sb_16_output; int sb_16_dmanum; - int64_t sb_pausetime; + tmrval_t sb_pausetime; uint8_t sb_read_data[256]; int sb_read_wp, sb_read_rp; @@ -84,17 +84,17 @@ typedef struct sb_dsp_t uint8_t sbreaddat; uint8_t sb_command; uint8_t sb_test; - int64_t sb_timei, sb_timeo; + tmrval_t sb_timei, sb_timeo; int sb_irq8, sb_irq16; uint8_t sb_asp_regs[256]; - int64_t sbenable, sb_enable_i; + tmrval_t sbenable, sb_enable_i; - int64_t sbcount, sb_count_i; + tmrval_t sbcount, sb_count_i; - int64_t sblatcho, sblatchi; + tmrval_t sblatcho, sblatchi; uint16_t sb_addr; @@ -102,7 +102,7 @@ typedef struct sb_dsp_t int asp_data_len; - int64_t wb_time, wb_full; + tmrval_t wb_time, wb_full; int busy_count; diff --git a/src/devices/sound/snd_speaker.c b/src/devices/sound/snd_speaker.c index d81ee48..f5d27e7 100644 --- a/src/devices/sound/snd_speaker.c +++ b/src/devices/sound/snd_speaker.c @@ -8,7 +8,7 @@ * * Implementation of the PC-Speaker device. * - * Version: @(#)snd_speaker.c 1.0.7 2019/05/05 + * Version: @(#)snd_speaker.c 1.0.8 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #include #define dbglog sound_card_log #include "../../emu.h" +#include "../../timer.h" #include "../system/pit.h" #include "../system/ppi.h" #include "sound.h" @@ -62,7 +63,7 @@ static int speaker_pos; static void -get_buffer(int32_t *buffer, int len, void *p) +get_buffer(int32_t *buffer, int len, priv_t priv) { int32_t val; int c; @@ -111,11 +112,11 @@ speaker_update(void) void speaker_timer(int new_out, int old_out) { - int64_t l; + tmrval_t l; speaker_update(); - l = pit.l[2] ? pit.l[2] : 0x10000LL; + l = pit.l[2] ? pit.l[2] : (tmrval_t)0x10000; if (l < 25LL) speaker_on = 0; else diff --git a/src/devices/sound/snd_wss.c b/src/devices/sound/snd_wss.c index 0d80b9c..fb6a840 100644 --- a/src/devices/sound/snd_wss.c +++ b/src/devices/sound/snd_wss.c @@ -8,7 +8,7 @@ * * Implementation of the Windows Sound System sound device. * - * Version: @(#)snd_wss.c 1.0.9 2019/05/13 + * Version: @(#)snd_wss.c 1.0.10 2019/05/17 * * Authors: Fred N. van Kempen, * TheCollector1995, @@ -46,6 +46,7 @@ #include #define dbglog sound_card_log #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../device.h" #include "../../plat.h" diff --git a/src/devices/sound/sound.c b/src/devices/sound/sound.c index 1854c4a..0999e2f 100644 --- a/src/devices/sound/sound.c +++ b/src/devices/sound/sound.c @@ -8,7 +8,7 @@ * * Sound emulation core. * - * Version: @(#)sound.c 1.0.19 2019/05/03 + * Version: @(#)sound.c 1.0.20 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -49,8 +49,6 @@ #include "../../timer.h" #include "../../device.h" #include "../../plat.h" -#include "../disk/hdc.h" -#include "../disk/hdc_ide.h" #include "../cdrom/cdrom.h" #include "sound.h" #include "midi.h" @@ -80,7 +78,7 @@ int sound_pos_global = 0; static sndhnd_t handlers[8]; static int handlers_num; -static int64_t poll_time = 0LL, +static tmrval_t poll_time = 0, poll_latch; static int32_t *outbuffer; static float *outbuffer_ex; @@ -458,8 +456,6 @@ sound_cd_stop(void) } cd_thread_enable = drives ? 1 : 0; - - secondary_ide_check(); } @@ -483,5 +479,5 @@ sound_add_handler(void (*get_buffer)(int32_t *buffer, int len, void *p), void *p void sound_speed_changed(void) { - poll_latch = (int64_t)((double)TIMER_USEC * (1000000.0 / 48000.0)); + poll_latch = (tmrval_t)((double)TIMER_USEC * (1000000.0 / 48000.0)); } diff --git a/src/devices/system/clk.c b/src/devices/system/clk.c index e8b069d..b67bf73 100644 --- a/src/devices/system/clk.c +++ b/src/devices/system/clk.c @@ -8,7 +8,7 @@ * * Implement the Intel 8284 Clock Generator functionality. * - * Version: @(#)clk.c 1.0.1 2019/05/05 + * Version: @(#)clk.c 1.0.2 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,10 +42,10 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../cpu/cpu.h" #include "../../io.h" #include "../../device.h" -#include "../../timer.h" #include "clk.h" @@ -123,7 +123,7 @@ clk_setup(uint32_t freq) VGACONST2 = (float) (cpuclock / 28322000.0); RTCCONST = (float) (cpuclock / 32768.0); - TIMER_USEC = (int64_t)((cpuclock / 1000000.0f) * (float)(1 << TIMER_SHIFT)); + TIMER_USEC = (tmrval_t)((cpuclock / 1000000.0f) * (float)(1 << TIMER_SHIFT)); bus_timing = (float) (cpuclock / (double)cpu_busspeed); diff --git a/src/devices/system/intel.c b/src/devices/system/intel.c index 9fd5769..1a31f20 100644 --- a/src/devices/system/intel.c +++ b/src/devices/system/intel.c @@ -8,7 +8,7 @@ * * Implementation of Intel mainboards. * - * Version: @(#)intel.c 1.0.12 2019/05/13 + * Version: @(#)intel.c 1.0.13 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,10 +42,10 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../cpu/cpu.h" #include "../../io.h" #include "../../mem.h" -#include "../../timer.h" #include "../../device.h" #include "../../plat.h" #include "intel.h" @@ -54,7 +54,7 @@ typedef struct { uint16_t timer_latch; - int64_t timer; + tmrval_t timer; } batman_t; diff --git a/src/devices/system/intel_flash.c b/src/devices/system/intel_flash.c index ea18f0d..e12942a 100644 --- a/src/devices/system/intel_flash.c +++ b/src/devices/system/intel_flash.c @@ -42,6 +42,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../device.h" #include "../../mem.h" #include "../../rom.h" diff --git a/src/devices/system/intel_piix.c b/src/devices/system/intel_piix.c index f59471e..3da5661 100644 --- a/src/devices/system/intel_piix.c +++ b/src/devices/system/intel_piix.c @@ -12,7 +12,7 @@ * word 0 - base address * word 1 - bits 1-15 = byte count, bit 31 = end of transfer * - * Version: @(#)intel_piix.c 1.0.12 2019/05/15 + * Version: @(#)intel_piix.c 1.0.13 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -46,6 +46,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../device.h" @@ -60,8 +61,8 @@ #include "pci.h" #include "dma.h" #include "pic.h" -#include "intel_piix.h" #include "port92.h" +#include "intel_piix.h" typedef struct diff --git a/src/devices/system/nvr_at.c b/src/devices/system/nvr_at.c index b1cbd11..99cc7c3 100644 --- a/src/devices/system/nvr_at.c +++ b/src/devices/system/nvr_at.c @@ -189,7 +189,7 @@ * including the later update (DS12887A) which implemented a * "century" register to be compatible with Y2K. * - * Version: @(#)nvr_at.c 1.0.20 2019/05/13 + * Version: @(#)nvr_at.c 1.0.21 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -227,10 +227,10 @@ #include #include "../../emu.h" #include "../../config.h" +#include "../../timer.h" #include "../../cpu/cpu.h" #include "../../machines/machine.h" #include "../../io.h" -#include "../../timer.h" #include "../../device.h" #include "../../nvr.h" #include "../../plat.h" @@ -290,7 +290,7 @@ typedef struct { uint8_t addr; - int64_t ecount, + tmrval_t ecount, rtctime; } local_t; @@ -451,10 +451,10 @@ static void timer_recalc(nvr_t *nvr, int add) { local_t *local = (local_t *)nvr->data; - int64_t c, nt; + tmrval_t c, nt; c = 1ULL << ((nvr->regs[RTC_REGA] & REGA_RS) - 1); - nt = (int64_t)(RTCCONST * c * (1LL << TIMER_SHIFT)); + nt = (tmrval_t)(RTCCONST * c * (1LL << TIMER_SHIFT)); if (add == 2) { local->rtctime = nt; @@ -504,7 +504,7 @@ timer_tick(nvr_t *nvr) local->stat = REGA_UIP; /* Schedule the actual update. */ - local->ecount = (int64_t)((244.0 + 1984.0) * TIMER_USEC); + local->ecount = (tmrval_t)((244.0 + 1984.0) * TIMER_USEC); } diff --git a/src/devices/system/nvr_ps2.c b/src/devices/system/nvr_ps2.c index c4e1666..5375a3e 100644 --- a/src/devices/system/nvr_ps2.c +++ b/src/devices/system/nvr_ps2.c @@ -8,7 +8,7 @@ * * Handling of the PS/2 series CMOS devices. * - * Version: @(#)nvr_ps2.c 1.0.13 2019/05/13 + * Version: @(#)nvr_ps2.c 1.0.14 2019/05/17 * * Authors: Fred N. van Kempen, * Sarah Walker, @@ -40,6 +40,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../machines/machine.h" #include "../../device.h" #include "../../io.h" diff --git a/src/devices/system/pic.c b/src/devices/system/pic.c index b2f6e06..dc7ee2c 100644 --- a/src/devices/system/pic.c +++ b/src/devices/system/pic.c @@ -8,7 +8,7 @@ * * Implementation of Intel 8259 interrupt controller. * - * Version: @(#)pic.c 1.0.8 2019/05/13 + * Version: @(#)pic.c 1.0.9 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -41,6 +41,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "pci.h" #include "pic.h" @@ -434,7 +435,7 @@ pic_process(PIC *dev, int c) if (dev->icw4 & 0x02) (AT && (c >= 8)) ? pic2_autoeoi() : pic_autoeoi(); - if (! c) + if (c == 0) pit_set_gate(&pit2, 0, 0); return(pic_int + dev->vector); diff --git a/src/devices/system/pit.c b/src/devices/system/pit.c index 2e42447..92fae6b 100644 --- a/src/devices/system/pit.c +++ b/src/devices/system/pit.c @@ -13,7 +13,7 @@ * B4 to 40, two writes to 43, then two reads * - value _does_ change! * - * Version: @(#)pit.c 1.0.16 2019/05/13 + * Version: @(#)pit.c 1.0.17 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -47,10 +47,10 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../cpu/cpu.h" #include "../../io.h" #include "../../device.h" -#include "../../timer.h" #include "../sound/sound.h" #include "../sound/snd_speaker.h" #ifdef USE_CASSETTE @@ -78,7 +78,7 @@ set_out(PIT *dev, int t, int out) static void set_gate_no_timer(PIT *dev, int t, int gate) { - int64_t l = dev->l[t] ? dev->l[t] : 0x10000LL; + tmrval_t l = dev->l[t] ? dev->l[t] : 0x10000LL; if (dev->disabled[t]) { dev->gate[t] = gate; @@ -95,7 +95,7 @@ set_gate_no_timer(PIT *dev, int t, int gate) case 5: /* hardware triggered strobe */ if (gate && !dev->gate[t]) { dev->count[t] = (int)l; - dev->c[t] = (int64_t)((l << TIMER_SHIFT) * PITCONST); + dev->c[t] = (tmrval_t)((l << TIMER_SHIFT) * PITCONST); set_out(dev, t, 0); dev->thit[t] = 0; dev->enabled[t] = 1; @@ -105,7 +105,7 @@ set_gate_no_timer(PIT *dev, int t, int gate) case 2: /* rate generator */ if (gate && !dev->gate[t]) { dev->count[t] = (int)(l - 1); - dev->c[t] = (int64_t)((l << TIMER_SHIFT) * PITCONST); + dev->c[t] = (tmrval_t)((l << TIMER_SHIFT) * PITCONST); set_out(dev, t, 1); dev->thit[t] = 0; } @@ -115,7 +115,7 @@ set_gate_no_timer(PIT *dev, int t, int gate) case 3: /* square wave mode */ if (gate && !dev->gate[t]) { dev->count[t] = (int)l; - dev->c[t] = (int64_t)((((l+1)>>1)<c[t] = (tmrval_t)((((l+1)>>1)<thit[t] = 0; } @@ -132,11 +132,11 @@ set_gate_no_timer(PIT *dev, int t, int gate) static void do_over(PIT *dev, int t) { - int64_t l = dev->l[t] ? dev->l[t] : 0x10000LL; + tmrval_t l = dev->l[t] ? dev->l[t] : 0x10000LL; if (dev->disabled[t]) { dev->count[t] += 0xffff; - dev->c[t] += (int64_t)(((int64_t)0xffff << TIMER_SHIFT) * PITCONST); + dev->c[t] += (tmrval_t)(((tmrval_t)0xffff << TIMER_SHIFT) * PITCONST); return; } @@ -147,12 +147,12 @@ do_over(PIT *dev, int t) set_out(dev, t, 1); dev->thit[t] = 1; dev->count[t] += 0xffff; - dev->c[t] += (int64_t)(((int64_t)0xffff << TIMER_SHIFT) * PITCONST); + dev->c[t] += (tmrval_t)(((tmrval_t)0xffff << TIMER_SHIFT) * PITCONST); break; case 2: /* rate generator */ dev->count[t] += (int)l; - dev->c[t] += (int64_t)((l << TIMER_SHIFT) * PITCONST); + dev->c[t] += (tmrval_t)((l << TIMER_SHIFT) * PITCONST); set_out(dev, t, 0); set_out(dev, t, 1); break; @@ -161,11 +161,11 @@ do_over(PIT *dev, int t) if (dev->out[t]) { set_out(dev, t, 0); dev->count[t] += (int)(l >> 1); - dev->c[t] += (int64_t)(((l >> 1) << TIMER_SHIFT) * PITCONST); + dev->c[t] += (tmrval_t)(((l >> 1) << TIMER_SHIFT) * PITCONST); } else { set_out(dev, t, 1); dev->count[t] += (int)((l + 1) >> 1); - dev->c[t] = (int64_t)((((l + 1) >> 1) << TIMER_SHIFT) * PITCONST); + dev->c[t] = (tmrval_t)((((l + 1) >> 1) << TIMER_SHIFT) * PITCONST); } break; @@ -177,11 +177,11 @@ do_over(PIT *dev, int t) if (dev->newcount[t]) { dev->newcount[t] = 0; dev->count[t] += (int)l; - dev->c[t] += (int64_t)((l << TIMER_SHIFT) * PITCONST); + dev->c[t] += (tmrval_t)((l << TIMER_SHIFT) * PITCONST); } else { dev->thit[t] = 1; dev->count[t] += 0xffff; - dev->c[t] += (int64_t)(((int64_t)0xffff << TIMER_SHIFT) * PITCONST); + dev->c[t] += (tmrval_t)(((tmrval_t)0xffff << TIMER_SHIFT) * PITCONST); } break; @@ -192,7 +192,7 @@ do_over(PIT *dev, int t) } dev->thit[t] = 1; dev->count[t] += 0xffff; - dev->c[t] += (int64_t)(((int64_t)0xffff << TIMER_SHIFT) * PITCONST); + dev->c[t] += (tmrval_t)(((tmrval_t)0xffff << TIMER_SHIFT) * PITCONST); break; } @@ -254,7 +254,7 @@ load_timer(PIT *dev, int t) switch (dev->m[t]) { case 0: /* interrupt on terminal count */ dev->count[t] = l; - dev->c[t] = (int64_t)((((int64_t) l) << TIMER_SHIFT) * PITCONST); + dev->c[t] = (tmrval_t)((((tmrval_t) l) << TIMER_SHIFT) * PITCONST); set_out(dev, t, 0); dev->thit[t] = 0; dev->enabled[t] = dev->gate[t]; @@ -267,7 +267,7 @@ load_timer(PIT *dev, int t) case 2: /* rate generator */ if (dev->initial[t]) { dev->count[t] = l - 1; - dev->c[t] = (int64_t)(((((int64_t) l) - 1LL) << TIMER_SHIFT) * PITCONST); + dev->c[t] = (tmrval_t)(((((tmrval_t) l) - 1LL) << TIMER_SHIFT) * PITCONST); set_out(dev, t, 1); dev->thit[t] = 0; } @@ -277,7 +277,7 @@ load_timer(PIT *dev, int t) case 3: /* square wave mode */ if (dev->initial[t]) { dev->count[t] = l; - dev->c[t] = (int64_t)((((((int64_t) l) + 1LL) >> 1) << TIMER_SHIFT) * PITCONST); + dev->c[t] = (tmrval_t)((((((tmrval_t) l) + 1LL) >> 1) << TIMER_SHIFT) * PITCONST); set_out(dev, t, 1); dev->thit[t] = 0; } @@ -289,7 +289,7 @@ load_timer(PIT *dev, int t) dev->newcount[t] = 1; } else { dev->count[t] = l; - dev->c[t] = (int64_t)((l << TIMER_SHIFT) * PITCONST); + dev->c[t] = (tmrval_t)((l << TIMER_SHIFT) * PITCONST); set_out(dev, t, 0); dev->thit[t] = 0; } @@ -592,7 +592,7 @@ pit_reset(PIT *dev) dev->m[i] = 0; dev->gate[i] = 1; dev->l[i] = 0xffff; - dev->c[i] = (int64_t)(0xffffLL * PITCONST); + dev->c[i] = (tmrval_t)(0xffffLL * PITCONST); dev->using_timer[i] = 1; } @@ -630,21 +630,21 @@ pit_set_gate(PIT *dev, int t, int gate) } -static int64_t +static tmrval_t read_timer_ex(PIT *pit, int t) { - int64_t r; + tmrval_t r; timer_clock(); if (pit->using_timer[t] && !(pit->m[t] == 3 && !pit->gate[t])) { r = (int)(pit->c[t] + ((1 << TIMER_SHIFT) - 1)); if (pit->m[t] == 2) - r += (int64_t)((1LL << TIMER_SHIFT) * PITCONST); + r += (tmrval_t)((1LL << TIMER_SHIFT) * PITCONST); if (r < 0) r = 0; if (r > ((0x10000LL << TIMER_SHIFT) * PITCONST)) - r = (int64_t)((0x10000LL << TIMER_SHIFT) * PITCONST); + r = (tmrval_t)((0x10000LL << TIMER_SHIFT) * PITCONST); if (pit->m[t] == 3) r <<= 1; @@ -652,12 +652,12 @@ read_timer_ex(PIT *pit, int t) } if (pit->m[t] == 2) { - r = (int64_t) (((pit->count[t] + 1LL) << TIMER_SHIFT) * PITCONST); + r = (tmrval_t) (((pit->count[t] + 1LL) << TIMER_SHIFT) * PITCONST); return r; } - r = (int64_t) ((pit->count[t] << TIMER_SHIFT) * PITCONST); + r = (tmrval_t) ((pit->count[t] << TIMER_SHIFT) * PITCONST); return r; } diff --git a/src/devices/system/pit.h b/src/devices/system/pit.h index 517fe2f..f040564 100644 --- a/src/devices/system/pit.h +++ b/src/devices/system/pit.h @@ -8,7 +8,7 @@ * * Definitions for Intel 8253 timer module. * - * Version: @(#)pit.h 1.0.7 2019/05/05 + * Version: @(#)pit.h 1.0.8 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -47,7 +47,7 @@ typedef struct { typedef struct PIT { uint32_t l[3]; - int64_t c[3]; + tmrval_t c[3]; uint8_t m[3]; uint8_t ctrl, ctrls[3]; @@ -60,7 +60,7 @@ typedef struct PIT { int rereadlatch[3]; int gate[3]; int out[3]; - int64_t running[3]; + tmrval_t running[3]; int enabled[3]; int newcount[3]; int count[3]; diff --git a/src/devices/system/ppi.c b/src/devices/system/ppi.c index 4a32848..056abe6 100644 --- a/src/devices/system/ppi.c +++ b/src/devices/system/ppi.c @@ -14,7 +14,7 @@ * CX is loops between bit 4 of $62 changing * BX is timer difference between calls * - * Version: @(#)ppi.c 1.0.2 2018/05/06 + * Version: @(#)ppi.c 1.0.3 2018/05/17 * * Author: Sarah Walker, * @@ -42,6 +42,8 @@ #include #include #include +#include "../../emu.h" +#include "../../timer.h" #include "pit.h" #include "ppi.h" diff --git a/src/devices/video/vid_ati18800.c b/src/devices/video/vid_ati18800.c index 29e0f64..29837d8 100644 --- a/src/devices/video/vid_ati18800.c +++ b/src/devices/video/vid_ati18800.c @@ -8,7 +8,7 @@ * * ATI 18800 emulation (VGA Edge-16) * - * Version: @(#)vid_ati18800.c 1.0.14 2019/05/13 + * Version: @(#)vid_ati18800.c 1.0.15 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" diff --git a/src/devices/video/vid_ati28800.c b/src/devices/video/vid_ati28800.c index 94df5b7..ec10209 100644 --- a/src/devices/video/vid_ati28800.c +++ b/src/devices/video/vid_ati28800.c @@ -8,7 +8,7 @@ * * ATI 28800 emulation (VGA Charger and Korean VGA) * - * Version: @(#)vid_ati28800.c 1.0.22 2019/05/13 + * Version: @(#)vid_ati28800.c 1.0.23 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -43,6 +43,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" diff --git a/src/devices/video/vid_ati68860_ramdac.c b/src/devices/video/vid_ati68860_ramdac.c index 60d6cd9..dcd1cb3 100644 --- a/src/devices/video/vid_ati68860_ramdac.c +++ b/src/devices/video/vid_ati68860_ramdac.c @@ -28,7 +28,7 @@ * 7 If set can remove "snow" in some cases * (A860_Delay_L ?) ?? * - * Version: @(#)vid_ati68860.c 1.0.6 2019/04/10 + * Version: @(#)vid_ati68860.c 1.0.7 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -62,6 +62,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../mem.h" #include "../../device.h" #include "../../plat.h" diff --git a/src/devices/video/vid_ati_eeprom.c b/src/devices/video/vid_ati_eeprom.c index c53f7ae..dd657ac 100644 --- a/src/devices/video/vid_ati_eeprom.c +++ b/src/devices/video/vid_ati_eeprom.c @@ -8,7 +8,7 @@ * * Emulation of the EEPROM on select ATI cards. * - * Version: @(#)vid_ati_eeprom.c 1.0.5 2019/03/03 + * Version: @(#)vid_ati_eeprom.c 1.0.6 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -41,6 +41,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../mem.h" #include "../../nvr.h" #include "../../plat.h" diff --git a/src/devices/video/vid_ati_mach64.c b/src/devices/video/vid_ati_mach64.c index da4f470..b0c2b0b 100644 --- a/src/devices/video/vid_ati_mach64.c +++ b/src/devices/video/vid_ati_mach64.c @@ -8,7 +8,7 @@ * * ATi Mach64 graphics card emulation. * - * Version: @(#)vid_ati_mach64.c 1.0.20 2019/05/13 + * Version: @(#)vid_ati_mach64.c 1.0.21 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../device.h" #include "../../io.h" #include "../../mem.h" diff --git a/src/devices/video/vid_att20c49x_ramdac.c b/src/devices/video/vid_att20c49x_ramdac.c index 1af8c38..334f3cf 100644 --- a/src/devices/video/vid_att20c49x_ramdac.c +++ b/src/devices/video/vid_att20c49x_ramdac.c @@ -8,7 +8,7 @@ * * Emulation of a AT&T 20c490/491 and 492/493 RAMDAC. * - * Version: @(#)vid_att20c49x_ramdac.c 1.0.3 2019/04/10 + * Version: @(#)vid_att20c49x_ramdac.c 1.0.4 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -40,6 +40,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../mem.h" #include "../../device.h" #include "../../plat.h" diff --git a/src/devices/video/vid_bt48x_ramdac.c b/src/devices/video/vid_bt48x_ramdac.c index 462e738..2aa2070 100644 --- a/src/devices/video/vid_bt48x_ramdac.c +++ b/src/devices/video/vid_bt48x_ramdac.c @@ -8,7 +8,7 @@ * * Brooktree Bt48x series true color RAMDAC emulation. * - * Version: @(#)vid_bt48x_ramdac.c 1.0.15 2019/05/03 + * Version: @(#)vid_bt48x_ramdac.c 1.0.16 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -40,6 +40,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../mem.h" #include "../../device.h" #include "../../plat.h" diff --git a/src/devices/video/vid_cga.c b/src/devices/video/vid_cga.c index d834147..1483889 100644 --- a/src/devices/video/vid_cga.c +++ b/src/devices/video/vid_cga.c @@ -8,7 +8,7 @@ * * Emulation of the old and new IBM CGA graphics cards. * - * Version: @(#)vid_cga.c 1.0.19 2019/05/13 + * Version: @(#)vid_cga.c 1.0.20 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -43,11 +43,11 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../cpu/cpu.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../plat.h" #include "../system/clk.h" @@ -140,8 +140,8 @@ cga_recalctimings(cga_t *dev) _dispontime = _dispontime * CGACONST; _dispofftime = _dispofftime * CGACONST; - dev->dispontime = (int64_t)(_dispontime * (1LL << TIMER_SHIFT)); - dev->dispofftime = (int64_t)(_dispofftime * (1LL << TIMER_SHIFT)); + dev->dispontime = (tmrval_t)(_dispontime * (1LL << TIMER_SHIFT)); + dev->dispofftime = (tmrval_t)(_dispofftime * (1LL << TIMER_SHIFT)); } diff --git a/src/devices/video/vid_cga.h b/src/devices/video/vid_cga.h index d11785d..6d7a3fa 100644 --- a/src/devices/video/vid_cga.h +++ b/src/devices/video/vid_cga.h @@ -8,7 +8,7 @@ * * Definitions for the CGA driver. * - * Version: @(#)vid_cga.h 1.0.9 2019/05/13 + * Version: @(#)vid_cga.h 1.0.10 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -64,9 +64,9 @@ typedef struct { uint16_t ma, maback; int oddeven; - int64_t dispontime, + tmrval_t dispontime, dispofftime; - int64_t vidtime; + tmrval_t vidtime; int firstline, lastline; diff --git a/src/devices/video/vid_cga_comp.c b/src/devices/video/vid_cga_comp.c index 616a777..0021661 100644 --- a/src/devices/video/vid_cga_comp.c +++ b/src/devices/video/vid_cga_comp.c @@ -15,7 +15,7 @@ * * Reworked to have its data on the heap. * - * Version: @(#)vid_cga_comp.c 1.0.8 2019/05/13 + * Version: @(#)vid_cga_comp.c 1.0.9 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -50,6 +50,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../mem.h" #include "video.h" #include "vid_cga.h" diff --git a/src/devices/video/vid_cl54xx.c b/src/devices/video/vid_cl54xx.c index a014f00..6e4c1ef 100644 --- a/src/devices/video/vid_cl54xx.c +++ b/src/devices/video/vid_cl54xx.c @@ -9,7 +9,7 @@ * Emulation of select Cirrus Logic cards (CL-GD 5428, * CL-GD 5429, 5430, 5434 and 5436 are supported). * - * Version: @(#)vid_cl54xx.c 1.0.30 2019/05/13 + * Version: @(#)vid_cl54xx.c 1.0.31 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -47,6 +47,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../cpu/cpu.h" #include "../../io.h" #include "../../mem.h" diff --git a/src/devices/video/vid_ega.c b/src/devices/video/vid_ega.c index 069a2b4..a7628c0 100644 --- a/src/devices/video/vid_ega.c +++ b/src/devices/video/vid_ega.c @@ -9,7 +9,7 @@ * Emulation of the EGA, Chips & Technologies SuperEGA, and * AX JEGA graphics cards. * - * Version: @(#)vid_ega.c 1.0.20 2019/05/13 + * Version: @(#)vid_ega.c 1.0.21 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -43,11 +43,11 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../cpu/cpu.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../plat.h" #include "../system/clk.h" @@ -318,8 +318,8 @@ ega_recalctimings(ega_t *dev) _dispontime = _dispontime * crtcconst; _dispofftime = _dispofftime * crtcconst; - dev->dispontime = (int64_t)(_dispontime * (1LL << TIMER_SHIFT)); - dev->dispofftime = (int64_t)(_dispofftime * (1LL << TIMER_SHIFT)); + dev->dispontime = (tmrval_t)(_dispontime * (1LL << TIMER_SHIFT)); + dev->dispofftime = (tmrval_t)(_dispofftime * (1LL << TIMER_SHIFT)); } diff --git a/src/devices/video/vid_ega.h b/src/devices/video/vid_ega.h index 9928e98..b8ce9c0 100644 --- a/src/devices/video/vid_ega.h +++ b/src/devices/video/vid_ega.h @@ -8,7 +8,7 @@ * * Definitions for the IBM EGA driver. * - * Version: @(#)vid_ega.h 1.0.6 2019/05/13 + * Version: @(#)vid_ega.h 1.0.7 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -120,8 +120,8 @@ typedef struct { int vres; - int64_t dispontime, dispofftime; - int64_t vidtime; + tmrval_t dispontime, dispofftime; + tmrval_t vidtime; uint8_t scrblank; diff --git a/src/devices/video/vid_ega_render.c b/src/devices/video/vid_ega_render.c index fc73418..572b706 100644 --- a/src/devices/video/vid_ega_render.c +++ b/src/devices/video/vid_ega_render.c @@ -9,7 +9,7 @@ * EGA renderers. * NOTE: FIXME: make sure this works (line 99 shadow parameter) * - * Version: @(#)vid_ega_render.c 1.0.6 2019/05/05 + * Version: @(#)vid_ega_render.c 1.0.7 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../mem.h" #include "../../rom.h" #include "../../device.h" diff --git a/src/devices/video/vid_et4000.c b/src/devices/video/vid_et4000.c index 4122dd2..5f3adfc 100644 --- a/src/devices/video/vid_et4000.c +++ b/src/devices/video/vid_et4000.c @@ -8,7 +8,7 @@ * * Emulation of the Tseng Labs ET4000. * - * Version: @(#)vid_et4000.c 1.0.17 2019/05/13 + * Version: @(#)vid_et4000.c 1.0.18 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -43,6 +43,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" diff --git a/src/devices/video/vid_et4000w32.c b/src/devices/video/vid_et4000w32.c index 2d6ba6f..ed6e04e 100644 --- a/src/devices/video/vid_et4000w32.c +++ b/src/devices/video/vid_et4000w32.c @@ -12,7 +12,7 @@ * * FIXME: Note the madness on line 1163, fix that somehow? --FvK * - * Version: @(#)vid_et4000w32.c 1.0.21 2019/05/13 + * Version: @(#)vid_et4000w32.c 1.0.23 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -46,6 +46,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../cpu/cpu.h" #include "../../io.h" #include "../../mem.h" diff --git a/src/devices/video/vid_genius.c b/src/devices/video/vid_genius.c index efc3eac..9d1293c 100644 --- a/src/devices/video/vid_genius.c +++ b/src/devices/video/vid_genius.c @@ -63,7 +63,7 @@ * reducing the height of characters so they fit in an 8x12 cell * if necessary. * - * Version: @(#)vid_genius.c 1.0.16 2019/05/13 + * Version: @(#)vid_genius.c 1.0.17 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -97,10 +97,10 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../plat.h" #include "../system/clk.h" @@ -144,13 +144,13 @@ typedef struct { int enabled; /* Display enabled, 0 or 1 */ int detach; /* Detach cursor, 0 or 1 */ - int64_t dispontime, dispofftime; - int64_t vidtime; + tmrval_t dispontime, dispofftime; + tmrval_t vidtime; + tmrval_t vsynctime; int linepos, displine; int vc; int dispon, blink; - int64_t vsynctime; uint32_t pal[4]; @@ -174,8 +174,8 @@ recalc_timings(genius_t *dev) _dispontime *= MDACONST; _dispofftime *= MDACONST; - dev->dispontime = (int64_t)(_dispontime * (1LL << TIMER_SHIFT)); - dev->dispofftime = (int64_t)(_dispofftime * (1LL << TIMER_SHIFT)); + dev->dispontime = (tmrval_t)(_dispontime * (1LL << TIMER_SHIFT)); + dev->dispofftime = (tmrval_t)(_dispofftime * (1LL << TIMER_SHIFT)); } diff --git a/src/devices/video/vid_hercules.c b/src/devices/video/vid_hercules.c index 32c6e81..ec4e5f7 100644 --- a/src/devices/video/vid_hercules.c +++ b/src/devices/video/vid_hercules.c @@ -8,7 +8,7 @@ * * Hercules emulation. * - * Version: @(#)vid_hercules.c 1.0.21 2019/05/13 + * Version: @(#)vid_hercules.c 1.0.22 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,12 +42,12 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../config.h" #include "../../io.h" #include "../../cpu/cpu.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../plat.h" #include "../system/clk.h" @@ -65,9 +65,10 @@ typedef struct { ctrl2, stat; - int64_t dispontime, + tmrval_t dispontime, dispofftime; - int64_t vidtime; + tmrval_t vidtime; + tmrval_t vsynctime; int firstline, lastline; @@ -84,7 +85,6 @@ typedef struct { blink; int vadj; int blend; - int64_t vsynctime; uint8_t cols[256][2][2]; @@ -107,8 +107,8 @@ recalc_timings(hercules_t *dev) _dispontime *= MDACONST; _dispofftime *= MDACONST; - dev->dispontime = (int64_t)(_dispontime * (1LL << TIMER_SHIFT)); - dev->dispofftime = (int64_t)(_dispofftime * (1LL << TIMER_SHIFT)); + dev->dispontime = (tmrval_t)(_dispontime * (1LL << TIMER_SHIFT)); + dev->dispofftime = (tmrval_t)(_dispofftime * (1LL << TIMER_SHIFT)); } diff --git a/src/devices/video/vid_herculesplus.c b/src/devices/video/vid_herculesplus.c index a168a7b..a9d179e 100644 --- a/src/devices/video/vid_herculesplus.c +++ b/src/devices/video/vid_herculesplus.c @@ -8,7 +8,7 @@ * * Hercules Plus emulation. * - * Version: @(#)vid_hercules_plus.c 1.0.22 2019/05/13 + * Version: @(#)vid_hercules_plus.c 1.0.23 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -43,10 +43,10 @@ #include #include "../../emu.h" #include "../../config.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../plat.h" #include "../system/clk.h" @@ -92,8 +92,9 @@ typedef struct { uint8_t ctrl, ctrl2, stat; - int64_t dispontime, dispofftime; - int64_t vidtime; + tmrval_t dispontime, dispofftime; + tmrval_t vidtime; + tmrval_t vsynctime; int firstline, lastline; @@ -104,7 +105,6 @@ typedef struct { int dispon, blink; int vadj; int blend; - int64_t vsynctime; uint8_t cols[256][2][2]; @@ -124,8 +124,8 @@ recalc_timings(herculesplus_t *dev) _dispontime *= MDACONST; _dispofftime *= MDACONST; - dev->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); - dev->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); + dev->dispontime = (tmrval_t)(_dispontime * (1 << TIMER_SHIFT)); + dev->dispofftime = (tmrval_t)(_dispofftime * (1 << TIMER_SHIFT)); } diff --git a/src/devices/video/vid_ht216.c b/src/devices/video/vid_ht216.c index 8532fe3..6a97cf6 100644 --- a/src/devices/video/vid_ht216.c +++ b/src/devices/video/vid_ht216.c @@ -8,7 +8,7 @@ * * Video7 VGA 1024i emulation. * - * Version: @(#)vid_ht216.c 1.0.5 2019/05/13 + * Version: @(#)vid_ht216.c 1.0.6 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -43,11 +43,11 @@ #include #include "../../emu.h" #include "../../config.h" +#include "../../timer.h" #include "../../io.h" #include "../../cpu/cpu.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../plat.h" #include "video.h" diff --git a/src/devices/video/vid_im1024.c b/src/devices/video/vid_im1024.c index 2891a08..1b0de90 100644 --- a/src/devices/video/vid_im1024.c +++ b/src/devices/video/vid_im1024.c @@ -38,7 +38,7 @@ * This is implemented by holding a FIFO of unlimited depth in * the IM1024 to receive the data. * - * Version: @(#)vid_im1024.c 1.0.5 2019/05/13 + * Version: @(#)vid_im1024.c 1.0.6 2019/05/17 * * Authors: Fred N. van Kempen, * John Elliott, @@ -71,10 +71,10 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../plat.h" #include "../system/pit.h" diff --git a/src/devices/video/vid_incolor.c b/src/devices/video/vid_incolor.c index a4666c3..71b31aa 100644 --- a/src/devices/video/vid_incolor.c +++ b/src/devices/video/vid_incolor.c @@ -8,7 +8,7 @@ * * Hercules InColor emulation. * - * Version: @(#)vid_incolor.c 1.0.20 2019/05/13 + * Version: @(#)vid_incolor.c 1.0.21 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -43,10 +43,10 @@ #include #include "../../emu.h" #include "../../config.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../plat.h" #include "../system/clk.h" @@ -185,8 +185,9 @@ typedef struct { uint8_t ctrl, ctrl2, stat; - int64_t dispontime, dispofftime; - int64_t vidtime; + tmrval_t dispontime, dispofftime; + tmrval_t vidtime; + tmrval_t vsynctime; int firstline, lastline; @@ -195,7 +196,6 @@ typedef struct { uint16_t ma, maback; int con, coff, cursoron; int dispon, blink; - int64_t vsynctime; int vadj; uint8_t palette[16]; /* EGA-style 16 -> 64 palette registers */ @@ -220,8 +220,8 @@ recalc_timings(incolor_t *dev) _dispontime *= MDACONST; _dispofftime *= MDACONST; - dev->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); - dev->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); + dev->dispontime = (tmrval_t)(_dispontime * (1 << TIMER_SHIFT)); + dev->dispofftime = (tmrval_t)(_dispofftime * (1 << TIMER_SHIFT)); } diff --git a/src/devices/video/vid_mda.c b/src/devices/video/vid_mda.c index 1fcc5ce..3cc570f 100644 --- a/src/devices/video/vid_mda.c +++ b/src/devices/video/vid_mda.c @@ -8,7 +8,7 @@ * * MDA emulation. * - * Version: @(#)vid_mda.c 1.0.17 2019/05/13 + * Version: @(#)vid_mda.c 1.0.18 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -43,10 +43,10 @@ #include #include "../../emu.h" #include "../../config.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../plat.h" #include "../system/clk.h" @@ -69,8 +69,8 @@ mda_recalctimings(mda_t *dev) _dispontime *= MDACONST; _dispofftime *= MDACONST; - dev->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); - dev->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); + dev->dispontime = (tmrval_t)(_dispontime * (1 << TIMER_SHIFT)); + dev->dispofftime = (tmrval_t)(_dispofftime * (1 << TIMER_SHIFT)); } diff --git a/src/devices/video/vid_mda.h b/src/devices/video/vid_mda.h index 1cfb774..1ab5e45 100644 --- a/src/devices/video/vid_mda.h +++ b/src/devices/video/vid_mda.h @@ -8,7 +8,7 @@ * * Definitions for the MDA driver. * - * Version: @(#)vid_mda.h 1.0.2 2019/05/13 + * Version: @(#)vid_mda.h 1.0.3 2019/05/17 * * Authors: Fred N. van Kempen, * @@ -49,8 +49,9 @@ typedef struct { uint8_t ctrl, stat; - int64_t dispontime, dispofftime; - int64_t vidtime; + tmrval_t dispontime, dispofftime; + tmrval_t vidtime; + tmrval_t vsynctime; int firstline, lastline; @@ -59,7 +60,6 @@ typedef struct { uint16_t ma, maback; int con, coff, cursoron; int dispon, blink; - int64_t vsynctime; int vadj; uint8_t cols[256][2][2]; diff --git a/src/devices/video/vid_oak_oti.c b/src/devices/video/vid_oak_oti.c index 248e457..9e36b92 100644 --- a/src/devices/video/vid_oak_oti.c +++ b/src/devices/video/vid_oak_oti.c @@ -8,7 +8,7 @@ * * Oak OTI037C/67/077 emulation. * - * Version: @(#)vid_oak_oti.c 1.0.17 2019/05/13 + * Version: @(#)vid_oak_oti.c 1.0.18 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" diff --git a/src/devices/video/vid_paradise.c b/src/devices/video/vid_paradise.c index 71b80ed..eb8e214 100644 --- a/src/devices/video/vid_paradise.c +++ b/src/devices/video/vid_paradise.c @@ -13,7 +13,7 @@ * NOTE: The MegaPC video device should be moved to the MegaPC * machine file. * - * Version: @(#)vid_paradise.c 1.0.11 2019/05/13 + * Version: @(#)vid_paradise.c 1.0.12 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -47,6 +47,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" diff --git a/src/devices/video/vid_pgc.c b/src/devices/video/vid_pgc.c index 5409110..12c6c4c 100644 --- a/src/devices/video/vid_pgc.c +++ b/src/devices/video/vid_pgc.c @@ -44,7 +44,7 @@ * * This is expected to be done shortly. * - * Version: @(#)vid_pgc.c 1.0.6 2019/05/13 + * Version: @(#)vid_pgc.c 1.0.7 2019/05/17 * * Authors: Fred N. van Kempen, * John Elliott, @@ -78,10 +78,10 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../plat.h" #include "../system/pit.h" diff --git a/src/devices/video/vid_pgc.h b/src/devices/video/vid_pgc.h index d237035..8f30737 100644 --- a/src/devices/video/vid_pgc.h +++ b/src/devices/video/vid_pgc.h @@ -8,7 +8,7 @@ * * Definitions for the PGC driver. * - * Version: @(#)vid_pgc.h 1.0.4 2019/05/13 + * Version: @(#)vid_pgc.h 1.0.5 2019/05/73 * * Authors: Fred N. van Kempen, * John Elliott, @@ -110,7 +110,7 @@ typedef struct pgc { thread_t *pgc_thread; event_t *pgc_wake_thread; - int64_t wake_timer; + tmrval_t wake_timer; int waiting_input_fifo; int waiting_output_fifo; @@ -128,7 +128,7 @@ typedef struct pgc { uint16_t ma, maback; int oddeven; - int64_t dispontime, + tmrval_t dispontime, dispofftime, vidtime; diff --git a/src/devices/video/vid_s3.c b/src/devices/video/vid_s3.c index 2f8aa08..5713171 100644 --- a/src/devices/video/vid_s3.c +++ b/src/devices/video/vid_s3.c @@ -10,7 +10,7 @@ * * NOTE: ROM images need more/better organization per chipset. * - * Version: @(#)vid_s3.c 1.0.18 2019/05/13 + * Version: @(#)vid_s3.c 1.0.19 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -44,6 +44,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" diff --git a/src/devices/video/vid_s3_virge.c b/src/devices/video/vid_s3_virge.c index a143355..13d2b94 100644 --- a/src/devices/video/vid_s3_virge.c +++ b/src/devices/video/vid_s3_virge.c @@ -8,7 +8,7 @@ * * S3 ViRGE emulation. * - * Version: @(#)vid_s3_virge.c 1.0.19 2019/05/13 + * Version: @(#)vid_s3_virge.c 1.0.20 2019/05/73 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" diff --git a/src/devices/video/vid_sc1502x_ramdac.c b/src/devices/video/vid_sc1502x_ramdac.c index 728f077..13d176b 100644 --- a/src/devices/video/vid_sc1502x_ramdac.c +++ b/src/devices/video/vid_sc1502x_ramdac.c @@ -8,7 +8,7 @@ * * Emulation of a Sierra SC1502X RAMDAC. * - * Version: @(#)vid_sc1502x_ramdac.c 1.0.5 2019/04/10 + * Version: @(#)vid_sc1502x_ramdac.c 1.0.6 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../mem.h" #include "../../device.h" #include "../../plat.h" diff --git a/src/devices/video/vid_sdac_ramdac.c b/src/devices/video/vid_sdac_ramdac.c index 4919c0a..86e8dfb 100644 --- a/src/devices/video/vid_sdac_ramdac.c +++ b/src/devices/video/vid_sdac_ramdac.c @@ -8,7 +8,7 @@ * * 87C716 'SDAC' true colour RAMDAC emulation. * - * Version: @(#)vid_sdac_ramdac.c 1.0.8 2019/04/10 + * Version: @(#)vid_sdac_ramdac.c 1.0.9 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../mem.h" #include "../../device.h" #include "../../plat.h" diff --git a/src/devices/video/vid_sigma.c b/src/devices/video/vid_sigma.c index 8327dc2..e2f0324 100644 --- a/src/devices/video/vid_sigma.c +++ b/src/devices/video/vid_sigma.c @@ -54,7 +54,7 @@ * is well, but some strange mishaps with cursor positioning * occur. * - * Version: @(#)vid_sigma.c 1.0.11 2019/05/13 + * Version: @(#)vid_sigma.c 1.0.12 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -88,11 +88,11 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../cpu/cpu.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../plat.h" #include "../system/clk.h" @@ -226,14 +226,14 @@ typedef struct { int vsynctime, vadj; int oddeven; - int64_t dispontime, dispofftime; + tmrval_t dispontime, + dispofftime; + tmrval_t vidtime; int firstline, lastline; int plane; - int64_t vidtime; - uint8_t *vram; uint8_t fontdat[256][8]; /* 8x8 font */ uint8_t fontdat16[256][16]; /* 8x16 font */ @@ -270,8 +270,8 @@ recalc_timings(sigma_t *dev) _dispontime *= CGACONST; _dispofftime *= CGACONST; - dev->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); - dev->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); + dev->dispontime = (tmrval_t)(_dispontime * (1 << TIMER_SHIFT)); + dev->dispofftime = (tmrval_t)(_dispofftime * (1 << TIMER_SHIFT)); } diff --git a/src/devices/video/vid_stg_ramdac.c b/src/devices/video/vid_stg_ramdac.c index f7c5077..292785d 100644 --- a/src/devices/video/vid_stg_ramdac.c +++ b/src/devices/video/vid_stg_ramdac.c @@ -8,7 +8,7 @@ * * STG1702 true color RAMDAC emulation. * - * Version: @(#)vid_stg_ramdac.c 1.0.6 2019/04/10 + * Version: @(#)vid_stg_ramdac.c 1.0.7 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../mem.h" #include "../../device.h" #include "../../plat.h" diff --git a/src/devices/video/vid_svga.h b/src/devices/video/vid_svga.h index 0a03098..8f3d26e 100644 --- a/src/devices/video/vid_svga.h +++ b/src/devices/video/vid_svga.h @@ -8,7 +8,7 @@ * * Definitions for the generic SVGA driver. * - * Version: @(#)vid_svga.h 1.0.7 2019/05/13 + * Version: @(#)vid_svga.h 1.0.8 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -93,7 +93,7 @@ typedef struct svga_t PALETTE vgapal; - int64_t dispontime, dispofftime, + tmrval_t dispontime, dispofftime, vidtime; double clock; diff --git a/src/devices/video/vid_svga_render.c b/src/devices/video/vid_svga_render.c index f197878..e236401 100644 --- a/src/devices/video/vid_svga_render.c +++ b/src/devices/video/vid_svga_render.c @@ -8,7 +8,7 @@ * * SVGA renderers. * - * Version: @(#)vid_svga_render.c 1.0.16 2019/05/03 + * Version: @(#)vid_svga_render.c 1.0.17 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -41,6 +41,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../mem.h" #include "video.h" #include "vid_svga.h" diff --git a/src/devices/video/vid_tgui9440.c b/src/devices/video/vid_tgui9440.c index 8932a38..7837af3 100644 --- a/src/devices/video/vid_tgui9440.c +++ b/src/devices/video/vid_tgui9440.c @@ -47,7 +47,7 @@ * access size or host data has any affect, but the Windows 3.1 * driver always reads bytes and write words of 0xffff. * - * Version: @(#)vid_tgui9440.c 1.0.16 2019/05/13 + * Version: @(#)vid_tgui9440.c 1.0.17 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -81,6 +81,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../cpu/cpu.h" #include "../../io.h" #include "../../mem.h" diff --git a/src/devices/video/vid_ti_cf62011.c b/src/devices/video/vid_ti_cf62011.c index 9758311..91b874e 100644 --- a/src/devices/video/vid_ti_cf62011.c +++ b/src/devices/video/vid_ti_cf62011.c @@ -42,7 +42,7 @@ * which are the same as the XGA. It supports up to 1MB of VRAM, * but we lock it down to 512K. The PS/1 2122 had 256K. * - * Version: @(#)vid_ti_cf62011.c 1.0.11 2019/05/13 + * Version: @(#)vid_ti_cf62011.c 1.0.12 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -76,6 +76,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" diff --git a/src/devices/video/vid_tkd8001_ramdac.c b/src/devices/video/vid_tkd8001_ramdac.c index f5f25d2..27c180f 100644 --- a/src/devices/video/vid_tkd8001_ramdac.c +++ b/src/devices/video/vid_tkd8001_ramdac.c @@ -8,7 +8,7 @@ * * Trident TKD8001 RAMDAC emulation. * - * Version: @(#)vid_tkd8001_ramdac.c 1.0.5 2019/04/10 + * Version: @(#)vid_tkd8001_ramdac.c 1.0.6 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../mem.h" #include "../../device.h" #include "../../plat.h" diff --git a/src/devices/video/vid_tvga.c b/src/devices/video/vid_tvga.c index 9c5e7b9..3bf1695 100644 --- a/src/devices/video/vid_tvga.c +++ b/src/devices/video/vid_tvga.c @@ -8,7 +8,7 @@ * * Trident TVGA (8900B/8900C/8900D) emulation. * - * Version: @(#)vid_tvga.c 1.0.15 2019/05/13 + * Version: @(#)vid_tvga.c 1.0.16 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" diff --git a/src/devices/video/vid_vga.c b/src/devices/video/vid_vga.c index 34b0f61..19e9e0b 100644 --- a/src/devices/video/vid_vga.c +++ b/src/devices/video/vid_vga.c @@ -8,7 +8,7 @@ * * IBM VGA emulation. * - * Version: @(#)vid_vga.c 1.0.11 2019/05/13 + * Version: @(#)vid_vga.c 1.0.12 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" diff --git a/src/devices/video/vid_voodoo.c b/src/devices/video/vid_voodoo.c index 8af01bd..f35c61a 100644 --- a/src/devices/video/vid_voodoo.c +++ b/src/devices/video/vid_voodoo.c @@ -8,7 +8,7 @@ * * Emulation of the 3DFX Voodoo Graphics controller. * - * Version: @(#)vid_voodoo.c 1.0.20 2019/04/30 + * Version: @(#)vid_voodoo.c 1.0.21 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -46,9 +46,9 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../cpu/cpu.h" #include "../../mem.h" -#include "../../timer.h" #include "../../device.h" #include "../../nvr.h" #include "../../plat.h" @@ -299,7 +299,7 @@ typedef struct voodoo_t int swap_count; int disp_buffer, draw_buffer; - int64_t timer_count; + tmrval_t timer_count; int line; svga_t *svga; @@ -435,9 +435,9 @@ typedef struct voodoo_t int fb_write_buffer, fb_draw_buffer; int buffer_cutoff; - int64_t read_time, write_time, burst_time; + tmrval_t read_time, write_time, burst_time; - int64_t wake_timer; + tmrval_t wake_timer; uint8_t thefilter[256][256]; // pixel filter, feeding from one or two uint8_t thefilterg[256][256]; // for green diff --git a/src/devices/video/vid_wy700.c b/src/devices/video/vid_wy700.c index 4a3cd61..a61677e 100644 --- a/src/devices/video/vid_wy700.c +++ b/src/devices/video/vid_wy700.c @@ -53,7 +53,7 @@ * What doesn't work, is untested or not well understood: * - Cursor detach (commands 4 and 5) * - * Version: @(#)vid_wy700.c 1.0.13 2019/05/13 + * Version: @(#)vid_wy700.c 1.0.14 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -87,10 +87,10 @@ #include #include #include "../../emu.h" +#include "../../timer.h" #include "../../io.h" #include "../../mem.h" #include "../../rom.h" -#include "../../timer.h" #include "../../device.h" #include "../../plat.h" #include "../system/clk.h" @@ -224,13 +224,13 @@ typedef struct { int enabled; /* Display enabled, 0 or 1 */ int detach; /* Detach cursor, 0 or 1 */ - int64_t dispontime, dispofftime; - int64_t vidtime; + tmrval_t dispontime, dispofftime; + tmrval_t vidtime; int linepos, displine; int vc; int dispon, blink; - int64_t vsynctime; + tmrval_t vsynctime; /* Mapping of attributes to colors, in CGA emulation... */ uint8_t cgacols[256][2][2]; @@ -260,8 +260,8 @@ recalc_timings(wy700_t *dev) _dispontime *= MDACONST; _dispofftime *= MDACONST; - dev->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); - dev->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); + dev->dispontime = (tmrval_t)(_dispontime * (1 << TIMER_SHIFT)); + dev->dispofftime = (tmrval_t)(_dispofftime * (1 << TIMER_SHIFT)); } diff --git a/src/devices/video/video.h b/src/devices/video/video.h index ad94612..ff0182f 100644 --- a/src/devices/video/video.h +++ b/src/devices/video/video.h @@ -8,7 +8,7 @@ * * Definitions for the video controller module. * - * Version: @(#)video.h 1.0.35 2019/05/03 + * Version: @(#)video.h 1.0.36 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -71,9 +71,8 @@ enum { enum { FULLSCR_SCALE_FULL = 0, FULLSCR_SCALE_43, - FULLSCR_SCALE_SQ, - FULLSCR_SCALE_INT, - FULLSCR_SCALE_KEEPRATIO + FULLSCR_SCALE_KEEPRATIO, + FULLSCR_SCALE_INT }; typedef enum { diff --git a/src/machines/m_acer.c b/src/machines/m_acer.c index 38f30ba..59fb4eb 100644 --- a/src/machines/m_acer.c +++ b/src/machines/m_acer.c @@ -57,7 +57,6 @@ #include "../devices/input/keyboard.h" #include "../devices/sio/sio.h" #include "../devices/disk/hdc.h" -#include "../devices/disk/hdc_ide.h" #include "machine.h" diff --git a/src/machines/m_ali.c b/src/machines/m_ali.c index 643eabd..fd5c967 100644 --- a/src/machines/m_ali.c +++ b/src/machines/m_ali.c @@ -8,7 +8,7 @@ * * Implementation of the ALi-based machines. * - * Version: @(#)m_ali.c 1.0.9 2019/05/13 + * Version: @(#)m_ali.c 1.0.10 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -51,7 +51,6 @@ #include "../devices/floppy/fdd.h" #include "../devices/floppy/fdc.h" #include "../devices/disk/hdc.h" -#include "../devices/disk/hdc_ide.h" #include "machine.h" diff --git a/src/machines/m_amstrad_vid.c b/src/machines/m_amstrad_vid.c index 474dc63..29a082e 100644 --- a/src/machines/m_amstrad_vid.c +++ b/src/machines/m_amstrad_vid.c @@ -25,7 +25,7 @@ * by the ROS. * PPC: MDA Monitor results in half-screen, half-cell-height display?? * - * Version: @(#)m_amstrad_vid.c 1.0.5 2019/05/13 + * Version: @(#)m_amstrad_vid.c 1.0.6 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -60,11 +60,11 @@ #include #define dbglog video_card_log #include "../emu.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../io.h" #include "../mem.h" #include "../rom.h" -#include "../timer.h" #include "../device.h" #include "../devices/system/clk.h" #include "../devices/system/nmi.h" @@ -123,14 +123,16 @@ typedef struct { int con, coff, cursoron, cgablink; - int64_t vsynctime; int vadj; uint16_t ma, maback; int dispon; int blink; - int64_t dispontime, /* 1512/1640 */ + + tmrval_t vsynctime; + tmrval_t dispontime, /* 1512/1640 */ dispofftime; /* 1512/1640 */ - int64_t vidtime; /* 1512/1640 */ + tmrval_t vidtime; /* 1512/1640 */ + int firstline, lastline; uint8_t *vram; @@ -205,8 +207,8 @@ pc1512_recalc_timings(vid_t *dev) _dispontime *= CGACONST; _dispofftime *= CGACONST; - dev->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); - dev->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); + dev->dispontime = (tmrval_t)(_dispontime * (1 << TIMER_SHIFT)); + dev->dispofftime = (tmrval_t)(_dispofftime * (1 << TIMER_SHIFT)); } diff --git a/src/machines/m_aopen.c b/src/machines/m_aopen.c index 2648ef1..dbb5340 100644 --- a/src/machines/m_aopen.c +++ b/src/machines/m_aopen.c @@ -58,7 +58,6 @@ #include "../devices/floppy/fdd.h" #include "../devices/floppy/fdc.h" #include "../devices/disk/hdc.h" -#include "../devices/disk/hdc_ide.h" #include "../devices/video/video.h" #include "machine.h" diff --git a/src/machines/m_asus.c b/src/machines/m_asus.c index 615f298..ff9ee32 100644 --- a/src/machines/m_asus.c +++ b/src/machines/m_asus.c @@ -56,7 +56,6 @@ #include "../devices/input/keyboard.h" #include "../devices/sio/sio.h" #include "../devices/disk/hdc.h" -#include "../devices/disk/hdc_ide.h" #include "machine.h" diff --git a/src/machines/m_at.c b/src/machines/m_at.c index 61e00a6..f92de9a 100644 --- a/src/machines/m_at.c +++ b/src/machines/m_at.c @@ -8,7 +8,7 @@ * * Standard PC/AT implementation. * - * Version: @(#)m_at.c 1.0.15 2019/05/13 + * Version: @(#)m_at.c 1.0.16 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -41,6 +41,7 @@ #include #include #include "../emu.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../mem.h" #include "../device.h" @@ -93,7 +94,7 @@ m_at_common_ide_init(void) { m_at_common_init(); - device_add(&ide_isa_2ch_opt_device); + device_add(&ide_isa_device); } @@ -102,7 +103,7 @@ m_at_ide_init(void) { m_at_init(); - device_add(&ide_isa_2ch_opt_device); + device_add(&ide_isa_device); } @@ -111,7 +112,7 @@ m_at_ps2_ide_init(void) { m_at_ps2_init(); - device_add(&ide_isa_2ch_opt_device); + device_add(&ide_isa_device); } diff --git a/src/machines/m_compaq.c b/src/machines/m_compaq.c index 47e5934..e2eae9b 100644 --- a/src/machines/m_compaq.c +++ b/src/machines/m_compaq.c @@ -14,7 +14,7 @@ * (which is in m_compaq_vid.c), the Portable 3 needs the * Plasma driver, there are some ROM issues, etc. * - * Version: @(#)m_compaq.c 1.0.14 2019/05/13 + * Version: @(#)m_compaq.c 1.0.15 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -50,6 +50,7 @@ #include #include "../emu.h" #include "../config.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../mem.h" #include "../rom.h" @@ -61,7 +62,6 @@ #include "../devices/floppy/fdd.h" #include "../devices/floppy/fdc.h" #include "../devices/disk/hdc.h" -#include "../devices/disk/hdc_ide.h" #include "../devices/video/video.h" #include "machine.h" #include "m_compaq.h" diff --git a/src/machines/m_compaq_vid.c b/src/machines/m_compaq_vid.c index 738fb82..0f32355 100644 --- a/src/machines/m_compaq_vid.c +++ b/src/machines/m_compaq_vid.c @@ -19,7 +19,7 @@ * plasma display. The code for this was taken from the code * for the Toshiba 3100e machine, which used a similar display. * - * Version: @(#)m_compaq_vid.c 1.0.3 2019/05/13 + * Version: @(#)m_compaq_vid.c 1.0.4 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -54,12 +54,12 @@ #include #include #include "../emu.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../io.h" #include "../mem.h" #include "../rom.h" #include "../device.h" -#include "../timer.h" #include "../plat.h" #include "../devices/system/nmi.h" #include "../devices/system/pit.h" @@ -90,11 +90,10 @@ typedef struct { cga_t cga; mem_map_t cga_mapping; - int64_t dispontime, + tmrval_t dispontime, dispofftime; - int64_t vsynctime; - - int64_t vidtime; + tmrval_t vsynctime; + tmrval_t vidtime; int linepos, displine; int lineff; @@ -140,8 +139,8 @@ recalc_timings(vid_t *dev) _dispontime = 640; _dispofftime = disptime - _dispontime; - dev->dispontime = (int64_t)(_dispontime * (1LL << TIMER_SHIFT)); - dev->dispofftime = (int64_t)(_dispofftime * (1LL << TIMER_SHIFT)); + dev->dispontime = (tmrval_t)(_dispontime * (1LL << TIMER_SHIFT)); + dev->dispofftime = (tmrval_t)(_dispofftime * (1LL << TIMER_SHIFT)); } diff --git a/src/machines/m_europc.c b/src/machines/m_europc.c index 347388a..5a02f53 100644 --- a/src/machines/m_europc.c +++ b/src/machines/m_europc.c @@ -69,7 +69,7 @@ * FIXME: Find a new way to handle the switching of color/mono on * external cards. New video_get_type(int card) function? * - * Version: @(#)m_europc.c 1.0.26 2019/05/13 + * Version: @(#)m_europc.c 1.0.27 2019/05/17 * * Author: Fred N. van Kempen, * @@ -118,6 +118,7 @@ #include #include "../emu.h" #include "../config.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../io.h" #include "../mem.h" diff --git a/src/machines/m_intel4x0.c b/src/machines/m_intel4x0.c index 10b89cb..7ca9883 100644 --- a/src/machines/m_intel4x0.c +++ b/src/machines/m_intel4x0.c @@ -8,7 +8,7 @@ * * Implementation of the Intel 430/440-based machines. * - * Version: @(#)m_intel4x0.c 1.0.8 2019/05/13 + * Version: @(#)m_intel4x0.c 1.0.9 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -57,7 +57,6 @@ #include "../devices/input/keyboard.h" #include "../devices/sio/sio.h" #include "../devices/disk/hdc.h" -#include "../devices/disk/hdc_ide.h" #include "../devices/video/video.h" #include "machine.h" diff --git a/src/machines/m_laserxt.c b/src/machines/m_laserxt.c index 49d94d1..a3bbbb1 100644 --- a/src/machines/m_laserxt.c +++ b/src/machines/m_laserxt.c @@ -8,7 +8,7 @@ * * Emulation of the Laser XT series of machines. * - * Version: @(#)m_laserxt.c 1.0.13 2019/05/13 + * Version: @(#)m_laserxt.c 1.0.14 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #include #include #include "../emu.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../io.h" #include "../mem.h" diff --git a/src/machines/m_misc.c b/src/machines/m_misc.c index d8694fa..80d672b 100644 --- a/src/machines/m_misc.c +++ b/src/machines/m_misc.c @@ -58,7 +58,6 @@ #include "../devices/floppy/fdd.h" #include "../devices/floppy/fdc.h" #include "../devices/disk/hdc.h" -#include "../devices/disk/hdc_ide.h" #include "../devices/video/video.h" #include "machine.h" diff --git a/src/machines/m_olim24_vid.c b/src/machines/m_olim24_vid.c index 829609b..5bcaf51 100644 --- a/src/machines/m_olim24_vid.c +++ b/src/machines/m_olim24_vid.c @@ -8,7 +8,7 @@ * * Emulation of the Olivetti M24 built-in video controller. * - * Version: @(#)m_olim24_vid.c 1.0.5 2019/05/13 + * Version: @(#)m_olim24_vid.c 1.0.6 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -44,9 +44,9 @@ #include #define dbglog kbd_log #include "../emu.h" +#include "../timer.h" #include "../io.h" #include "../mem.h" -#include "../timer.h" #include "../device.h" #include "../devices/system/clk.h" #include "../devices/video/video.h" @@ -70,13 +70,15 @@ typedef struct { int linepos, displine; int sc, vc; int con, coff, cursoron, blink; - int64_t vsynctime; int vadj; int lineff; uint16_t ma, maback; int dispon; - int64_t dispontime, dispofftime; - int64_t vidtime; + + tmrval_t vsynctime, + dispontime, dispofftime, + vidtime; + int firstline, lastline; } olivid_t; @@ -105,8 +107,8 @@ recalc_timings(olivid_t *dev) _dispofftime = disptime - _dispontime; _dispontime *= CGACONST / 2; _dispofftime *= CGACONST / 2; - dev->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); - dev->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); + dev->dispontime = (tmrval_t)(_dispontime * (1 << TIMER_SHIFT)); + dev->dispofftime = (tmrval_t)(_dispofftime * (1 << TIMER_SHIFT)); } diff --git a/src/machines/m_pbell.c b/src/machines/m_pbell.c index 56e0025..cde2a78 100644 --- a/src/machines/m_pbell.c +++ b/src/machines/m_pbell.c @@ -47,6 +47,7 @@ #include #include "../emu.h" #include "../config.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../io.h" #include "../mem.h" diff --git a/src/machines/m_pcjr.c b/src/machines/m_pcjr.c index fd5faa9..2d423f2 100644 --- a/src/machines/m_pcjr.c +++ b/src/machines/m_pcjr.c @@ -8,7 +8,7 @@ * * Emulation of the IBM PCjr. * - * Version: @(#)m_pcjr.c 1.0.22 2019/05/13 + * Version: @(#)m_pcjr.c 1.0.23 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -44,10 +44,10 @@ #include #include "../emu.h" #include "../config.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../io.h" #include "../mem.h" -#include "../timer.h" #include "../device.h" #include "../devices/system/clk.h" #include "../devices/system/nmi.h" @@ -101,10 +101,12 @@ typedef struct { int sc, vc; int dispon; int con, coff, cursoron, blink; - int64_t vsynctime; int vadj; uint16_t ma, maback; - int64_t dispontime, dispofftime, vidtime; + + tmrval_t vsynctime, + dispontime, dispofftime, vidtime; + int firstline, lastline; void *cpriv; @@ -159,8 +161,8 @@ recalc_timings(pcjr_t *dev) _dispofftime = disptime - _dispontime; _dispontime *= CGACONST; _dispofftime *= CGACONST; - dev->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); - dev->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); + dev->dispontime = (tmrval_t)(_dispontime * (1 << TIMER_SHIFT)); + dev->dispofftime = (tmrval_t)(_dispofftime * (1 << TIMER_SHIFT)); } diff --git a/src/machines/m_ps1.c b/src/machines/m_ps1.c index a5a0f14..0bd42c0 100644 --- a/src/machines/m_ps1.c +++ b/src/machines/m_ps1.c @@ -56,12 +56,12 @@ #include #include #include "../emu.h" +#include "../timer.h" #include "../config.h" #include "../cpu/cpu.h" #include "../io.h" #include "../mem.h" #include "../rom.h" -#include "../timer.h" #include "../device.h" #include "../nvr.h" #include "../devices/system/dma.h" @@ -89,10 +89,12 @@ typedef struct { sn76489_t sn76489; uint8_t status, ctrl; - int64_t timer_latch, timer_count; - int64_t timer_enable; + tmrval_t timer_latch, + timer_count; + tmrval_t timer_enable; uint8_t fifo[2048]; - int fifo_read_idx, fifo_write_idx; + int fifo_read_idx, + fifo_write_idx; int fifo_threshold; uint8_t dac_val; int16_t buffer[SOUNDBUFLEN]; @@ -193,7 +195,7 @@ snd_write(uint16_t port, uint8_t val, priv_t priv) case 3: /* timer reload value */ snd->timer_latch = val; - snd->timer_count = (int64_t) ((0xff-val) * TIMER_USEC); + snd->timer_count = (tmrval_t) ((0xff-val) * TIMER_USEC); snd->timer_enable = (val != 0); break; diff --git a/src/machines/m_ps1_hdc.c b/src/machines/m_ps1_hdc.c index 74ffd70..1ae6695 100644 --- a/src/machines/m_ps1_hdc.c +++ b/src/machines/m_ps1_hdc.c @@ -43,7 +43,7 @@ * Type table with the main code, so the user can only select * items from that list... * - * Version: @(#)m_ps1_hdc.c 1.0.13 2018/05/13 + * Version: @(#)m_ps1_hdc.c 1.0.14 2018/05/17 * * Author: Fred N. van Kempen, * @@ -92,8 +92,8 @@ #include #define dbglog hdc_log #include "../emu.h" -#include "../io.h" #include "../timer.h" +#include "../io.h" #include "../device.h" #include "../devices/system/dma.h" #include "../devices/system/pic.h" @@ -391,7 +391,7 @@ typedef struct { priv_t sys; /* handle to system board */ /* Controller state. */ - int64_t callback; + tmrval_t callback; int8_t state, /* controller state */ reset; /* reset state counter */ diff --git a/src/machines/m_ps2_isa.c b/src/machines/m_ps2_isa.c index 173f124..b5e912b 100644 --- a/src/machines/m_ps2_isa.c +++ b/src/machines/m_ps2_isa.c @@ -8,7 +8,7 @@ * * Implementation of ISA-based PS/2 machines. * - * Version: @(#)m_ps2_isa.c 1.0.20 2019/05/15 + * Version: @(#)m_ps2_isa.c 1.0.21 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #include #include #include "../emu.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../io.h" #include "../mem.h" diff --git a/src/machines/m_ps2_mca.c b/src/machines/m_ps2_mca.c index 1f63dfd..bf0db47 100644 --- a/src/machines/m_ps2_mca.c +++ b/src/machines/m_ps2_mca.c @@ -48,7 +48,7 @@ * * This works around the timing loop mentioned above. * - * Version: @(#)m_ps2_mca.c 1.0.26 2019/05/15 + * Version: @(#)m_ps2_mca.c 1.0.27 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -83,6 +83,7 @@ #include #include "../emu.h" #include "../config.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../cpu/x86.h" #include "../io.h" diff --git a/src/machines/m_tandy1000.c b/src/machines/m_tandy1000.c index 9a6473d..e05af7f 100644 --- a/src/machines/m_tandy1000.c +++ b/src/machines/m_tandy1000.c @@ -8,7 +8,7 @@ * * Emulation of Tandy models 1000, 1000HX and 1000SL2. * - * Version: @(#)m_tandy1000.c 1.0.23 2019/05/13 + * Version: @(#)m_tandy1000.c 1.0.24 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -43,11 +43,11 @@ #include #include #include "../emu.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../io.h" #include "../mem.h" #include "../rom.h" -#include "../timer.h" #include "../nvr.h" #include "../device.h" #include "../devices/system/dma.h" @@ -88,7 +88,8 @@ typedef struct { int amplitude; int irq; - int64_t timer_count, + + tmrval_t timer_count, enable; int wave_pos; @@ -798,7 +799,7 @@ snd_callback(priv_t priv) dev->wave_pos = (dev->wave_pos + 1) & 31; } - dev->timer_count += (int64_t)(TIMER_USEC * (1000000.0 / 3579545.0) * (double)(dev->freq ? dev->freq : 0x400)); + dev->timer_count += (tmrval_t)(TIMER_USEC * (1000000.0 / 3579545.0) * (double)(dev->freq ? dev->freq : 0x400)); } diff --git a/src/machines/m_tandy1000_vid.c b/src/machines/m_tandy1000_vid.c index d620022..df86daa 100644 --- a/src/machines/m_tandy1000_vid.c +++ b/src/machines/m_tandy1000_vid.c @@ -8,7 +8,7 @@ * * Emulation of video controllers for Tandy models. * - * Version: @(#)m_tandy1000_vid.c 1.0.5 2019/05/13 + * Version: @(#)m_tandy1000_vid.c 1.0.6 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -43,10 +43,10 @@ #include #include #include "../emu.h" +#include "../timer.h" #include "../io.h" #include "../mem.h" #include "../rom.h" -#include "../timer.h" #include "../nvr.h" #include "../device.h" #include "../devices/system/clk.h" @@ -88,13 +88,14 @@ typedef struct { int con, coff, cursoron, blink; - int64_t vsynctime; int vadj; uint16_t ma, maback; - int64_t dispontime, + tmrval_t vsynctime, + dispontime, dispofftime, vidtime; + int firstline, lastline; @@ -158,8 +159,8 @@ recalc_timings(t1kvid_t *dev) _dispontime *= CGACONST; _dispofftime *= CGACONST; - dev->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); - dev->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); + dev->dispontime = (tmrval_t)(_dispontime * (1 << TIMER_SHIFT)); + dev->dispofftime = (tmrval_t)(_dispofftime * (1 << TIMER_SHIFT)); } diff --git a/src/machines/m_tosh1x00.c b/src/machines/m_tosh1x00.c index 18d7ac0..695ac83 100644 --- a/src/machines/m_tosh1x00.c +++ b/src/machines/m_tosh1x00.c @@ -96,7 +96,7 @@ * * FIXME: The ROM drive should be re-done using the "option file". * - * Version: @(#)m_tosh1x00.c 1.0.23 2019/05/13 + * Version: @(#)m_tosh1x00.c 1.0.24 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -132,6 +132,7 @@ #include #include "../emu.h" #include "../config.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../io.h" #include "../mem.h" diff --git a/src/machines/m_tosh1x00_vid.c b/src/machines/m_tosh1x00_vid.c index 3f08fa7..f9e55d3 100644 --- a/src/machines/m_tosh1x00_vid.c +++ b/src/machines/m_tosh1x00_vid.c @@ -9,7 +9,7 @@ * Implementation of the Toshiba T1000 plasma display, which * has a fixed resolution of 640x200 pixels. * - * Version: @(#)m_tosh1x00_vid.c 1.0.12 2019/05/13 + * Version: @(#)m_tosh1x00_vid.c 1.0.13 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -43,10 +43,10 @@ #include #include #include "../emu.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../io.h" #include "../mem.h" -#include "../timer.h" #include "../device.h" #include "../devices/video/video.h" #include "../devices/video/vid_cga.h" @@ -85,7 +85,7 @@ typedef struct { int internal; /* using internal display? */ uint8_t attrmap; /* attribute mapping register */ - int64_t dispontime, + tmrval_t dispontime, dispofftime, vsynctime; @@ -115,8 +115,8 @@ recalc_timings(vid_t *dev) _dispontime = 640; _dispofftime = disptime - _dispontime; - dev->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); - dev->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); + dev->dispontime = (tmrval_t)(_dispontime * (1 << TIMER_SHIFT)); + dev->dispofftime = (tmrval_t)(_dispofftime * (1 << TIMER_SHIFT)); } else cga_recalctimings(&dev->cga); } diff --git a/src/machines/m_tosh3100e_vid.c b/src/machines/m_tosh3100e_vid.c index fe44616..687c933 100644 --- a/src/machines/m_tosh3100e_vid.c +++ b/src/machines/m_tosh3100e_vid.c @@ -22,7 +22,7 @@ * 61 50 52 0F 19 06 19 19 02 0D 0B 0C MONO * 2D 28 22 0A 67 00 64 67 02 03 06 07 640x400 * - * Version: @(#)m_t3100e_vid.c 1.0.13 2019/05/13 + * Version: @(#)m_t3100e_vid.c 1.0.14 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -56,11 +56,11 @@ #include #include #include "../emu.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../io.h" #include "../mem.h" #include "../rom.h" -#include "../timer.h" #include "../device.h" #include "../devices/video/video.h" #include "../devices/video/vid_cga.h" @@ -96,7 +96,7 @@ typedef struct { int internal; /* using internal display? */ uint8_t attrmap; /* attribute mapping register */ - int64_t dispontime, + tmrval_t dispontime, dispofftime, vsynctime; diff --git a/src/machines/m_tyan.c b/src/machines/m_tyan.c index 14b5234..ef7434b 100644 --- a/src/machines/m_tyan.c +++ b/src/machines/m_tyan.c @@ -75,7 +75,6 @@ #include "../devices/input/keyboard.h" #include "../devices/sio/sio.h" #include "../devices/disk/hdc.h" -#include "../devices/disk/hdc_ide.h" #include "machine.h" diff --git a/src/machines/m_xi8088.c b/src/machines/m_xi8088.c index 8d2a7c0..8dbd122 100644 --- a/src/machines/m_xi8088.c +++ b/src/machines/m_xi8088.c @@ -8,7 +8,7 @@ * * Implementation of the Xi8088 open-source machine. * - * Version: @(#)m_xi8088.c 1.0.15 2019/05/13 + * Version: @(#)m_xi8088.c 1.0.16 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #include #include #include "../emu.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../mem.h" #include "../rom.h" diff --git a/src/machines/m_xt.c b/src/machines/m_xt.c index ee2f128..c8973a2 100644 --- a/src/machines/m_xt.c +++ b/src/machines/m_xt.c @@ -8,7 +8,7 @@ * * Implementation of standard IBM PC/XT class machine. * - * Version: @(#)m_xt.c 1.0.19 2019/05/13 + * Version: @(#)m_xt.c 1.0.20 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #include #include #include "../emu.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../mem.h" #include "../device.h" diff --git a/src/machines/m_zenith.c b/src/machines/m_zenith.c index 64747c8..6c49594 100644 --- a/src/machines/m_zenith.c +++ b/src/machines/m_zenith.c @@ -25,7 +25,7 @@ * to be done on implementing other parts of the Yamaha V6355 * chip that implements the video controller. * - * Version: @(#)m_zenith.c 1.0.8 2019/05/13 + * Version: @(#)m_zenith.c 1.0.9 2019/05/17 * * Authors: Fred N. van Kempen, * Original patch for PCem by 'Tux' @@ -58,6 +58,7 @@ #include #include "../emu.h" #include "../config.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../io.h" #include "../mem.h" diff --git a/src/machines/m_zenith_vid.c b/src/machines/m_zenith_vid.c index b9e42f9..bc04626 100644 --- a/src/machines/m_zenith_vid.c +++ b/src/machines/m_zenith_vid.c @@ -17,7 +17,7 @@ * done on implementing other parts of the Yamaha V6355 chip * that implements the video controller. * - * Version: @(#)m_zenith_vid.c 1.0.4 2019/05/13 + * Version: @(#)m_zenith_vid.c 1.0.5 2019/05/17 * * Authors: Fred N. van Kempen, * John Elliott, @@ -49,10 +49,10 @@ #include #include #include "../emu.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../io.h" #include "../mem.h" -#include "../timer.h" #include "../device.h" #include "../devices/video/video.h" #include "../devices/video/vid_cga.h" @@ -80,7 +80,7 @@ typedef struct { uint8_t bank_indx; /* V6355 extended bank */ uint8_t bank_data[0x6a]; /* V6355 extended bank */ - int64_t dispontime, + tmrval_t dispontime, dispofftime, vsynctime; @@ -109,8 +109,8 @@ recalc_timings(vid_t *dev) _dispontime = 640; _dispofftime = disptime - _dispontime; - dev->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); - dev->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); + dev->dispontime = (tmrval_t)(_dispontime * (1 << TIMER_SHIFT)); + dev->dispofftime = (tmrval_t)(_dispofftime * (1 << TIMER_SHIFT)); } else cga_recalctimings(&dev->cga); } diff --git a/src/machines/machine.c b/src/machines/machine.c index 727b9de..c2ce83b 100644 --- a/src/machines/machine.c +++ b/src/machines/machine.c @@ -8,7 +8,7 @@ * * Handling of the emulated machines. * - * Version: @(#)machine.c 1.0.22 2019/05/03 + * Version: @(#)machine.c 1.0.23 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #include #include "../emu.h" #include "../config.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../mem.h" #include "../rom.h" diff --git a/src/machines/machine_table.c b/src/machines/machine_table.c index 9fc66af..54ae79a 100644 --- a/src/machines/machine_table.c +++ b/src/machines/machine_table.c @@ -8,7 +8,7 @@ * * Handling of the emulated machines. * - * Version: @(#)machine_table.c 1.0.42 2019/05/03 + * Version: @(#)machine_table.c 1.0.43 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -42,6 +42,7 @@ #include #include "../emu.h" #include "../config.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../mem.h" #include "../nvr.h" diff --git a/src/nvr.c b/src/nvr.c index 237ad32..69d711e 100644 --- a/src/nvr.c +++ b/src/nvr.c @@ -8,7 +8,7 @@ * * Implement a generic NVRAM/CMOS/RTC device. * - * Version: @(#)nvr.c 1.0.20 2019/05/13 + * Version: @(#)nvr.c 1.0.21 2019/05/17 * * Author: Fred N. van Kempen, * @@ -52,8 +52,8 @@ #include #include "emu.h" #include "config.h" -#include "machines/machine.h" #include "timer.h" +#include "machines/machine.h" #include "plat.h" #include "nvr.h" diff --git a/src/nvr.h b/src/nvr.h index cc674c3..ca36340 100644 --- a/src/nvr.h +++ b/src/nvr.h @@ -8,7 +8,7 @@ * * Definitions for the generic NVRAM/CMOS driver. * - * Version: @(#)nvr.h 1.0.9 2019/04/26 + * Version: @(#)nvr.h 1.0.10 2019/05/17 * * Author: Fred N. van Kempen, * @@ -71,7 +71,7 @@ typedef struct _nvr_ { int8_t irq; uint8_t onesec_cnt; - int64_t onesec_time; + tmrval_t onesec_time; void *data; /* local data */ diff --git a/src/pc.c b/src/pc.c index 17be74d..152c247 100644 --- a/src/pc.c +++ b/src/pc.c @@ -8,7 +8,7 @@ * * Main emulator module where most things are controlled. * - * Version: @(#)pc.c 1.0.76 2019/05/10 + * Version: @(#)pc.c 1.0.77 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -47,6 +47,7 @@ #include "emu.h" #include "version.h" #include "config.h" +#include "timer.h" #include "cpu/cpu.h" #ifdef USE_DYNAREC # include "cpu/x86.h" @@ -60,7 +61,6 @@ #include "devices/system/dma.h" #include "devices/system/pic.h" #include "random.h" -#include "timer.h" #include "device.h" #include "nvr.h" #include "devices/ports/game.h" diff --git a/src/timer.c b/src/timer.c index 30a9006..da686ee 100644 --- a/src/timer.c +++ b/src/timer.c @@ -8,7 +8,7 @@ * * System timer module. * - * Version: @(#)timer.c 1.0.4 2019/05/13 + * Version: @(#)timer.c 1.0.5 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -47,30 +47,30 @@ #define TIMERS_MAX 64 -int64_t TIMER_USEC; -int64_t timer_one = 1; -int64_t timer_start = 0; -int64_t timer_count = 0; +tmrval_t TIMER_USEC; +tmrval_t timer_one = 1; +tmrval_t timer_start = 0; +tmrval_t timer_count = 0; static struct { int present; - int64_t *count; - int64_t *enable; + tmrval_t *count; + tmrval_t *enable; void (*callback)(priv_t); priv_t priv; } timers[TIMERS_MAX]; static int present = 0; -static int64_t latch = 0; +static tmrval_t latch = 0; void timer_process(void) { - int64_t diff = latch - timer_count; /* get actual elapsed time */ - int64_t enable[TIMERS_MAX]; + tmrval_t diff = latch - timer_count; /* get actual elapsed time */ + tmrval_t enable[TIMERS_MAX]; int c, process = 0; latch = 0; @@ -83,7 +83,7 @@ timer_process(void) enable[c] = *timers[c].enable; if (enable[c]) { *timers[c].count = *timers[c].count - diff; - if (*timers[c].count <= 0LL) + if (*timers[c].count <= (tmrval_t)0) process = 1; } } @@ -92,7 +92,7 @@ timer_process(void) return; for (;;) { - int64_t lowest = 1LL; + tmrval_t lowest = 1LL; int lowest_c; for (c = 0; c < present; c++) { @@ -140,7 +140,7 @@ timer_reset(void) int -timer_add(void (*callback)(priv_t), priv_t priv, int64_t *count, int64_t *enable) +timer_add(void (*func)(priv_t), priv_t priv, tmrval_t *count, tmrval_t *enable) { int i = 0; @@ -156,7 +156,7 @@ timer_add(void (*callback)(priv_t), priv_t priv, int64_t *count, int64_t *enable */ for (i = 0; i < present; i++) { if (timers[i].present && - (timers[i].callback == callback) && + (timers[i].callback == func) && (timers[i].priv == priv) && (timers[i].count == count) && (timers[i].enable == enable)) return 0; @@ -164,7 +164,7 @@ timer_add(void (*callback)(priv_t), priv_t priv, int64_t *count, int64_t *enable } timers[present].present = 1; - timers[present].callback = callback; + timers[present].callback = func; timers[present].priv = priv; timers[present].count = count; timers[present].enable = enable; diff --git a/src/timer.h b/src/timer.h index 9368562..79e142b 100644 --- a/src/timer.h +++ b/src/timer.h @@ -8,7 +8,7 @@ * * Definitions for the system timer module. * - * Version: @(#)timer.h 1.0.4 2019/05/13 + * Version: @(#)timer.h 1.0.5 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -45,10 +45,13 @@ #define TIMER_ALWAYS_ENABLED &timer_one -extern int64_t TIMER_USEC; -extern int64_t timer_one; -extern int64_t timer_start; -extern int64_t timer_count; +typedef int64_t tmrval_t; + + +extern tmrval_t TIMER_USEC; +extern tmrval_t timer_one; +extern tmrval_t timer_start; +extern tmrval_t timer_count; #define timer_start_period(cycles) \ @@ -56,7 +59,7 @@ extern int64_t timer_count; #define timer_end_period(cycles) \ do { \ - int64_t __diff = timer_start - (cycles); \ + tmrval_t __diff = timer_start - (cycles); \ timer_count -= __diff; \ timer_start = cycles; \ if (timer_count <= 0) { \ @@ -67,7 +70,7 @@ extern int64_t timer_count; #define timer_clock() \ do { \ - int64_t __diff; \ + tmrval_t __diff; \ if (AT) { \ __diff = timer_start - (cycles << TIMER_SHIFT); \ timer_start = cycles << TIMER_SHIFT; \ @@ -85,7 +88,7 @@ extern void timer_process(void); extern void timer_update_outstanding(void); extern void timer_reset(void); extern int timer_add(void (*callback)(priv_t), priv_t priv, - int64_t *count, int64_t *enable); + tmrval_t *count, tmrval_t *enable); #endif /*EMU_TIMER_H*/ diff --git a/src/ui/lang/VARCem.def b/src/ui/lang/VARCem.def index 2803ab0..9533d83 100644 --- a/src/ui/lang/VARCem.def +++ b/src/ui/lang/VARCem.def @@ -8,11 +8,11 @@ * * String table for the application, shared by all platforms. * - * Version: @(#)VARCem.def 1.0.4 2018/11/12 + * Version: @(#)VARCem.def 1.0.5 2019/05/17 * * Author: Fred N. van Kempen, * - * Copyright 2018 Fred N. van Kempen. + * Copyright 2018,2019 Fred N. van Kempen. * * Redistribution and use in source and binary forms, with * or without modification, are permitted provided that the @@ -338,7 +338,7 @@ STRTBL( IDS_4034, STR_4034 ) STRTBL( IDS_4040, STR_4040 ) STRTBL( IDS_4041, STR_4041 ) STRTBL( IDS_4042, STR_4042 ) -STRTBL( IDS_4043, STR_4043 ) +/* 4043 available */ STRTBL( IDS_4044, STR_4044 ) STRTBL( IDS_4045, STR_4045 ) diff --git a/src/ui/lang/VARCem.str b/src/ui/lang/VARCem.str index 229e991..ec3e31c 100644 --- a/src/ui/lang/VARCem.str +++ b/src/ui/lang/VARCem.str @@ -13,7 +13,7 @@ * it as the line-by-line base for the translated version, and * update fields as needed. * - * Version: @(#)VARCem.str 1.0.14 2019/02/11 + * Version: @(#)VARCem.str 1.0.15 2019/05/17 * * Author: Fred N. van Kempen, * @@ -357,7 +357,7 @@ #define STR_4040 "Fullscreen &stretch mode" #define STR_4041 "&Full screen stretch" #define STR_4042 "&4:3" -#define STR_4043 "&Square pixels" +/* 4043 unused */ #define STR_4044 "&Integer scale" #define STR_4045 "&Keep size" diff --git a/src/ui/ui_cdrom.c b/src/ui/ui_cdrom.c index ed4fd74..2ee264e 100644 --- a/src/ui/ui_cdrom.c +++ b/src/ui/ui_cdrom.c @@ -8,11 +8,11 @@ * * Handle the UI part of CD-ROM/ZIP/DISK media changes. * - * Version: @(#)ui_cdrom.c 1.0.6 2018/10/25 + * Version: @(#)ui_cdrom.c 1.0.7 2019/05/17 * * Author: Fred N. van Kempen, * - * Copyright 2018 Fred N. van Kempen. + * Copyright 2018,2019 Fred N. van Kempen. * * Redistribution and use in source and binary forms, with * or without modification, are permitted provided that the @@ -50,6 +50,7 @@ #include #include #include "../emu.h" +#include "../timer.h" #include "../config.h" #include "../plat.h" #include "../devices/floppy/fdd.h" diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index cfce6ca..9dafb2c 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -11,7 +11,7 @@ * This code is called by the UI frontend modules, and, also, * depends on those same modules for lower-level functions. * - * Version: @(#)ui_main.c 1.0.23 2019/05/03 + * Version: @(#)ui_main.c 1.0.24 2019/05/17 * * Author: Fred N. van Kempen, * @@ -310,7 +310,7 @@ main_reset_all(void) menu_set_item(IDM_FULLSCREEN, config.vid_fullscreen); - menu_set_radio_item(IDM_STRETCH, 5, config.vid_fullscreen_scale); + menu_set_radio_item(IDM_STRETCH, 4, config.vid_fullscreen_scale); menu_set_item(IDM_RCTRL_IS_LALT, config.rctrl_is_lalt); @@ -442,11 +442,10 @@ ui_menu_command(int idm) case IDM_STRETCH: /* VIEW menu */ case IDM_STRETCH_43: - case IDM_STRETCH_SQ: - case IDM_STRETCH_INT: case IDM_STRETCH_KEEP: + case IDM_STRETCH_INT: config.vid_fullscreen_scale = (idm - IDM_STRETCH); - menu_set_radio_item(IDM_STRETCH, 5, config.vid_fullscreen_scale); + menu_set_radio_item(IDM_STRETCH, 4, config.vid_fullscreen_scale); device_force_redraw(); config_save(); break; diff --git a/src/ui/ui_new_image.c b/src/ui/ui_new_image.c index 37bf82a..905fcd8 100644 --- a/src/ui/ui_new_image.c +++ b/src/ui/ui_new_image.c @@ -12,7 +12,7 @@ * format handlers, and re-integrated with that code. This is * just the wrong place for it.. * - * Version: @(#)ui_new_image.c 1.0.6 2019/02/10 + * Version: @(#)ui_new_image.c 1.0.7 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -44,6 +44,7 @@ #include #include #include "../emu.h" +#include "../timer.h" #include "../random.h" #include "../ui/ui.h" #include "../plat.h" diff --git a/src/ui/ui_resource.h b/src/ui/ui_resource.h index 61152d8..e6ced31 100644 --- a/src/ui/ui_resource.h +++ b/src/ui/ui_resource.h @@ -12,7 +12,7 @@ * those are not used by the platform code. This is easier to * maintain. * - * Version: @(#)ui_resource.h 1.0.20 2019/02/12 + * Version: @(#)ui_resource.h 1.0.21 2019/05/17 * * Author: Fred N. van Kempen, * @@ -90,9 +90,8 @@ #define IDM_FULL_STRETCH (IDM_FULLSCREEN+1) # define IDM_STRETCH (IDM_FULLSCREEN+2) # define IDM_STRETCH_43 (IDM_FULLSCREEN+3) -# define IDM_STRETCH_SQ (IDM_FULLSCREEN+4) +# define IDM_STRETCH_KEEP (IDM_FULLSCREEN+4) # define IDM_STRETCH_INT (IDM_FULLSCREEN+5) -# define IDM_STRETCH_KEEP (IDM_FULLSCREEN+6) #define IDM_RCTRL_IS_LALT (IDM_VIEW+5) #define IDM_VIEW_END (IDM_RCTRL_IS_LALT+1) @@ -542,7 +541,7 @@ #define IDS_4040 4040 /* "Fullscreen &stretch mode" */ #define IDS_4041 4041 /* "&Full screen stretch" */ #define IDS_4042 4042 /* "&4:3" */ -#define IDS_4043 4043 /* "&Square pixels" */ +/* 4043 available */ #define IDS_4044 4044 /* "&Integer scale" */ #define IDS_4045 4045 /* "&Keep size" */ diff --git a/src/ui/ui_stbar.c b/src/ui/ui_stbar.c index ad0dbd5..6ae5d63 100644 --- a/src/ui/ui_stbar.c +++ b/src/ui/ui_stbar.c @@ -8,7 +8,7 @@ * * Common UI support functions for the Status Bar module. * - * Version: @(#)ui_stbar.c 1.0.19 2019/05/03 + * Version: @(#)ui_stbar.c 1.0.20 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -41,6 +41,7 @@ #include #include "../emu.h" #include "../config.h" +#include "../timer.h" #include "../device.h" #include "../plat.h" #include "../machines/machine.h" diff --git a/src/ui/ui_vidapi.c b/src/ui/ui_vidapi.c index 34e4083..221530a 100644 --- a/src/ui/ui_vidapi.c +++ b/src/ui/ui_vidapi.c @@ -8,7 +8,7 @@ * * Handle the various video renderer modules. * - * Version: @(#)ui_vidapi.c 1.0.7 2019/05/03 + * Version: @(#)ui_vidapi.c 1.0.8 2019/05/17 * * Author: Fred N. van Kempen, * @@ -222,7 +222,7 @@ vidapi_screenshot(void) DEBUG("VIDAPI: screenshot (api=%i)\n", config.vid_api); if ((config.vid_api < 0) || - (plat_vidapis[config.vid_api]->screenshot != NULL)) return; + (plat_vidapis[config.vid_api]->screenshot == NULL)) return; (void)time(&now); info = localtime(&now); diff --git a/src/win/VARCem-common.rc b/src/win/VARCem-common.rc index ab0b022..97b37e4 100644 --- a/src/win/VARCem-common.rc +++ b/src/win/VARCem-common.rc @@ -8,11 +8,11 @@ * * Common resources for the application. * - * Version: @(#)VARCem-common.rc 1.0.11 2018/10/20 + * Version: @(#)VARCem-common.rc 1.0.12 2019/05/17 * * Author: Fred N. van Kempen, * - * Copyright 2017,2018 Fred N. van Kempen. + * Copyright 2017-2019 Fred N. van Kempen. * * Redistribution and use in source and binary forms, with * or without modification, are permitted provided that the @@ -97,9 +97,8 @@ BEGIN BEGIN MENUITEM STR_4041,IDM_STRETCH MENUITEM STR_4042,IDM_STRETCH_43 - MENUITEM STR_4043,IDM_STRETCH_SQ - MENUITEM STR_4044,IDM_STRETCH_INT MENUITEM STR_4045,IDM_STRETCH_KEEP + MENUITEM STR_4044,IDM_STRETCH_INT END END diff --git a/src/win/mingw/Makefile.MinGW b/src/win/mingw/Makefile.MinGW index 248d9b2..3db9cf9 100644 --- a/src/win/mingw/Makefile.MinGW +++ b/src/win/mingw/Makefile.MinGW @@ -8,7 +8,7 @@ # # Makefile for Windows systems using the MinGW32 environment. # -# Version: @(#)Makefile.mingw 1.0.88 2019/05/15 +# Version: @(#)Makefile.mingw 1.0.89 2019/05/17 # # Author: Fred N. van Kempen, # @@ -453,21 +453,6 @@ ifneq ($(D2D), n) D2DOBJ := win_d2d.o endif -# D3DX (always hard-linked) -ifndef D3DX - D3DX := y - ifeq ($(ARM), y) - D3DX := n - endif - ifeq ($(ARM64), y) - D3DX := n - endif -endif -ifeq ($(D3DX), y) - OPTS += -DUSE_D3DX - LIBS += -ld3dx9 -endif - # DINPUT and XInput (always hard-linked) ifndef DINPUT DINPUT := y diff --git a/src/win/msvc/Makefile.VC b/src/win/msvc/Makefile.VC index e306067..3ca3176 100644 --- a/src/win/msvc/Makefile.VC +++ b/src/win/msvc/Makefile.VC @@ -8,7 +8,7 @@ # # Makefile for Windows using Visual Studio 2015. # -# Version: @(#)Makefile.VC 1.0.72 2019/05/15 +# Version: @(#)Makefile.VC 1.0.73 2019/05/17 # # Author: Fred N. van Kempen, # @@ -400,21 +400,6 @@ ifneq ($(D2D), n) D2DOBJ := win_d2d.obj endif -# D3DX (always hard-linked) -ifndef D3DX - D3DX := y - ifeq ($(ARM), y) - D3DX := n - endif - ifeq ($(ARM64), y) - D3DX := n - endif -endif -ifeq ($(D3DX), y) - OPTS += -DUSE_D3DX - LIBS += d3dx9.lib -endif - # DINPUT and XInput (always hard-linked) ifndef DINPUT DINPUT := y diff --git a/src/win/win_cdrom.c b/src/win/win_cdrom.c index bdaadc2..5ec21a3 100644 --- a/src/win/win_cdrom.c +++ b/src/win/win_cdrom.c @@ -12,12 +12,12 @@ * * FIXME: Not yet fully working! Getting there, though ;-) * - * Version: @(#)win_cdrom.c 1.0.16 2018/10/25 + * Version: @(#)win_cdrom.c 1.0.17 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, * - * Copyright 2017,2018 Fred N. van Kempen. + * Copyright 2017-2019 Fred N. van Kempen. * Copyright 2016-2018 Miran Grca. * * This program is free software; you can redistribute it and/or modify @@ -54,6 +54,7 @@ #define dbglog cdrom_host_log #include "../emu.h" #include "../config.h" +#include "../timer.h" #include "../ui/ui.h" #include "../plat.h" #include "../devices/cdrom/cdrom.h" diff --git a/src/win/win_d2d.cpp b/src/win/win_d2d.cpp index f4ebccc..2581910 100644 --- a/src/win/win_d2d.cpp +++ b/src/win/win_d2d.cpp @@ -8,7 +8,7 @@ * * Rendering module for Microsoft Direct2D. * - * Version: @(#)win_d2d.cpp 1.0.8 2019/05/03 + * Version: @(#)win_d2d.cpp 1.0.9 2019/05/17 * * Authors: Fred N. van Kempen, * David Hrdlicka, @@ -105,39 +105,38 @@ d2d_stretch(float *w, float *h, float *x, float *y) break; case FULLSCR_SCALE_43: + case FULLSCR_SCALE_KEEPRATIO: dw = (double)d2d_screen_width; dh = (double)d2d_screen_height; - temp = (dh / 3.0) * 4.0; - dx = (dw - temp) / 2.0; - dw = temp; - *w = (float)dw; - *h = (float)dh; - *x = (float)dx; - *y = 0; - break; - case FULLSCR_SCALE_SQ: - dw = (double)d2d_screen_width; - dh = (double)d2d_screen_height; - temp = ((double) *w); - temp2 = ((double) *h); - dx = (dw / 2.0) - ((dh * temp) / (temp2 * 2.0)); - dy = 0.0; - if (dx < 0.0) { - dx = 0.0; - dy = (dw / 2.0) - ((dh * temp2) / (temp * 2.0)); + hsr = dw / dh; + if (config.vid_fullscreen_scale == FULLSCR_SCALE_43) + gsr = 4.0 / 3.0; + else + gsr = ((double) *w) / ((double) *h); + + if (gsr <= hsr) { + temp = dh * gsr; + dx = (dw - temp) / 2.0; + dw = temp; + *w = (float) dw; + *h = (float) dh; + *x = (float) dx; + *y = 0; + } else { + temp = dw / gsr; + dy = (dh - temp) / 2.0; + dh = temp; + *w = (float) dw; + *h = (float) dh; + *x = 0; + *y = (float) dy; } - dw -= (dx * 2.0); - dh -= (dy * 2.0); - *w = (float)dw; - *h = (float)dh; - *x = (float)dx; - *y = (float)dy; break; - + case FULLSCR_SCALE_INT: - dw = (double)d2d_screen_width; - dh = (double)d2d_screen_height; + dw = (double) d2d_screen_width; + dh = (double) d2d_screen_height; temp = ((double) *w); temp2 = ((double) *h); ratio_w = dw / ((double) *w); @@ -148,34 +147,10 @@ d2d_stretch(float *w, float *h, float *x, float *y) dy = (dh / 2.0) - ((temp2 * ratio_h) / 2.0); dw -= (dx * 2.0); dh -= (dy * 2.0); - *w = (float)dw; - *h = (float)dh; - *x = (float)dx; - *y = (float)dy; - break; - - case FULLSCR_SCALE_KEEPRATIO: - dw = (double)d2d_screen_width; - dh = (double)d2d_screen_height; - hsr = dw / dh; - gsr = ((double) *w) / ((double) *h); - if (gsr <= hsr) { - temp = dh * gsr; - dx = (dw - temp) / 2.0; - dw = temp; - *w = (float)dw; - *h = (float)dh; - *x = (float)dx; - *y = 0; - } else { - temp = dw / gsr; - dy = (dh - temp) / 2.0; - dh = temp; - *w = (float)dw; - *h = (float)dh; - *x = 0; - *y = (float)dy; - } + *w = (float) dw; + *h = (float) dh; + *x = (float) dx; + *y = (float) dy; break; } } diff --git a/src/win/win_d3d.cpp b/src/win/win_d3d.cpp index 0ca632c..3f94cbc 100644 --- a/src/win/win_d3d.cpp +++ b/src/win/win_d3d.cpp @@ -8,7 +8,7 @@ * * Rendering module for Microsoft Direct3D 9. * - * Version: @(#)win_d3d.cpp 1.0.18 2019/05/03 + * Version: @(#)win_d3d.cpp 1.0.19 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -39,7 +39,6 @@ #define UNICODE #include #include -#include #include #include #include "../emu.h" @@ -47,6 +46,10 @@ #include "../version.h" #include "../device.h" #include "../plat.h" +#include "../ui/ui.h" +#if USE_LIBPNG +# include "../png.h" +#endif #ifdef _MSC_VER # pragma warning(disable: 4200) #endif @@ -105,7 +108,12 @@ static void d3d_size(RECT w_rect, double *l, double *t, double *r, double *b, int w, int h) { int ratio_w, ratio_h; - double hsr, gsr, ra, d; + double hsr, gsr, d, sh, sw, wh, ww, mh, mw; + + sh = (double)(w_rect.bottom - w_rect.top); + sw = (double)(w_rect.right - w_rect.left); + wh = (double)h; + ww = (double)w; switch (config.vid_fullscreen_scale) { case FULLSCR_SCALE_FULL: @@ -113,30 +121,39 @@ d3d_size(RECT w_rect, double *l, double *t, double *r, double *b, int w, int h) break; case FULLSCR_SCALE_43: - *t = -0.5; - *b = (w_rect.bottom - w_rect.top) - 0.5; - *l = ((w_rect.right - w_rect.left) / 2) - (((w_rect.bottom - w_rect.top) * 4) / (3 * 2)) - 0.5; - *r = ((w_rect.right - w_rect.left) / 2) + (((w_rect.bottom - w_rect.top) * 4) / (3 * 2)) - 0.5; - if (*l < -0.5) { - *l = -0.5; - *r = (w_rect.right - w_rect.left) - 0.5; - *t = ((w_rect.bottom - w_rect.top) / 2) - (((w_rect.right - w_rect.left) * 3) / (4 * 2)) - 0.5; - *b = ((w_rect.bottom - w_rect.top) / 2) + (((w_rect.right - w_rect.left) * 3) / (4 * 2)) - 0.5; + case FULLSCR_SCALE_KEEPRATIO: + if (config.vid_fullscreen_scale == FULLSCR_SCALE_43) { + mw = 4.0; + mh = 3.0; + } else { + mw = ww; + mh = wh; } - break; - case FULLSCR_SCALE_SQ: - *t = -0.5; - *b = (w_rect.bottom - w_rect.top) - 0.5; - *l = ((w_rect.right - w_rect.left) / 2) - (((w_rect.bottom - w_rect.top) * w) / (h * 2)) - 0.5; - *r = ((w_rect.right - w_rect.left) / 2) + (((w_rect.bottom - w_rect.top) * w) / (h * 2)) - 0.5; - if (*l < -0.5) { - *l = -0.5; - *r = (w_rect.right - w_rect.left) - 0.5; - *t = ((w_rect.bottom - w_rect.top) / 2) - (((w_rect.right - w_rect.left) * h) / (w * 2)) - 0.5; - *b = ((w_rect.bottom - w_rect.top) / 2) + (((w_rect.right - w_rect.left) * h) / (w * 2)) - 0.5; - } - break; + hsr = sw / sh; + gsr = mw / mh; + + if (hsr > gsr) { + /* Host ratio is bigger than guest ratio. */ + d = (sw - (mw * (sh / mh))) / 2.0; + + *l = ((int) d) - 0.5; + *r = ((int) (sw - d)) - 0.5; + *t = -0.5; + *b = ((int) sh) - 0.5; + } else if (hsr < gsr) { + /* Host ratio is smaller or rqual than guest ratio. */ + d = (sh - (mh * (sw / mw))) / 2.0; + + *l = -0.5; + *r = ((int) sw) - 0.5; + *t = ((int) d) - 0.5; + *b = ((int) (sh - d)) - 0.5; + } else { + /* Host ratio is equal to guest ratio. */ + d3d_size_default(w_rect, l, t, r, b); + } + break; case FULLSCR_SCALE_INT: ratio_w = (w_rect.right - w_rect.left) / w; @@ -148,38 +165,6 @@ d3d_size(RECT w_rect, double *l, double *t, double *r, double *b, int w, int h) *t = ((w_rect.bottom - w_rect.top) / 2) - ((h * ratio_w) / 2) - 0.5; *b = ((w_rect.bottom - w_rect.top) / 2) + ((h * ratio_w) / 2) - 0.5; break; - - case FULLSCR_SCALE_KEEPRATIO: - hsr = ((double) (w_rect.right - w_rect.left)) / ((double) (w_rect.bottom - w_rect.top)); - gsr = ((double) w) / ((double) h); - - if (hsr > gsr) { - /* Host ratio is bigger than guest ratio. */ - ra = ((double) (w_rect.bottom - w_rect.top)) / ((double) h); - - d = ((double) w) * ra; - d = (((double) (w_rect.right - w_rect.left)) - d) / 2.0; - - *l = ((int) d) - 0.5; - *r = (w_rect.right - w_rect.left) - ((int) d) - 0.5; - *t = -0.5; - *b = (w_rect.bottom - w_rect.top) - 0.5; - } else if (hsr < gsr) { - /* Host ratio is smaller or rqual than guest ratio. */ - ra = ((double) (w_rect.right - w_rect.left)) / ((double) w); - - d = ((double) h) * ra; - d = (((double) (w_rect.bottom - w_rect.top)) - d) / 2.0; - - *l = -0.5; - *r = (w_rect.right - w_rect.left) - 0.5; - *t = ((int) d) - 0.5; - *b = (w_rect.bottom - w_rect.top) - ((int) d) - 0.5; - } else { - /* Host ratio is equal to guest ratio. */ - d3d_size_default(w_rect, l, t, r, b); - } - break; } } @@ -631,20 +616,91 @@ d3d_enable(int yes) static void d3d_screenshot(const wchar_t *fn) { -#ifdef USE_D3DX LPDIRECT3DSURFACE9 d3dSurface = NULL; + LPDIRECT3DSURFACE9 copy = NULL; + D3DSURFACE_DESC desc; + D3DLOCKED_RECT d3dlr; + uint8_t *bits, *pixels, *ptr; + HRESULT hr; +#if USE_LIBPNG + wchar_t temp[512]; + int i; +#endif if (! d3dTexture) return; - d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &d3dSurface); - D3DXSaveSurfaceToFile(fn, D3DXIFF_PNG, d3dSurface, NULL, NULL); + hr = d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &d3dSurface); + if (FAILED(hr)) { + ERRLOG("D3D: GetBackBuffer failed, result = %08lx\n", hr); + return; + } + d3dSurface->GetDesc(&desc); + + hr = d3ddev->CreateOffscreenPlainSurface(desc.Width, desc.Height, + desc.Format, D3DPOOL_SYSTEMMEM, + ©, NULL); + if (FAILED(hr)) { + ERRLOG("D3D: CreateOffscreenPlainSurface failed, result = %08lx\n", hr); + copy->Release(); + d3dSurface->Release(); + return; + } + + hr = d3ddev->GetRenderTargetData(d3dSurface, copy); + if (FAILED(hr)) { + ERRLOG("D3D: GetTargetData failed, result = %08lx\n", hr); + copy->Release(); + d3dSurface->Release(); + return; + } + + hr = copy->LockRect(&d3dlr, NULL, D3DLOCK_NO_DIRTY_UPDATE|D3DLOCK_READONLY); + if (FAILED(hr)) { + ERRLOG("D3D: LockRect failed, result = %08lx\n", hr); + copy->Release(); + d3dSurface->Release(); + return; + } + bits = (uint8_t *)d3dlr.pBits; + + INFO("D3D: surface %ix%i pixels, pitch %i, at %08lx\n", + desc.Width, desc.Height, d3dlr.Pitch, bits); + + /* Allocate a linear buffer for the pixel data. */ + pixels = (uint8_t *)mem_alloc(desc.Width * desc.Height * 4); + + /* Copy all pixels from the offscreen copy into the linear buffer. */ + ptr = pixels; + for (i = 0; i < (int)desc.Height; i++) { + memcpy(ptr, &bits[(d3dlr.Pitch * i)], d3dlr.Pitch); + ptr += d3dlr.Pitch; + } + + /* Unlock and release the copy. */ + copy->UnlockRect(); + copy->Release(); + + /* Unlock and release the back buffer. */ + d3dSurface->UnlockRect(); d3dSurface->Release(); - d3dSurface = NULL; + +#if USE_LIBPNG + i = png_write_rgb(fn, 0, pixels, + (int16_t)desc.Width, (int16_t)desc.Height); + + /* Show error message if needed. */ + if (i == 0) { + swprintf(temp, sizeof_w(temp), + get_string(IDS_ERR_SCRSHOT), fn); + ui_msgbox(MBX_ERROR, temp); + } #else - /* OK, screenshots not yet possible without D3DX. */ (void)fn; #endif + + /* Release the linear buffer. */ + free(pixels); } diff --git a/src/win/win_ddraw.cpp b/src/win/win_ddraw.cpp index 8ec2e28..97ad607 100644 --- a/src/win/win_ddraw.cpp +++ b/src/win/win_ddraw.cpp @@ -8,7 +8,7 @@ * * Rendering module for Microsoft DirectDraw 9. * - * Version: @(#)win_ddraw.cpp 1.0.22 2019/05/03 + * Version: @(#)win_ddraw.cpp 1.0.23 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -167,7 +167,12 @@ static void ddraw_fs_size(RECT w_rect, RECT *r_dest, int w, int h) { int ratio_w, ratio_h; - double hsr, gsr, ra, d; + double hsr, gsr, d, sh, sw, wh, ww, mh, mw; + + sh = (double)(w_rect.bottom - w_rect.top); + sw = (double)(w_rect.right - w_rect.left); + wh = (double)h; + ww = (double)w; switch (config.vid_fullscreen_scale) { case FULLSCR_SCALE_FULL: @@ -175,30 +180,39 @@ ddraw_fs_size(RECT w_rect, RECT *r_dest, int w, int h) break; case FULLSCR_SCALE_43: - r_dest->top = 0; - r_dest->bottom = (w_rect.bottom - w_rect.top) - 1; - r_dest->left = ((w_rect.right - w_rect.left) / 2) - (((w_rect.bottom - w_rect.top) * 4) / (3 * 2)); - r_dest->right = ((w_rect.right - w_rect.left) / 2) + (((w_rect.bottom - w_rect.top) * 4) / (3 * 2)) - 1; - if (r_dest->left < 0) { - r_dest->left = 0; - r_dest->right = (w_rect.right - w_rect.left) - 1; - r_dest->top = ((w_rect.bottom - w_rect.top) / 2) - (((w_rect.right - w_rect.left) * 3) / (4 * 2)); - r_dest->bottom = ((w_rect.bottom - w_rect.top) / 2) + (((w_rect.right - w_rect.left) * 3) / (4 * 2)) - 1; + case FULLSCR_SCALE_KEEPRATIO: + if (config.vid_fullscreen_scale == FULLSCR_SCALE_43) { + mw = 4.0; + mh = 3.0; + } else { + mw = ww; + mh = wh; } - break; - case FULLSCR_SCALE_SQ: - r_dest->top = 0; - r_dest->bottom = (w_rect.bottom - w_rect.top) - 1; - r_dest->left = ((w_rect.right - w_rect.left) / 2) - (((w_rect.bottom - w_rect.top) * w) / (h * 2)); - r_dest->right = ((w_rect.right - w_rect.left) / 2) + (((w_rect.bottom - w_rect.top) * w) / (h * 2)) - 1; - if (r_dest->left < 0) { - r_dest->left = 0; - r_dest->right = (w_rect.right - w_rect.left) - 1; - r_dest->top = ((w_rect.bottom - w_rect.top) / 2) - (((w_rect.right - w_rect.left) * h) / (w * 2)); - r_dest->bottom = ((w_rect.bottom - w_rect.top) / 2) + (((w_rect.right - w_rect.left) * h) / (w * 2)) - 1; - } - break; + hsr = sw / sh; + gsr = mw / mh; + + if (hsr > gsr) { + /* Host ratio is bigger than guest ratio. */ + d = (sw - (mw * (sh / mh))) / 2.0; + + r_dest->left = (int) d; + r_dest->right = (int) (sw - d - 1.0); + r_dest->top = 0; + r_dest->bottom = (int) (sh - 1.0); + } else if (hsr < gsr) { + /* Host ratio is smaller or rqual than guest ratio. */ + d = (sh - (mh * (sw / mw))) / 2.0; + + r_dest->left = 0; + r_dest->right = (int) (sw - 1.0); + r_dest->top = (int) d; + r_dest->bottom = (int) (sh - d - 1.0); + } else { + /* Host ratio is equal to guest ratio. */ + ddraw_fs_size_default(w_rect, r_dest); + } + break; case FULLSCR_SCALE_INT: ratio_w = (w_rect.right - w_rect.left) / w; @@ -210,38 +224,6 @@ ddraw_fs_size(RECT w_rect, RECT *r_dest, int w, int h) r_dest->top = ((w_rect.bottom - w_rect.top) / 2) - ((h * ratio_w) / 2); r_dest->bottom = ((w_rect.bottom - w_rect.top) / 2) + ((h * ratio_w) / 2) - 1; break; - - case FULLSCR_SCALE_KEEPRATIO: - hsr = ((double) (w_rect.right - w_rect.left)) / ((double) (w_rect.bottom - w_rect.top)); - gsr = ((double) w) / ((double) h); - - if (hsr > gsr) { - /* Host ratio is bigger than guest ratio. */ - ra = ((double) (w_rect.bottom - w_rect.top)) / ((double) h); - - d = ((double) w) * ra; - d = (((double) (w_rect.right - w_rect.left)) - d) / 2.0; - - r_dest->left = ((int) d); - r_dest->right = (w_rect.right - w_rect.left) - ((int) d) - 1; - r_dest->top = 0; - r_dest->bottom = (w_rect.bottom - w_rect.top) - 1; - } else if (hsr < gsr) { - /* Host ratio is smaller or rqual than guest ratio. */ - ra = ((double) (w_rect.right - w_rect.left)) / ((double) w); - - d = ((double) h) * ra; - d = (((double) (w_rect.bottom - w_rect.top)) - d) / 2.0; - - r_dest->left = 0; - r_dest->right = (w_rect.right - w_rect.left) - 1; - r_dest->top = ((int) d); - r_dest->bottom = (w_rect.bottom - w_rect.top) - ((int) d) - 1; - } else { - /* Host ratio is equal to guest ratio. */ - ddraw_fs_size_default(w_rect, r_dest); - } - break; } } diff --git a/src/win/win_new_image.c b/src/win/win_new_image.c index 9bf597c..600f7a8 100644 --- a/src/win/win_new_image.c +++ b/src/win/win_new_image.c @@ -8,12 +8,12 @@ * * Implementation of the New Floppy/ZIP Image dialog. * - * Version: @(#)win_new_image.c 1.0.22 2018/10/25 + * Version: @(#)win_new_image.c 1.0.23 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, * - * Copyright 2017,2018 Fred N. van Kempen. + * Copyright 2017-2019 Fred N. van Kempen. * Copyright 2016-2018 Miran Grca. * * This program is free software; you can redistribute it and/or modify @@ -44,6 +44,7 @@ #include #include #include "../emu.h" +#include "../timer.h" #include "../ui/ui.h" #include "../plat.h" #include "../devices/scsi/scsi_device.h" diff --git a/src/win/win_sdl.c b/src/win/win_sdl.c index d8a8c22..369cae8 100644 --- a/src/win/win_sdl.c +++ b/src/win/win_sdl.c @@ -12,7 +12,7 @@ * we will not use that, but, instead, use a new window which * coverrs the entire desktop. * - * Version: @(#)win_sdl.c 1.0.11 2019/05/03 + * Version: @(#)win_sdl.c 1.0.12 2019/05/17 * * Authors: Fred N. van Kempen, * Michael Drüing, @@ -86,6 +86,7 @@ static void *sdl_handle = NULL; /* handle to libSDL2 DLL */ static SDL_Window *sdl_win = NULL; static SDL_Renderer *sdl_render = NULL; static SDL_Texture *sdl_tex = NULL; +static SDL_mutex* sdl_mutex = NULL; static HWND sdl_hwnd = NULL; static HWND sdl_parent_hwnd = NULL; static int sdl_w, sdl_h; @@ -115,6 +116,10 @@ static void (*sdl_RenderPresent)(SDL_Renderer *); static int (*sdl_RenderReadPixels)(SDL_Renderer *, const SDL_Rect *, Uint32, void *, int); +static SDL_mutex *(*sdl_CreateMutex)(void); +static void (*sdl_DestroyMutex)(SDL_mutex *mutex); +static int (*sdl_LockMutex)(SDL_mutex *mutex); +static int (*sdl_UnlockMutex)(SDL_mutex *mutex); static const dllimp_t sdl_imports[] = { @@ -134,6 +139,10 @@ static const dllimp_t sdl_imports[] = { { "SDL_RenderCopy", &sdl_RenderCopy }, { "SDL_RenderPresent", &sdl_RenderPresent }, { "SDL_RenderReadPixels", &sdl_RenderReadPixels }, + { "SDL_CreateMutex", &sdl_CreateMutex }, + { "SDL_DestroyMutex", &sdl_DestroyMutex }, + { "SDL_LockMutex", &sdl_LockMutex }, + { "SDL_UnlockMutex", &sdl_UnlockMutex }, { NULL, NULL } }; @@ -152,67 +161,23 @@ sdl_stretch(int *w, int *h, int *x, int *y) break; case FULLSCR_SCALE_43: - dw = (double) sdl_w; - dh = (double) sdl_h; - temp = (dh / 3.0) * 4.0; - dx = (dw - temp) / 2.0; - dw = temp; - *w = (int) dw; - *h = (int) dh; - *x = (int) dx; - *y = 0; - break; - - case FULLSCR_SCALE_SQ: - dw = (double) sdl_w; - dh = (double) sdl_h; - temp = ((double) *w); - temp2 = ((double) *h); - dx = (dw / 2.0) - ((dh * temp) / (temp2 * 2.0)); - dy = 0.0; - if (dx < 0.0) { - dx = 0.0; - dy = (dw / 2.0) - ((dh * temp2) / (temp * 2.0)); - } - dw -= (dx * 2.0); - dh -= (dy * 2.0); - *w = (int) dw; - *h = (int) dh; - *x = (int) dx; - *y = (int) dy; - break; - - case FULLSCR_SCALE_INT: - dw = (double) sdl_w; - dh = (double) sdl_h; - temp = ((double) *w); - temp2 = ((double) *h); - ratio_w = dw / ((double) *w); - ratio_h = dh / ((double) *h); - if (ratio_h < ratio_w) - ratio_w = ratio_h; - dx = (dw / 2.0) - ((temp * ratio_w) / 2.0); - dy = (dh / 2.0) - ((temp2 * ratio_h) / 2.0); - dw -= (dx * 2.0); - dh -= (dy * 2.0); - *w = (int) dw; - *h = (int) dh; - *x = (int) dx; - *y = (int) dy; - break; - case FULLSCR_SCALE_KEEPRATIO: - dw = (double) sdl_w; - dh = (double) sdl_h; - hsr = dw / dh; - gsr = ((double) *w) / ((double) *h); - if (gsr <= hsr) { - temp = dh * gsr; - dx = (dw - temp) / 2.0; + dw = (double)sdl_w; + dh = (double)sdl_h; + + hsr = dw / dh; + if (config.vid_fullscreen_scale == FULLSCR_SCALE_43) + gsr = 4.0 / 3.0; + else + gsr = ((double) *w) / ((double) *h); + + if (gsr <= hsr) { + temp = dh * gsr; + dx = (dw - temp) / 2.0; dw = temp; - *w = (int) dw; - *h = (int) dh; - *x = (int) dx; + *w = (int)dw; + *h = (int)dh; + *x = (int)dx; *y = 0; } else { temp = dw / gsr; @@ -224,6 +189,24 @@ sdl_stretch(int *w, int *h, int *x, int *y) *y = (int) dy; } break; + + case FULLSCR_SCALE_INT: + dw = (double)sdl_w; + dh = (double)sdl_h; + temp = ((double) *w); + temp2 = ((double) *h); + ratio_w = dw / ((double) *w); + ratio_h = dh / ((double) *h); + if (ratio_h < ratio_w) + ratio_w = ratio_h; + dx = (dw / 2.0) - ((temp * ratio_w) / 2.0); + dy = (dh / 2.0) - ((temp2 * ratio_h) / 2.0); + dw -= (dx * 2.0); + dh -= (dy * 2.0); + *w = (int)dw; + *h = (int)dh; + *x = (int)dx; + *y = (int)dy; } } @@ -233,7 +216,7 @@ sdl_resize(int x, int y) { int ww = 0, wh = 0, wx = 0, wy = 0; - DEBUG("SDL: resizing to %dx%d\n", x, y); + DEBUG("SDL: resizing to %ix%i\n", x, y); if ((x == cur_w) && (y == cur_h)) return; @@ -242,7 +225,8 @@ sdl_resize(int x, int y) wh = y; sdl_stretch(&ww, &wh, &wx, &wy); - MoveWindow(sdl_hwnd, wx, wy, ww, wh, TRUE); + if (sdl_fs) + MoveWindow(sdl_hwnd, wx, wy, ww, wh, TRUE); cur_w = x; cur_h = y; @@ -262,11 +246,13 @@ sdl_blit(bitmap_t *scr, int x, int y, int y1, int y2, int w, int h) return; } - if ((y1 == y2) || (scr == NULL)) { + if ((y1 == y2) || (h <= 0) || (scr == NULL)) { video_blit_done(); return; } + sdl_LockMutex(sdl_mutex); + /* * TODO: * SDL_UpdateTexture() might be better here, as it is @@ -305,6 +291,8 @@ sdl_blit(bitmap_t *scr, int x, int y, int y1, int y2, int w, int h) DEBUG("SDL: unable to copy texture to renderer (%s)\n", sdl_GetError()); sdl_RenderPresent(sdl_render); + + sdl_UnlockMutex(sdl_mutex); } @@ -314,6 +302,11 @@ sdl_close(void) /* Unregister our renderer! */ video_blit_set(NULL); + if (sdl_mutex != NULL) { + sdl_DestroyMutex(sdl_mutex); + sdl_mutex = NULL; + } + if (sdl_tex != NULL) { sdl_DestroyTexture(sdl_tex); sdl_tex = NULL; @@ -335,7 +328,8 @@ sdl_close(void) ShowWindow(hwndRender, TRUE); SetFocus(hwndMain); - DestroyWindow(sdl_hwnd); + if (sdl_fs) + DestroyWindow(sdl_hwnd); sdl_hwnd = NULL; } @@ -471,6 +465,8 @@ sdl_init(int fs) /* Register our renderer! */ video_blit_set(sdl_blit); + sdl_mutex = sdl_CreateMutex(); + is_enabled = 1; return(1); diff --git a/src/win/win_settings.c b/src/win/win_settings.c index 162792e..f59b734 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -8,7 +8,7 @@ * * Implementation of the Settings dialog. * - * Version: @(#)win_settings.c 1.0.41 2019/05/04 + * Version: @(#)win_settings.c 1.0.42 2019/05/17 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -46,6 +46,7 @@ #include #include "../emu.h" #include "../config.h" +#include "../timer.h" #include "../cpu/cpu.h" #include "../mem.h" #include "../rom.h"