diff options
author | Aaron Giles <aaron@aarongiles.com> | 2007-12-17 16:37:57 +0000 |
---|---|---|
committer | Aaron Giles <aaron@aarongiles.com> | 2007-12-17 16:37:57 +0000 |
commit | c82a966b3b72d79ac3ce394980d6b5806e752160 (patch) | |
tree | f46dd63acdd83498db10a0563bb4e874df26d903 /src/emu | |
parent | 8a8ccc594989d85f2277c48d3c158f7cee41d06b (diff) |
Changes for MAME 0.121u2.mame0121u2
Diffstat (limited to 'src/emu')
120 files changed, 928 insertions, 935 deletions
diff --git a/src/emu/attotime.c b/src/emu/attotime.c index bb24ce57340..87b6961adbd 100644 --- a/src/emu/attotime.c +++ b/src/emu/attotime.c @@ -274,6 +274,40 @@ int attotime_compare(attotime _time1, attotime _time2) } +/*------------------------------------------------- + attotime_min - return the minimum of two + attotimes +-------------------------------------------------*/ + +attotime attotime_min(attotime _time1, attotime _time2) +{ + if (_time1.seconds > _time2.seconds) + return _time2; + if (_time1.seconds < _time2.seconds) + return _time1; + if (_time1.attoseconds > _time2.attoseconds) + return _time2; + return _time1; +} + + +/*------------------------------------------------- + attotime_max - return the maximum of two + attotimes +-------------------------------------------------*/ + +attotime attotime_max(attotime _time1, attotime _time2) +{ + if (_time1.seconds > _time2.seconds) + return _time1; + if (_time1.seconds < _time2.seconds) + return _time2; + if (_time1.attoseconds > _time2.attoseconds) + return _time1; + return _time2; +} + + /*************************************************************************** MISC UTILITIES diff --git a/src/emu/attotime.h b/src/emu/attotime.h index 8d7395b9d42..c4388eb01ca 100644 --- a/src/emu/attotime.h +++ b/src/emu/attotime.h @@ -153,6 +153,12 @@ attotime attotime_div(attotime _time1, UINT32 factor); /* compare two attotimes */ int attotime_compare(attotime _time1, attotime _time2); +/* return the minimum of two attotimes */ +attotime attotime_min(attotime _time1, attotime _time2); + +/* return the maximum of two attotimes */ +attotime attotime_max(attotime _time1, attotime _time2); + /* ----- misc utilities ----- */ diff --git a/src/emu/audio/generic.c b/src/emu/audio/generic.c index 18c17e70e2c..4edd9d4f5c0 100644 --- a/src/emu/audio/generic.c +++ b/src/emu/audio/generic.c @@ -85,7 +85,7 @@ static TIMER_CALLBACK( latch_callback ) INLINE void latch_w(int which, UINT16 value) { - timer_call_after_resynch(which | (value << 8), latch_callback); + timer_call_after_resynch(NULL, which | (value << 8), latch_callback); } diff --git a/src/emu/audit.h b/src/emu/audit.h index b17ddecca68..88557dbf5b1 100644 --- a/src/emu/audit.h +++ b/src/emu/audit.h @@ -28,34 +28,46 @@ #define AUDIT_VALIDATE_FULL (HASH_CRC | HASH_SHA) /* return values from audit_verify_roms and audit_verify_samples */ -#define CORRECT 0 -#define BEST_AVAILABLE 1 -#define INCORRECT 2 -#define NOTFOUND 3 +enum +{ + CORRECT = 0, + BEST_AVAILABLE, + INCORRECT, + NOTFOUND +}; /* image types for audit_record.type */ -#define AUDIT_FILE_ROM 0 -#define AUDIT_FILE_DISK 1 -#define AUDIT_FILE_SAMPLE 2 +enum +{ + AUDIT_FILE_ROM = 0, + AUDIT_FILE_DISK, + AUDIT_FILE_SAMPLE +}; /* status values for audit_record.status */ -#define AUDIT_STATUS_GOOD 0 -#define AUDIT_STATUS_FOUND_INVALID 1 -#define AUDIT_STATUS_NOT_FOUND 2 -#define AUDIT_STATUS_ERROR 3 +enum +{ + AUDIT_STATUS_GOOD = 0, + AUDIT_STATUS_FOUND_INVALID, + AUDIT_STATUS_NOT_FOUND, + AUDIT_STATUS_ERROR +}; /* substatus values for audit_record.substatus */ -#define SUBSTATUS_GOOD 0 -#define SUBSTATUS_GOOD_NEEDS_REDUMP 1 -#define SUBSTATUS_FOUND_NODUMP 2 -#define SUBSTATUS_FOUND_BAD_CHECKSUM 3 -#define SUBSTATUS_FOUND_WRONG_LENGTH 4 -#define SUBSTATUS_NOT_FOUND 5 -#define SUBSTATUS_NOT_FOUND_NODUMP 6 -#define SUBSTATUS_NOT_FOUND_OPTIONAL 7 -#define SUBSTATUS_NOT_FOUND_PARENT 8 -#define SUBSTATUS_NOT_FOUND_BIOS 9 -#define SUBSTATUS_ERROR 100 +enum +{ + SUBSTATUS_GOOD = 0, + SUBSTATUS_GOOD_NEEDS_REDUMP, + SUBSTATUS_FOUND_NODUMP, + SUBSTATUS_FOUND_BAD_CHECKSUM, + SUBSTATUS_FOUND_WRONG_LENGTH, + SUBSTATUS_NOT_FOUND, + SUBSTATUS_NOT_FOUND_NODUMP, + SUBSTATUS_NOT_FOUND_OPTIONAL, + SUBSTATUS_NOT_FOUND_PARENT, + SUBSTATUS_NOT_FOUND_BIOS, + SUBSTATUS_ERROR = 100 +}; diff --git a/src/emu/cheat.c b/src/emu/cheat.c index 9a423bbf480..599f4d2d250 100644 --- a/src/emu/cheat.c +++ b/src/emu/cheat.c @@ -1500,7 +1500,7 @@ void cheat_init(running_machine *machine) /* ----- initialize string table ----- */ InitStringTable(); - periodic_timer = timer_alloc(cheat_periodic); + periodic_timer = timer_alloc(cheat_periodic, NULL); timer_adjust(periodic_timer, attotime_make(0, Machine->screen[0].refresh), 0, attotime_make(0, Machine->screen[0].refresh)); add_exit_callback(machine, cheat_exit); diff --git a/src/emu/config.h b/src/emu/config.h index 31411684419..6460e4ae9eb 100644 --- a/src/emu/config.h +++ b/src/emu/config.h @@ -26,11 +26,14 @@ * *************************************/ -#define CONFIG_TYPE_INIT 0 /* opportunity to initialize things first */ -#define CONFIG_TYPE_CONTROLLER 1 /* loading from controller file */ -#define CONFIG_TYPE_DEFAULT 2 /* loading from default.cfg */ -#define CONFIG_TYPE_GAME 3 /* loading from game.cfg */ -#define CONFIG_TYPE_FINAL 4 /* opportunity to finish initialization */ +enum +{ + CONFIG_TYPE_INIT = 0, /* opportunity to initialize things first */ + CONFIG_TYPE_CONTROLLER, /* loading from controller file */ + CONFIG_TYPE_DEFAULT, /* loading from default.cfg */ + CONFIG_TYPE_GAME, /* loading from game.cfg */ + CONFIG_TYPE_FINAL /* opportunity to finish initialization */ +}; diff --git a/src/emu/cpu/apexc/apexc.c b/src/emu/cpu/apexc/apexc.c index ba683a7c2f1..4808cae2299 100644 --- a/src/emu/cpu/apexc/apexc.c +++ b/src/emu/cpu/apexc/apexc.c @@ -343,7 +343,7 @@ typedef struct static apexc_regs apexc; -int apexc_ICount; +static int apexc_ICount; /* decrement ICount by n */ #define DELAY(n) {apexc_ICount -= (n); apexc.current_word = (apexc.current_word + (n)) & 0x1f;} diff --git a/src/emu/cpu/apexc/apexc.h b/src/emu/cpu/apexc/apexc.h index 47bee1f9653..165452b6c6b 100644 --- a/src/emu/cpu/apexc/apexc.h +++ b/src/emu/cpu/apexc/apexc.h @@ -13,8 +13,6 @@ enum from the contents of ML and WS */ }; -extern int apexc_ICount; - void apexc_get_info(UINT32 state, cpuinfo *info); #ifndef SUPPORT_ODD_WORD_SIZES diff --git a/src/emu/cpu/cp1610/cp1610.c b/src/emu/cpu/cp1610/cp1610.c index 3463bd7fa9f..b0ed91017f6 100644 --- a/src/emu/cpu/cp1610/cp1610.c +++ b/src/emu/cpu/cp1610/cp1610.c @@ -46,7 +46,7 @@ typedef struct { int mask_interrupts; } cp1610_Regs; -int cp1610_icount; +static int cp1610_icount; static cp1610_Regs cp1610; diff --git a/src/emu/cpu/cp1610/cp1610.h b/src/emu/cpu/cp1610/cp1610.h index e7304dc51c8..69ccab89f2d 100644 --- a/src/emu/cpu/cp1610/cp1610.h +++ b/src/emu/cpu/cp1610/cp1610.h @@ -32,8 +32,6 @@ enum { #define CP1610_RESET 2 /* Non-Maskable */ #define CP1610_INT_INTR INPUT_LINE_NMI /* Non-Maskable */ -extern int cp1610_icount; /* cycle count */ - void cp1610_get_info(UINT32 state, cpuinfo *info); diff --git a/src/emu/cpu/e132xs/e132xs.c b/src/emu/cpu/e132xs/e132xs.c index 3942942e6e6..1d4f807d291 100644 --- a/src/emu/cpu/e132xs/e132xs.c +++ b/src/emu/cpu/e132xs/e132xs.c @@ -662,7 +662,7 @@ static void adjust_timer_interrupt(void) timer_adjust(hyperstone.timer, attotime_never, 0, attotime_never); } -static TIMER_CALLBACK( timer_callback ) +static TIMER_CALLBACK( e132xs_timer_callback ) { int update = param & 1; int cpunum = param >> 1; @@ -1576,7 +1576,7 @@ static void hyperstone_init(int index, int clock, const void *config, int (*irqc state_save_register_item("E132XS", index, hyperstone.tr_clocks_per_tick); hyperstone.irq_callback = irqcallback; - hyperstone.timer = timer_alloc(timer_callback); + hyperstone.timer = timer_alloc(e132xs_timer_callback, NULL); hyperstone.clock_scale_mask = scale_mask; } diff --git a/src/emu/cpu/f8/f3853.c b/src/emu/cpu/f8/f3853.c index 4aa0d9dc908..a51040446cf 100644 --- a/src/emu/cpu/f8/f3853.c +++ b/src/emu/cpu/f8/f3853.c @@ -90,7 +90,7 @@ void f3853_init(F3853_CONFIG *config) f3853.priority_line=FALSE; f3853.external_interrupt_line=TRUE; - f3853.timer = timer_alloc(f3853_timer_callback); + f3853.timer = timer_alloc(f3853_timer_callback, NULL); } void f3853_reset(void) diff --git a/src/emu/cpu/h83002/h8periph.c b/src/emu/cpu/h83002/h8periph.c index 603434a0ba0..fffd009c273 100644 --- a/src/emu/cpu/h83002/h8periph.c +++ b/src/emu/cpu/h83002/h8periph.c @@ -486,11 +486,11 @@ void h8_register_write8(UINT32 address, UINT8 val) void h8_itu_init(void) { - h8.timer[0] = timer_alloc(h8itu_timer_0_cb); - h8.timer[1] = timer_alloc(h8itu_timer_1_cb); - h8.timer[2] = timer_alloc(h8itu_timer_2_cb); - h8.timer[3] = timer_alloc(h8itu_timer_3_cb); - h8.timer[4] = timer_alloc(h8itu_timer_4_cb); + h8.timer[0] = timer_alloc(h8itu_timer_0_cb, NULL); + h8.timer[1] = timer_alloc(h8itu_timer_1_cb, NULL); + h8.timer[2] = timer_alloc(h8itu_timer_2_cb, NULL); + h8.timer[3] = timer_alloc(h8itu_timer_3_cb, NULL); + h8.timer[4] = timer_alloc(h8itu_timer_4_cb, NULL); h8_itu_reset(); diff --git a/src/emu/cpu/hd6309/hd6309.c b/src/emu/cpu/hd6309/hd6309.c index c6c98a95f15..a9105ff3de9 100644 --- a/src/emu/cpu/hd6309/hd6309.c +++ b/src/emu/cpu/hd6309/hd6309.c @@ -171,7 +171,7 @@ typedef struct /* 6309 registers */ static hd6309_Regs hd6309; -int hd6309_slapstic = 0; +//static int hd6309_slapstic = 0; #define pPPC hd6309.ppc #define pPC hd6309.pc diff --git a/src/emu/cpu/i8051/i8051.c b/src/emu/cpu/i8051/i8051.c index 3231cb69ffc..158da7f2b70 100644 --- a/src/emu/cpu/i8051/i8051.c +++ b/src/emu/cpu/i8051/i8051.c @@ -173,7 +173,7 @@ typedef struct { } I8051; -int i8051_icount; +static int i8051_icount; static I8051 i8051; static I8051_UART uart; diff --git a/src/emu/cpu/i8051/i8051.h b/src/emu/cpu/i8051/i8051.h index 6b5178d3400..49ddce4e42c 100644 --- a/src/emu/cpu/i8051/i8051.h +++ b/src/emu/cpu/i8051/i8051.h @@ -93,8 +93,6 @@ enum { #define TI_FLAG 1 #define RI_FLAG 2 -extern int i8051_icount; /* cycle count */ - extern void i8051_init (int index, int clock, const void *config, int (*irqcallback)(int)); /* Initialize save states */ extern void i8051_reset (void); /* Reset registers to the initial values */ extern void i8051_exit (void); /* Shut down CPU core */ @@ -125,8 +123,6 @@ extern offs_t i8051_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT * 8752 Section ****************************************************************************/ #if (HAS_I8752) -#define i8752_icount i8051_icount - extern void i8752_init (int index, int clock, const void *config, int (*irqcallback)(int)); /* Initialize save states */ extern void i8752_reset (void); /* Reset registers to the initial values */ extern void i8752_exit (void); /* Shut down CPU core */ diff --git a/src/emu/cpu/i8051/i8051ops.c b/src/emu/cpu/i8051/i8051ops.c index ce1d5a76349..250fec3096c 100644 --- a/src/emu/cpu/i8051/i8051ops.c +++ b/src/emu/cpu/i8051/i8051ops.c @@ -270,9 +270,9 @@ INLINE void da_a(void) The carry flag will be set if the result is > 0x99, but not cleared otherwise */ UINT16 new_acc = R_ACC & 0xff; - if(GET_AC || (R_ACC & 0x0f) > 0x09) + if(GET_AC || (new_acc & 0x0f) > 0x09) new_acc += 0x06; - if(GET_CY || (R_ACC & 0xf0) > 0x90) + if(GET_CY || ((new_acc & 0xf0) > 0x90) || (new_acc & ~0xff)) new_acc += 0x60; SFR_W(ACC,new_acc&0xff); if(new_acc & ~0xff) diff --git a/src/emu/cpu/i8085/i8085.c b/src/emu/cpu/i8085/i8085.c index c3983cbefc8..db23ae009ea 100644 --- a/src/emu/cpu/i8085/i8085.c +++ b/src/emu/cpu/i8085/i8085.c @@ -150,7 +150,7 @@ typedef struct { void (*sod_callback)(int state); } i8085_Regs; -int i8085_ICount = 0; +static int i8085_ICount = 0; static i8085_Regs I; static UINT8 ZS[256]; diff --git a/src/emu/cpu/m37710/m37710.c b/src/emu/cpu/m37710/m37710.c index 1ddad9434c2..c80c474dfea 100644 --- a/src/emu/cpu/m37710/m37710.c +++ b/src/emu/cpu/m37710/m37710.c @@ -1054,14 +1054,14 @@ static void m37710_init(int index, int clock, const void *config, int (*irqcallb { INT_ACK = irqcallback; - m37710i_cpu.timers[0] = timer_alloc(m37710_timer_a0_cb); - m37710i_cpu.timers[1] = timer_alloc(m37710_timer_a1_cb); - m37710i_cpu.timers[2] = timer_alloc(m37710_timer_a2_cb); - m37710i_cpu.timers[3] = timer_alloc(m37710_timer_a3_cb); - m37710i_cpu.timers[4] = timer_alloc(m37710_timer_a4_cb); - m37710i_cpu.timers[5] = timer_alloc(m37710_timer_b0_cb); - m37710i_cpu.timers[6] = timer_alloc(m37710_timer_b1_cb); - m37710i_cpu.timers[7] = timer_alloc(m37710_timer_b2_cb); + m37710i_cpu.timers[0] = timer_alloc(m37710_timer_a0_cb, NULL); + m37710i_cpu.timers[1] = timer_alloc(m37710_timer_a1_cb, NULL); + m37710i_cpu.timers[2] = timer_alloc(m37710_timer_a2_cb, NULL); + m37710i_cpu.timers[3] = timer_alloc(m37710_timer_a3_cb, NULL); + m37710i_cpu.timers[4] = timer_alloc(m37710_timer_a4_cb, NULL); + m37710i_cpu.timers[5] = timer_alloc(m37710_timer_b0_cb, NULL); + m37710i_cpu.timers[6] = timer_alloc(m37710_timer_b1_cb, NULL); + m37710i_cpu.timers[7] = timer_alloc(m37710_timer_b2_cb, NULL); state_save_register_item("M377xx", index, m37710i_cpu.a); state_save_register_item("M377xx", index, m37710i_cpu.b); diff --git a/src/emu/cpu/m6502/m6502.c b/src/emu/cpu/m6502/m6502.c index 89da4704784..ff8d63a7716 100644 --- a/src/emu/cpu/m6502/m6502.c +++ b/src/emu/cpu/m6502/m6502.c @@ -87,8 +87,8 @@ typedef struct } m6502_Regs; -int m6502_IntOccured = 0; -int m6502_ICount = 0; +static int m6502_IntOccured = 0; +static int m6502_ICount = 0; static m6502_Regs m6502; diff --git a/src/emu/cpu/m6800/m6800.c b/src/emu/cpu/m6800/m6800.c index 3adbc951a5b..b4a1de2e2d3 100644 --- a/src/emu/cpu/m6800/m6800.c +++ b/src/emu/cpu/m6800/m6800.c @@ -610,6 +610,7 @@ static void check_timer_event(void) /* include the opcode functions */ #include "6800ops.c" +#if (HAS_M6801||HAS_M6803||HAS_HD63701) static void m6800_tx(int value) { m6800.port2_data = (m6800.port2_data & 0xef) | (value << 4); @@ -804,6 +805,7 @@ static TIMER_CALLBACK(m6800_rx_tick) } } } +#endif /**************************************************************************** * Reset registers to their initial values @@ -1274,8 +1276,8 @@ static void m6801_init(int index, int clock, const void *config, int (*irqcallba m6800.irq_callback = irqcallback; m6800.clock = clock; - m6800_rx_timer = timer_alloc(m6800_rx_tick); - m6800_tx_timer = timer_alloc(m6800_tx_tick); + m6800_rx_timer = timer_alloc(m6800_rx_tick, NULL); + m6800_tx_timer = timer_alloc(m6800_tx_tick, NULL); state_register("m6801", index); } @@ -1307,8 +1309,8 @@ static void m6803_init(int index, int clock, const void *config, int (*irqcallba m6800.irq_callback = irqcallback; m6800.clock = clock; - m6800_rx_timer = timer_alloc(m6800_rx_tick); - m6800_tx_timer = timer_alloc(m6800_tx_tick); + m6800_rx_timer = timer_alloc(m6800_rx_tick, NULL); + m6800_tx_timer = timer_alloc(m6800_tx_tick, NULL); state_register("m6803", index); } @@ -1650,8 +1652,8 @@ static void hd63701_init(int index, int clock, const void *config, int (*irqcall m6800.irq_callback = irqcallback; m6800.clock = clock; - m6800_rx_timer = timer_alloc(m6800_rx_tick); - m6800_tx_timer = timer_alloc(m6800_tx_tick); + m6800_rx_timer = timer_alloc(m6800_rx_tick, NULL); + m6800_tx_timer = timer_alloc(m6800_tx_tick, NULL); state_register("hd63701", index); } diff --git a/src/emu/cpu/m6800/m6800.h b/src/emu/cpu/m6800/m6800.h index 7b711d6bc59..c487777c9b8 100644 --- a/src/emu/cpu/m6800/m6800.h +++ b/src/emu/cpu/m6800/m6800.h @@ -83,7 +83,7 @@ extern void m6802_get_info(UINT32 state, cpuinfo *info); extern void m6803_get_info(UINT32 state, cpuinfo *info); #endif -#if (HAS_M6803||HAS_HD63701) +#if (HAS_M6801||HAS_M6803||HAS_HD63701) /* By default, on a port write port bits which are not set as output in the DDR */ /* are set to the value returned by a read from the same port. If you need to */ /* know the DDR for e.g. port 1, do m6803_internal_registers_r(M6801_DDR1) */ diff --git a/src/emu/cpu/m68000/m68000.h b/src/emu/cpu/m68000/m68000.h index f90ac95da26..e073c85332b 100644 --- a/src/emu/cpu/m68000/m68000.h +++ b/src/emu/cpu/m68000/m68000.h @@ -26,18 +26,19 @@ extern int m68k_ICount; struct m68k_memory_interface { - offs_t opcode_xor; // Address Calculation - UINT8 (*read8)(offs_t); // Normal read 8 bit + offs_t opcode_xor; // Address Calculation + UINT16 (*readimm16)(offs_t); // Immediate read 16 bit + UINT8 (*read8)(offs_t); // Normal read 8 bit UINT16 (*read16)(offs_t); // Normal read 16 bit UINT32 (*read32)(offs_t); // Normal read 32 bit - void (*write8)(offs_t, UINT8); // Write 8 bit - void (*write16)(offs_t, UINT16); // Write 16 bit - void (*write32)(offs_t, UINT32); // Write 32 bit - void (*changepc)(offs_t); // Change PC + void (*write8)(offs_t, UINT8); // Write 8 bit + void (*write16)(offs_t, UINT16); // Write 16 bit + void (*write32)(offs_t, UINT32); // Write 32 bit + void (*changepc)(offs_t); // Change PC // For Encrypted Stuff - UINT8 (*read8pc)(offs_t); // PC Relative read 8 bit + UINT8 (*read8pc)(offs_t); // PC Relative read 8 bit UINT16 (*read16pc)(offs_t); // PC Relative read 16 bit UINT32 (*read32pc)(offs_t); // PC Relative read 32 bit @@ -47,7 +48,7 @@ struct m68k_memory_interface struct m68k_encryption_interface { - UINT8 (*read8pc)(offs_t); // PC Relative read 8 bit + UINT8 (*read8pc)(offs_t); // PC Relative read 8 bit UINT16 (*read16pc)(offs_t); // PC Relative read 16 bit UINT32 (*read32pc)(offs_t); // PC Relative read 32 bit diff --git a/src/emu/cpu/m68000/m68kmame.c b/src/emu/cpu/m68000/m68kmame.c index 789c821c8a7..b213023ccba 100644 --- a/src/emu/cpu/m68000/m68kmame.c +++ b/src/emu/cpu/m68000/m68kmame.c @@ -20,6 +20,12 @@ void m68k_set_encrypted_opcode_range(int cpunum, offs_t start, offs_t end) * 8-bit data memory interface ****************************************************************************/ +static UINT16 m68008_read_immediate_16(offs_t address) +{ + offs_t addr = (address) ^ m68k_memory_intf.opcode_xor; + return (cpu_readop(addr) << 8) | (cpu_readop(addr + 1)); +} + static UINT16 readword_d8(offs_t address) { UINT16 result = program_read_byte_8(address) << 8; @@ -52,6 +58,7 @@ static void writelong_d8(offs_t address, UINT32 data) static const struct m68k_memory_interface interface_d8 = { 0, + m68008_read_immediate_16, program_read_byte_8, readword_d8, readlong_d8, @@ -64,6 +71,11 @@ static const struct m68k_memory_interface interface_d8 = * 16-bit data memory interface ****************************************************************************/ +static UINT16 read_immediate_16(offs_t address) +{ + return cpu_readop16((address) ^ m68k_memory_intf.opcode_xor); +} + static UINT32 readlong_d16(offs_t address) { UINT32 result = program_read_word_16be(address) << 16; @@ -80,6 +92,7 @@ static void writelong_d16(offs_t address, UINT32 data) static const struct m68k_memory_interface interface_d16 = { 0, + read_immediate_16, program_read_byte_16be, program_read_word_16be, readlong_d16, @@ -155,6 +168,7 @@ static void writelong_d32(offs_t address, UINT32 data) static const struct m68k_memory_interface interface_d32 = { WORD_XOR_BE(0), + read_immediate_16, program_read_byte_32be, readword_d32, readlong_d32, @@ -291,7 +305,7 @@ static offs_t m68008_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UIN ****************************************************************************/ #if HAS_M68010 -void m68010_init(int index, int clock, const void *config, int (*irqcallback)(int)) +static void m68010_init(int index, int clock, const void *config, int (*irqcallback)(int)) { m68k_init(); m68k_set_cpu_type(M68K_CPU_TYPE_68010); diff --git a/src/emu/cpu/m68000/m68kmame.h b/src/emu/cpu/m68000/m68kmame.h index 046f38eb0ea..f98bee2e33c 100644 --- a/src/emu/cpu/m68000/m68kmame.h +++ b/src/emu/cpu/m68000/m68kmame.h @@ -65,13 +65,13 @@ extern offs_t m68k_encrypted_opcode_end[MAX_CPU]; #define m68k_read_memory_16(address) (*m68k_memory_intf.read16)(address) #define m68k_read_memory_32(address) (*m68k_memory_intf.read32)(address) -#define m68k_read_immediate_16(address) m68kx_read_immediate_16(address) +#define m68k_read_immediate_16(address) (*m68k_memory_intf.readimm16)(address) #define m68k_read_immediate_32(address) m68kx_read_immediate_32(address) #define m68k_read_pcrelative_8(address) m68kx_read_pcrelative_8(address) #define m68k_read_pcrelative_16(address) m68kx_read_pcrelative_16(address) #define m68k_read_pcrelative_32(address) m68kx_read_pcrelative_32(address) -#define m68k_read_disassembler_16(address) m68kx_read_immediate_16(address) +#define m68k_read_disassembler_16(address) m68k_read_immediate_16(address) #define m68k_read_disassembler_32(address) m68kx_read_immediate_32(address) #define m68k_write_memory_8(address, value) (*m68k_memory_intf.write8)(address, value) @@ -80,7 +80,6 @@ extern offs_t m68k_encrypted_opcode_end[MAX_CPU]; #define m68k_write_memory_32_pd(address, value) m68kx_write_memory_32_pd(address, value) -INLINE unsigned int m68k_read_immediate_16(unsigned int address); INLINE unsigned int m68k_read_immediate_32(unsigned int address); INLINE unsigned int m68k_read_pcrelative_8(unsigned int address); INLINE unsigned int m68k_read_pcrelative_16(unsigned int address); @@ -88,11 +87,6 @@ INLINE unsigned int m68k_read_pcrelative_32(unsigned int address); INLINE void m68k_write_memory_32_pd(unsigned int address, unsigned int value); -INLINE unsigned int m68kx_read_immediate_16(unsigned int address) -{ - return cpu_readop16((address) ^ m68k_memory_intf.opcode_xor); -} - INLINE unsigned int m68kx_read_immediate_32(unsigned int address) { return ((m68k_read_immediate_16(address) << 16) | m68k_read_immediate_16((address)+2)); diff --git a/src/emu/cpu/m6805/m6805.c b/src/emu/cpu/m6805/m6805.c index eb56a4eecf5..6d4f4efc19b 100644 --- a/src/emu/cpu/m6805/m6805.c +++ b/src/emu/cpu/m6805/m6805.c @@ -78,7 +78,7 @@ static PAIR ea; /* effective address */ #define EA ea.w.l /* public globals */ -int m6805_ICount=50000; +static int m6805_ICount=50000; /* DS -- THESE ARE RE-DEFINED IN m6805.h TO RAM, ROM or FUNCTIONS IN cpuintrf.c */ #define RM(Addr) M6805_RDMEM(Addr) diff --git a/src/emu/cpu/mips/dismips.c b/src/emu/cpu/mips/dismips.c index 3b7bc61cd8e..10ce5b89963 100644 --- a/src/emu/cpu/mips/dismips.c +++ b/src/emu/cpu/mips/dismips.c @@ -10,7 +10,7 @@ extern unsigned dasmr3k(char *,unsigned, UINT32); extern unsigned dasmmips3(char *,unsigned, UINT32); -struct +static struct { UINT8 id[ 8 ]; UINT32 text; /* SCE only */ diff --git a/src/emu/cpu/mips/mips3com.c b/src/emu/cpu/mips/mips3com.c index 55fc05bcacd..f9d22ffc00a 100644 --- a/src/emu/cpu/mips/mips3com.c +++ b/src/emu/cpu/mips/mips3com.c @@ -118,7 +118,7 @@ void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, int in mips->tlb_table = auto_malloc(sizeof(mips->tlb_table[0]) * (1 << (MIPS3_MAX_PADDR_SHIFT - MIPS3_MIN_PAGE_SHIFT))); /* allocate a timer for the compare interrupt */ - mips->compare_int_timer = timer_alloc(compare_int_callback); + mips->compare_int_timer = timer_alloc(compare_int_callback, NULL); /* reset the state */ mips3com_reset(mips); diff --git a/src/emu/cpu/powerpc/ppc.c b/src/emu/cpu/powerpc/ppc.c index ff371fda52a..a3a4aded42a 100644 --- a/src/emu/cpu/powerpc/ppc.c +++ b/src/emu/cpu/powerpc/ppc.c @@ -12,8 +12,8 @@ void ppc602_exception(int exception); #endif #if (HAS_PPC403) void ppc403_exception(int exception); -UINT8 ppc403_spu_r(UINT32 a); -void ppc403_spu_w(UINT32 a, UINT8 d); +static UINT8 ppc403_spu_r(UINT32 a); +static void ppc403_spu_w(UINT32 a, UINT8 d); #endif #define RD ((op >> 21) & 0x1F) @@ -921,8 +921,8 @@ static void ppc403_init(int index, int clock, const void *_config, int (*irqcall // !!! why is rfci here !!! optable19[51] = ppc_rfci; - ppc.spu.rx_timer = timer_alloc(ppc403_spu_rx_callback); - ppc.spu.tx_timer = timer_alloc(ppc403_spu_tx_callback); + ppc.spu.rx_timer = timer_alloc(ppc403_spu_rx_callback, NULL); + ppc.spu.tx_timer = timer_alloc(ppc403_spu_tx_callback, NULL); ppc.read8 = ppc403_read8; ppc.read16 = ppc403_read16; diff --git a/src/emu/cpu/powerpc/ppc403.c b/src/emu/cpu/powerpc/ppc403.c index 9d1988de86d..aa57f1a2ef6 100644 --- a/src/emu/cpu/powerpc/ppc403.c +++ b/src/emu/cpu/powerpc/ppc403.c @@ -678,7 +678,7 @@ static void ppc403_spu_w(UINT32 a, UINT8 d) case 0x9: ppc.spu.sptb = d; - ppc403_spu_tx_callback(Machine, cpu_getactivecpu()); + ppc403_spu_tx_callback(Machine, NULL, cpu_getactivecpu()); break; default: diff --git a/src/emu/cpu/powerpc/ppcdrc.c b/src/emu/cpu/powerpc/ppcdrc.c index 56780178758..77948103c42 100644 --- a/src/emu/cpu/powerpc/ppcdrc.c +++ b/src/emu/cpu/powerpc/ppcdrc.c @@ -1074,8 +1074,8 @@ static void ppcdrc403_init(int index, int clock, const void *_config, int (*irqc optable31[163] = recompile_wrteei; optable19[51] = recompile_rfci; - ppc.spu.rx_timer = timer_alloc(ppc403_spu_rx_callback); - ppc.spu.tx_timer = timer_alloc(ppc403_spu_tx_callback); + ppc.spu.rx_timer = timer_alloc(ppc403_spu_rx_callback, NULL); + ppc.spu.tx_timer = timer_alloc(ppc403_spu_tx_callback, NULL); ppc.is603 = 0; ppc.is602 = 0; diff --git a/src/emu/cpu/rsp/rsp.c b/src/emu/cpu/rsp/rsp.c index 2116d65faed..1b0b4d16c91 100644 --- a/src/emu/cpu/rsp/rsp.c +++ b/src/emu/cpu/rsp/rsp.c @@ -31,11 +31,7 @@ static FILE *exec_output; #endif -extern UINT32 sp_read_reg(UINT32 reg); -extern void sp_write_reg(UINT32 reg, UINT32 data); -extern READ32_HANDLER( n64_dp_reg_r ); -extern WRITE32_HANDLER( n64_dp_reg_w ); -extern void sp_set_status(UINT32 status); +static rsp_config *config; typedef struct @@ -52,7 +48,7 @@ typedef struct UINT32 r[32]; VECTOR_REG v[32]; UINT16 flag[4]; - UINT32 sr; + UINT32 sr; INT64 accum[8]; INT32 square_root_res; @@ -235,11 +231,11 @@ static UINT32 get_cop0_reg(int reg) { if (reg >= 0 && reg < 8) { - return sp_read_reg(reg); + return (config->sp_reg_r)(reg, 0x00000000); } else if (reg >= 8 && reg < 16) { - return n64_dp_reg_r(reg - 8, 0x00000000); + return (config->dp_reg_r)(reg - 8, 0x00000000); } else { @@ -251,11 +247,11 @@ static void set_cop0_reg(int reg, UINT32 data) { if (reg >= 0 && reg < 8) { - sp_write_reg(reg, data); + (config->sp_reg_w)(reg, data, 0x00000000); } else if (reg >= 8 && reg < 16) { - n64_dp_reg_w(reg - 8, data, 0x00000000); + (config->dp_reg_w)(reg - 8, data, 0x00000000); } else { @@ -348,33 +344,35 @@ static const int vector_elements_2[16][8] = static void rsp_init(int index, int clock, const void *_config, int (*irqcallback)(int)) { - //int regIdx, accumIdx; + //int regIdx, accumIdx; + config = (rsp_config *)_config; + #if LOG_INSTRUCTION_EXECUTION exec_output = fopen("rsp_execute.txt", "wt"); #endif rsp.irq_callback = irqcallback; - /* - for(regIdx = 0; regIdx < 32; regIdx++ ) - { - rsp.r[regIdx] = 0; - rsp.v[regIdx].d[0] = 0; - rsp.v[regIdx].d[1] = 0; - } - for(accumIdx = 0; accumIdx < 8; accumIdx++ ) - { - rsp.accum[accumIdx] = 0; - } - rsp.flag[0] = 0; - rsp.flag[1] = 0; - rsp.flag[2] = 0; - rsp.flag[3] = 0; - rsp.square_root_res = 0; - rsp.square_root_high = 0; - rsp.reciprocal_res = 0; - rsp.reciprocal_high = 0; - */ - rsp.sr = RSP_STATUS_HALT; +#if 0 + for(regIdx = 0; regIdx < 32; regIdx++ ) + { + rsp.r[regIdx] = 0; + rsp.v[regIdx].d[0] = 0; + rsp.v[regIdx].d[1] = 0; + } + for(accumIdx = 0; accumIdx < 8; accumIdx++ ) + { + rsp.accum[accumIdx] = 0; + } + rsp.flag[0] = 0; + rsp.flag[1] = 0; + rsp.flag[2] = 0; + rsp.flag[3] = 0; + rsp.square_root_res = 0; + rsp.square_root_high = 0; + rsp.reciprocal_res = 0; + rsp.reciprocal_high = 0; +#endif + rsp.sr = RSP_STATUS_HALT; } static void rsp_exit(void) @@ -397,18 +395,17 @@ static void rsp_exit(void) #endif #if SAVE_DMEM { - /*int i; - FILE *dmem; - dmem = fopen("rsp_dmem.txt", "wt"); - - for (i=0; i < 0x1000; i+=4) - { - fprintf(dmem, "%08X: %08X\n", 0x04000000 + i, READ32(0x04000000 + i)); - } - fclose(dmem);*/ - int i; FILE *dmem; +#if 0 + dmem = fopen("rsp_dmem.txt", "wt"); + + for (i=0; i < 0x1000; i+=4) + { + fprintf(dmem, "%08X: %08X\n", 0x04000000 + i, READ32(0x04000000 + i)); + } + fclose(dmem); +#endif dmem = fopen("rsp_dmem.bin", "wb"); for (i=0; i < 0x1000; i++) @@ -966,7 +963,7 @@ static void handle_swc2(UINT32 op) // // Stores one element from maximum of 8 vectors, while incrementing element index - int element, eaoffset; + int element; int vs = dest; int ve = dest + 8; if (ve > 32) @@ -2308,7 +2305,7 @@ static void handle_vector_ops(UINT32 op) i = 0; } } - rec = (INT32)(0x7fffffff / (double)rec); + rec = (INT32)(0x7fffffff / (double)rec); for (i = 31; i > 0; i--) { if (rec & (1 << i)) @@ -2554,10 +2551,10 @@ static int rsp_execute(int cycles) rsp.pc = 0x4001000 | (rsp.pc & 0xfff); - if( rsp.sr & ( RSP_STATUS_HALT | RSP_STATUS_BROKE ) ) - { - rsp_icount = 0; - } + if( rsp.sr & ( RSP_STATUS_HALT | RSP_STATUS_BROKE ) ) + { + rsp_icount = 0; + } while (rsp_icount > 0) { @@ -2591,7 +2588,7 @@ static int rsp_execute(int cycles) case 0x09: /* JALR */ JUMP_PC_L(RSVAL, RDREG); break; case 0x0d: /* BREAK */ { - sp_set_status(0x3); + (config->sp_set_status)(0x3); rsp_icount = 1; #if LOG_INSTRUCTION_EXECUTION @@ -2784,15 +2781,15 @@ static int rsp_execute(int cycles) --rsp_icount; - if( rsp.sr & RSP_STATUS_SSTEP ) - { - rsp.sr |= RSP_STATUS_BROKE; - } + if( rsp.sr & RSP_STATUS_SSTEP ) + { + rsp.sr |= RSP_STATUS_BROKE; + } - if( rsp.sr & ( RSP_STATUS_HALT | RSP_STATUS_BROKE ) ) - { - rsp_icount = 0; - } + if( rsp.sr & ( RSP_STATUS_HALT | RSP_STATUS_BROKE ) ) + { + rsp_icount = 0; + } } @@ -2942,8 +2939,8 @@ void rsp_get_info(UINT32 state, cpuinfo *info) case CPUINFO_INT_REGISTER + RSP_R30: info->i = rsp.r[30]; break; case CPUINFO_INT_SP: case CPUINFO_INT_REGISTER + RSP_R31: info->i = rsp.r[31]; break; - case CPUINFO_INT_REGISTER + RSP_SR: info->i = rsp.sr; break; - case CPUINFO_INT_REGISTER + RSP_NEXTPC: info->i = rsp.nextpc; break; + case CPUINFO_INT_REGISTER + RSP_SR: info->i = rsp.sr; break; + case CPUINFO_INT_REGISTER + RSP_NEXTPC: info->i = rsp.nextpc; break; /* --- the following bits of info are returned as pointers to data or functions --- */ case CPUINFO_PTR_GET_CONTEXT: info->getcontext = rsp_get_context; break; @@ -3002,7 +2999,7 @@ void rsp_get_info(UINT32 state, cpuinfo *info) case CPUINFO_STR_REGISTER + RSP_R29: sprintf(info->s, "R29: %08X", rsp.r[29]); break; case CPUINFO_STR_REGISTER + RSP_R30: sprintf(info->s, "R30: %08X", rsp.r[30]); break; case CPUINFO_STR_REGISTER + RSP_R31: sprintf(info->s, "R31: %08X", rsp.r[31]); break; - case CPUINFO_STR_REGISTER + RSP_SR: sprintf(info->s, "SR: %08X", rsp.sr); break; - case CPUINFO_STR_REGISTER + RSP_NEXTPC: sprintf(info->s, "NPC: %08X", rsp.nextpc);break; + case CPUINFO_STR_REGISTER + RSP_SR: sprintf(info->s, "SR: %08X", rsp.sr); break; + case CPUINFO_STR_REGISTER + RSP_NEXTPC: sprintf(info->s, "NPC: %08X", rsp.nextpc);break; } } diff --git a/src/emu/cpu/rsp/rsp.h b/src/emu/cpu/rsp/rsp.h index 345e7ae1543..2dc6ce2d644 100644 --- a/src/emu/cpu/rsp/rsp.h +++ b/src/emu/cpu/rsp/rsp.h @@ -1,6 +1,16 @@ #ifndef _RSP_H #define _RSP_H +struct _rsp_config +{ + read32_handler dp_reg_r; + write32_handler dp_reg_w; + read32_handler sp_reg_r; + write32_handler sp_reg_w; + void (*sp_set_status)(UINT32 status); +}; +typedef struct _rsp_config rsp_config; + enum { RSP_PC = 1, diff --git a/src/emu/cpu/s2650/s2650.c b/src/emu/cpu/s2650/s2650.c index ef819bb397f..7dd5d4f40ef 100644 --- a/src/emu/cpu/s2650/s2650.c +++ b/src/emu/cpu/s2650/s2650.c @@ -28,7 +28,7 @@ /* define this to expand all EA calculations inline */ #define INLINE_EA 1 -int s2650_ICount = 0; +static int s2650_ICount = 0; typedef struct { UINT16 ppc; /* previous program counter (page + iar) */ diff --git a/src/emu/cpu/sc61860/sc61860.c b/src/emu/cpu/sc61860/sc61860.c index ef62727d1ad..4da083297d9 100644 --- a/src/emu/cpu/sc61860/sc61860.c +++ b/src/emu/cpu/sc61860/sc61860.c @@ -94,7 +94,7 @@ static void sc61860_reset(void) static void sc61860_init(int index, int clock, const void *config, int (*irqcallback)(int)) { sc61860.config = (SC61860_CONFIG *) config; - timer_pulse(ATTOTIME_IN_HZ(500), 0, sc61860_2ms_tick); + timer_pulse(ATTOTIME_IN_HZ(500), NULL, 0, sc61860_2ms_tick); } static void sc61860_get_context (void *dst) diff --git a/src/emu/cpu/sh2/sh2.c b/src/emu/cpu/sh2/sh2.c index ef56912acaa..57ea7e545c3 100644 --- a/src/emu/cpu/sh2/sh2.c +++ b/src/emu/cpu/sh2/sh2.c @@ -2933,13 +2933,13 @@ static void sh2_init(int index, int clock, const void *config, int (*irqcallback { const struct sh2_config *conf = config; - sh2.timer = timer_alloc(sh2_timer_callback); + sh2.timer = timer_alloc(sh2_timer_callback, NULL); timer_adjust(sh2.timer, attotime_never, 0, attotime_zero); - sh2.dma_timer[0] = timer_alloc(sh2_dmac_callback); + sh2.dma_timer[0] = timer_alloc(sh2_dmac_callback, NULL); timer_adjust(sh2.dma_timer[0], attotime_never, 0, attotime_zero); - sh2.dma_timer[1] = timer_alloc(sh2_dmac_callback); + sh2.dma_timer[1] = timer_alloc(sh2_dmac_callback, NULL); timer_adjust(sh2.dma_timer[1], attotime_never, 0, attotime_zero); sh2.m = auto_malloc(0x200); diff --git a/src/emu/cpu/sh4/sh4.c b/src/emu/cpu/sh4/sh4.c index 82daf0cc51c..aacc951245e 100644 --- a/src/emu/cpu/sh4/sh4.c +++ b/src/emu/cpu/sh4/sh4.c @@ -4121,27 +4121,27 @@ static void sh4_init(int index, int clock, const void *config, int (*irqcallback { const struct sh4_config *conf = config; - sh4.timer0 = timer_alloc(sh4_timer0_callback); + sh4.timer0 = timer_alloc(sh4_timer0_callback, NULL); timer_adjust(sh4.timer0, attotime_never, 0, attotime_zero); - sh4.timer1 = timer_alloc(sh4_timer1_callback); + sh4.timer1 = timer_alloc(sh4_timer1_callback, NULL); timer_adjust(sh4.timer1, attotime_never, 0, attotime_zero); - sh4.timer2 = timer_alloc(sh4_timer2_callback); + sh4.timer2 = timer_alloc(sh4_timer2_callback, NULL); timer_adjust(sh4.timer2, attotime_never, 0, attotime_zero); - sh4.dma_timer[0] = timer_alloc(sh4_dmac_callback); + sh4.dma_timer[0] = timer_alloc(sh4_dmac_callback, NULL); timer_adjust(sh4.dma_timer[0], attotime_never, 0, attotime_zero); - sh4.dma_timer[1] = timer_alloc(sh4_dmac_callback); + sh4.dma_timer[1] = timer_alloc(sh4_dmac_callback, NULL); timer_adjust(sh4.dma_timer[1], attotime_never, 0, attotime_zero); - sh4.dma_timer[2] = timer_alloc(sh4_dmac_callback); + sh4.dma_timer[2] = timer_alloc(sh4_dmac_callback, NULL); timer_adjust(sh4.dma_timer[2], attotime_never, 0, attotime_zero); - sh4.dma_timer[3] = timer_alloc(sh4_dmac_callback); + sh4.dma_timer[3] = timer_alloc(sh4_dmac_callback, NULL); timer_adjust(sh4.dma_timer[3], attotime_never, 0, attotime_zero); - sh4.refresh_timer = timer_alloc(sh4_refresh_timer_callback); + sh4.refresh_timer = timer_alloc(sh4_refresh_timer_callback, NULL); timer_adjust(sh4.refresh_timer, attotime_never, 0, attotime_zero); sh4.refresh_timer_base = 0; - sh4.rtc_timer = timer_alloc(sh4_rtc_timer_callback); + sh4.rtc_timer = timer_alloc(sh4_rtc_timer_callback, NULL); timer_adjust(sh4.rtc_timer, attotime_never, 0, attotime_zero); sh4.m = auto_malloc(16384*4); diff --git a/src/emu/cpu/sm8500/sm8500.c b/src/emu/cpu/sm8500/sm8500.c index 2c12d232f99..eb6526bc1ab 100644 --- a/src/emu/cpu/sm8500/sm8500.c +++ b/src/emu/cpu/sm8500/sm8500.c @@ -53,7 +53,7 @@ typedef struct { static sm8500_regs regs; /* nr of cycles to run */ -int sm8500_icount; +static int sm8500_icount; static UINT8 sm8500_b2w[8] = { 0, 8, 2, 10, 4, 12, 6, 14 diff --git a/src/emu/cpu/sm8500/sm8500.h b/src/emu/cpu/sm8500/sm8500.h index 4d11727d6c3..89aaab5f4d6 100644 --- a/src/emu/cpu/sm8500/sm8500.h +++ b/src/emu/cpu/sm8500/sm8500.h @@ -20,8 +20,6 @@ typedef struct { #define WDT_INT 9 #define NMI_INT 10 -extern int sm8500_icount; - enum { /* "main" 16 bit register */ SM8500_PC=1, SM8500_SP, SM8500_PS, SM8500_SYS16, SM8500_RR0, SM8500_RR2, SM8500_RR4, SM8500_RR6, SM8500_RR8, SM8500_RR10, diff --git a/src/emu/cpu/spc700/spc700.c b/src/emu/cpu/spc700/spc700.c index 8e9c1aca272..78f8a183fb4 100644 --- a/src/emu/cpu/spc700/spc700.c +++ b/src/emu/cpu/spc700/spc700.c @@ -134,7 +134,7 @@ typedef struct /* Our CPU structure */ static spc700i_cpu_struct spc700i_cpu = {0}; -int spc700_ICount = 0; +static int spc700_ICount = 0; /* Temporary Variables */ static uint spc700i_source; diff --git a/src/emu/cpu/spc700/spc700.h b/src/emu/cpu/spc700/spc700.h index 41407488485..e821bf63e3c 100644 --- a/src/emu/cpu/spc700/spc700.h +++ b/src/emu/cpu/spc700/spc700.h @@ -96,8 +96,6 @@ const char *spc700_info(void *context, int regnum); /* Pulse the SO (Set Overflow) pin on the CPU */ void spc700_pulse_so(void); -extern int spc700_ICount; /* cycle count */ - int spc700_execute(int clocks); diff --git a/src/emu/cpu/tlcs90/tlcs90.c b/src/emu/cpu/tlcs90/tlcs90.c index 3a1576eaa65..dc18b69b020 100644 --- a/src/emu/cpu/tlcs90/tlcs90.c +++ b/src/emu/cpu/tlcs90/tlcs90.c @@ -2430,7 +2430,7 @@ static TIMER_CALLBACK( t90_timer_callback ) case 2: if ( !is16bit ) if ( (T90.internal_registers[ T90_TCLK - T90_IOBASE ] & (0x03 << (i * 2 + 2))) == 0 ) // T0/T1 match signal clocks T1/T3 - t90_timer_callback(machine, i+1); + t90_timer_callback(machine, NULL, i+1); break; } } @@ -2446,7 +2446,7 @@ static TIMER_CALLBACK( t90_timer_callback ) case 0: case 2: if ( is16bit ) // T0/T1 overflow signal clocks T1/T3 - t90_timer_callback(machine, i+1); + t90_timer_callback(machine, NULL, i+1); break; } } @@ -2662,9 +2662,9 @@ static void t90_init(int index, int clock, const void *config, int (*irqcallback // Timers for (i = 0; i < 4; i++) - T90.timer[i] = timer_alloc(t90_timer_callback); + T90.timer[i] = timer_alloc(t90_timer_callback, NULL); - T90.timer[4] = timer_alloc(t90_timer4_callback); + T90.timer[4] = timer_alloc(t90_timer4_callback, NULL); } static ADDRESS_MAP_START(tmp90840_mem, ADDRESS_SPACE_PROGRAM, 8) diff --git a/src/emu/cpu/tms34010/tms34010.c b/src/emu/cpu/tms34010/tms34010.c index b2375f4d0b5..eab03d73025 100644 --- a/src/emu/cpu/tms34010/tms34010.c +++ b/src/emu/cpu/tms34010/tms34010.c @@ -616,7 +616,7 @@ static void tms34010_init(int index, int clock, const void *_config, int (*irqca screen_to_cpu[config->scrnum] = index; /* allocate a scanline timer and set it to go off at the start */ - state.scantimer = timer_alloc(scanline_callback); + state.scantimer = timer_alloc(scanline_callback, NULL); timer_adjust(state.scantimer, attotime_zero, index, attotime_zero); /* allocate the shiftreg */ @@ -932,7 +932,7 @@ static TIMER_CALLBACK( scanline_callback ) if (enabled && vcount == SMART_IOREG(DPYINT)) { /* generate the display interrupt signal */ - internal_interrupt_callback(machine, cpunum | (TMS34010_DI << 8)); + internal_interrupt_callback(machine, NULL, cpunum | (TMS34010_DI << 8)); } /* at the start of VBLANK, load the starting display address */ @@ -1179,7 +1179,7 @@ WRITE16_HANDLER( tms34010_io_register_w ) /* NMI issued? */ if (data & 0x0100) - timer_call_after_resynch(cpunum, internal_interrupt_callback); + timer_call_after_resynch(NULL, cpunum, internal_interrupt_callback); break; case REG_HSTCTLL: @@ -1214,7 +1214,7 @@ WRITE16_HANDLER( tms34010_io_register_w ) /* input interrupt? (should really be state-based, but the functions don't exist!) */ if (!(oldreg & 0x0008) && (newreg & 0x0008)) - timer_call_after_resynch(cpunum | (TMS34010_HI << 8), internal_interrupt_callback); + timer_call_after_resynch(NULL, cpunum | (TMS34010_HI << 8), internal_interrupt_callback); else if ((oldreg & 0x0008) && !(newreg & 0x0008)) IOREG(REG_INTPEND) &= ~TMS34010_HI; break; @@ -1323,7 +1323,7 @@ WRITE16_HANDLER( tms34020_io_register_w ) /* NMI issued? */ if (data & 0x0100) - timer_call_after_resynch(cpunum, internal_interrupt_callback); + timer_call_after_resynch(NULL, cpunum, internal_interrupt_callback); break; case REG020_HSTCTLL: @@ -1358,7 +1358,7 @@ WRITE16_HANDLER( tms34020_io_register_w ) /* input interrupt? (should really be state-based, but the functions don't exist!) */ if (!(oldreg & 0x0008) && (newreg & 0x0008)) - timer_call_after_resynch(cpunum | (TMS34010_HI << 8), internal_interrupt_callback); + timer_call_after_resynch(NULL, cpunum | (TMS34010_HI << 8), internal_interrupt_callback); else if ((oldreg & 0x0008) && !(newreg & 0x0008)) IOREG(REG020_INTPEND) &= ~TMS34010_HI; break; diff --git a/src/emu/cpu/tms9900/99xxcore.h b/src/emu/cpu/tms9900/99xxcore.h index 49c80d734b4..360c92c7aff 100644 --- a/src/emu/cpu/tms9900/99xxcore.h +++ b/src/emu/cpu/tms9900/99xxcore.h @@ -1284,7 +1284,7 @@ static void tms99xx_init(int index, int clock, const void *config, int (*irqcall I.irq_callback = irqcallback; #if (TMS99XX_MODEL == TMS9995_ID) - I.timer = timer_alloc(decrementer_callback); + I.timer = timer_alloc(decrementer_callback, NULL); #endif I.idle_callback = param ? param->idle_callback : NULL; @@ -1864,7 +1864,7 @@ static void tms99xx_set_irq_line(int irqline, int state) { /* decrement, then interrupt if reach 0 */ if ((-- I.decrementer_count) == 0) { - decrementer_callback(Machine, 0); + decrementer_callback(Machine, NULL, 0); I.decrementer_count = I.decrementer_interval; /* reload */ } } diff --git a/src/emu/cpu/v810/v810.c b/src/emu/cpu/v810/v810.c index 4eabb624492..26d7b7ee708 100644 --- a/src/emu/cpu/v810/v810.c +++ b/src/emu/cpu/v810/v810.c @@ -34,7 +34,7 @@ typedef struct static v810info v810; -int v810_ICount; +static int v810_ICount; #define R0 v810.reg[0] #define R1 v810.reg[1] diff --git a/src/emu/cpu/v810/v810.h b/src/emu/cpu/v810/v810.h index 2b522609f88..4832537a009 100644 --- a/src/emu/cpu/v810/v810.h +++ b/src/emu/cpu/v810/v810.h @@ -3,8 +3,6 @@ #include "cpuintrf.h" -extern int v810_ICount; - void v810_get_info(UINT32, cpuinfo*); #define R_B(addr) (program_read_byte_32le(addr)) diff --git a/src/emu/cpu/z80gb/z80gb.c b/src/emu/cpu/z80gb/z80gb.c index 99ca7773bdd..61dca398cd4 100644 --- a/src/emu/cpu/z80gb/z80gb.c +++ b/src/emu/cpu/z80gb/z80gb.c @@ -129,7 +129,7 @@ INLINE void mem_WriteWord (UINT32 address, UINT16 value) } /* Nr of cycles to run */ -int z80gb_ICount; +static int z80gb_ICount; static int Cycles[256] = { diff --git a/src/emu/cpu/z80gb/z80gb.h b/src/emu/cpu/z80gb/z80gb.h index aca87845348..5721c4cf8aa 100644 --- a/src/emu/cpu/z80gb/z80gb.h +++ b/src/emu/cpu/z80gb/z80gb.h @@ -3,8 +3,6 @@ #include "cpuintrf.h" -extern int z80gb_ICount; - typedef struct { UINT16 *regs; UINT8 features; diff --git a/src/emu/cpuexec.c b/src/emu/cpuexec.c index 8c7556ef092..2159ddcf230 100644 --- a/src/emu/cpuexec.c +++ b/src/emu/cpuexec.c @@ -92,7 +92,7 @@ struct _cpuexec_data INT32 iloops; /* number of interrupts remaining this frame */ UINT64 totalcycles; /* total CPU cycles executed */ - attotime localtime; /* local time, relative to the timer system's global time */ + attotime localtime; /* local time, relative to the timer system's global time */ INT32 clock; /* current active clock */ double clockscale; /* current active clock scale factor */ @@ -202,8 +202,8 @@ void cpuexec_init(running_machine *machine) machine->screen[0].vblank = (machine->screen[0].refresh / machine->screen[0].height) * (machine->screen[0].height - (machine->screen[0].visarea.max_y + 1 - machine->screen[0].visarea.min_y)); /* allocate vblank and refresh timers, and compute the initial timing */ - vblank_timer = timer_alloc(cpu_vblankcallback); - refresh_timer = timer_alloc(NULL); + vblank_timer = timer_alloc(cpu_vblankcallback, NULL); + refresh_timer = timer_alloc(NULL, NULL); cpu_compute_vblank_timing(); /* loop over all our CPUs */ @@ -372,7 +372,7 @@ static void watchdog_setup(int alloc_new) { /* Start a time based watchdog. */ if (alloc_new) - watchdog_timer = timer_alloc(watchdog_callback); + watchdog_timer = timer_alloc(watchdog_callback, NULL); timer_adjust(watchdog_timer, Machine->drv->watchdog_time, 0, attotime_zero); watchdog_counter = WATCHDOG_IS_TIMER_BASED; } @@ -998,7 +998,7 @@ static TIMER_CALLBACK( cpu_triggertime_callback ) void cpu_triggertime(attotime duration, int trigger) { - timer_set(duration, trigger, cpu_triggertime_callback); + timer_set(duration, NULL, trigger, cpu_triggertime_callback); } @@ -1046,19 +1046,6 @@ void cpunum_spinuntil_trigger( int cpunum, int trigger ) cpu[cpunum].trigger = trigger; } -void cpu_yielduntil_trigger(int trigger) -{ - int cpunum = cpu_getexecutingcpu(); - - VERIFY_EXECUTINGCPU(cpu_yielduntil_trigger); - - /* suspend the CPU immediately if it's not already */ - cpunum_suspend(cpunum, SUSPEND_REASON_TRIGGER, 0); - - /* set the trigger */ - cpu[cpunum].trigger = trigger; -} - /************************************* @@ -1075,13 +1062,6 @@ void cpu_spinuntil_int(void) } -void cpu_yielduntil_int(void) -{ - VERIFY_EXECUTINGCPU(cpu_yielduntil_int); - cpu_yielduntil_trigger(TRIGGER_INT + activecpu); -} - - /************************************* * @@ -1098,7 +1078,15 @@ void cpu_spin(void) void cpu_yield(void) { - cpu_yielduntil_trigger(TRIGGER_TIMESLICE); + int cpunum = cpu_getexecutingcpu(); + + VERIFY_EXECUTINGCPU(cpu_yielduntil_trigger); + + /* suspend the CPU immediately if it's not already */ + cpunum_suspend(cpunum, SUSPEND_REASON_TRIGGER, 0); + + /* set the trigger */ + cpu[cpunum].trigger = TRIGGER_TIMESLICE; } @@ -1120,16 +1108,6 @@ void cpu_spinuntil_time(attotime duration) } -void cpu_yielduntil_time(attotime duration) -{ - static int timetrig = 0; - - cpu_yielduntil_trigger(TRIGGER_YIELDTIME + timetrig); - cpu_triggertime(duration, TRIGGER_YIELDTIME + timetrig); - timetrig = (timetrig + 1) & 255; -} - - #if 0 #pragma mark - @@ -1213,7 +1191,7 @@ static TIMER_CALLBACK( cpu_firstvblankcallback ) timer_adjust(vblank_timer, vblank_period, param, vblank_period); /* but we need to call the standard routine as well */ - cpu_vblankcallback(machine, param); + cpu_vblankcallback(machine, NULL, param); } @@ -1271,7 +1249,7 @@ static TIMER_CALLBACK( cpu_vblankcallback ) { /* do we update the screen now? */ if (!(machine->drv->video_attributes & VIDEO_UPDATE_AFTER_VBLANK)) - video_frame_update(); + video_frame_update(FALSE); /* Set the timer to update the screen */ timer_adjust(update_timer, attotime_make(0, machine->screen[0].vblank), 0, attotime_zero); @@ -1301,7 +1279,7 @@ static TIMER_CALLBACK( cpu_updatecallback ) { /* update the screen if we didn't before */ if (machine->drv->video_attributes & VIDEO_UPDATE_AFTER_VBLANK) - video_frame_update(); + video_frame_update(FALSE); vblank = 0; /* update IPT_VBLANK input ports */ @@ -1416,12 +1394,12 @@ static void cpu_inittimers(running_machine *machine) if (ipf <= 0) ipf = 1; timeslice_period = attotime_make(0, machine->screen[0].refresh / ipf); - timeslice_timer = timer_alloc(cpu_timeslicecallback); + timeslice_timer = timer_alloc(cpu_timeslicecallback, NULL); timer_adjust(timeslice_timer, timeslice_period, 0, timeslice_period); /* allocate timers to handle interleave boosts */ - interleave_boost_timer = timer_alloc(NULL); - interleave_boost_timer_end = timer_alloc(end_interleave_boost); + interleave_boost_timer = timer_alloc(NULL, NULL); + interleave_boost_timer_end = timer_alloc(end_interleave_boost, NULL); /* * The following code finds all the CPUs that are interrupting in sync with the VBLANK @@ -1468,7 +1446,7 @@ static void cpu_inittimers(running_machine *machine) vblank_countdown = vblank_multiplier; /* allocate an update timer that will be used to time the actual screen updates */ - update_timer = timer_alloc(cpu_updatecallback); + update_timer = timer_alloc(cpu_updatecallback, NULL); /* * The following code creates individual timers for each CPU whose interrupts are not @@ -1483,13 +1461,13 @@ static void cpu_inittimers(running_machine *machine) /* compute the average number of cycles per interrupt */ if (ipf <= 0) ipf = 1; - cpu[cpunum].vblankint_timer = timer_alloc(NULL); + cpu[cpunum].vblankint_timer = timer_alloc(NULL, NULL); /* see if we need to allocate a CPU timer */ if (machine->drv->cpu[cpunum].timed_interrupt_period != 0) { cpu[cpunum].timedint_period = attotime_make(0, machine->drv->cpu[cpunum].timed_interrupt_period); - cpu[cpunum].timedint_timer = timer_alloc(cpu_timedintcallback); + cpu[cpunum].timedint_timer = timer_alloc(cpu_timedintcallback, NULL); timer_adjust(cpu[cpunum].timedint_timer, cpu[cpunum].timedint_period, cpunum, cpu[cpunum].timedint_period); } } @@ -1500,10 +1478,10 @@ static void cpu_inittimers(running_machine *machine) first_time = attotime_sub_attoseconds(vblank_period, machine->screen[0].vblank); while (attotime_compare(first_time, attotime_zero) < 0) { - cpu_vblankcallback(machine, -1); + cpu_vblankcallback(machine, NULL, -1); first_time = attotime_add(first_time, vblank_period); } - timer_set(first_time, 0, cpu_firstvblankcallback); + timer_set(first_time, NULL, 0, cpu_firstvblankcallback); /* reset the refresh timer to get ourself back in sync */ timer_adjust(refresh_timer, attotime_never, 0, attotime_never); diff --git a/src/emu/cpuexec.h b/src/emu/cpuexec.h index ba966ae6046..cb7d9b2e20c 100644 --- a/src/emu/cpuexec.h +++ b/src/emu/cpuexec.h @@ -394,15 +394,9 @@ void cpu_spinuntil_trigger(int trigger); /* burn specified CPU cycles until a timer trigger */ void cpunum_spinuntil_trigger(int cpunum, int trigger); -/* yield our timeslice until a timer trigger */ -void cpu_yielduntil_trigger(int trigger); - /* burn CPU cycles until the next interrupt */ void cpu_spinuntil_int(void); -/* yield our timeslice until the next interrupt */ -void cpu_yielduntil_int(void); - /* burn CPU cycles until our timeslice is up */ void cpu_spin(void); @@ -412,9 +406,6 @@ void cpu_yield(void); /* burn CPU cycles for a specific period of time */ void cpu_spinuntil_time(attotime duration); -/* yield our timeslice for a specific period of time */ -void cpu_yielduntil_time(attotime duration); - /************************************* diff --git a/src/emu/cpuint.c b/src/emu/cpuint.c index 256801dafa0..2d9acfb0061 100644 --- a/src/emu/cpuint.c +++ b/src/emu/cpuint.c @@ -306,7 +306,7 @@ void cpunum_set_input_line_and_vector(int cpunum, int line, int state, int vecto if (event_index >= MAX_INPUT_EVENTS) { input_event_index[cpunum][line]--; - cpunum_empty_event_queue(Machine, cpunum | (line << 8)); + cpunum_empty_event_queue(Machine, NULL, cpunum | (line << 8)); event_index = input_event_index[cpunum][line]++; logerror("Exceeded pending input line event queue on CPU %d!\n", cpunum); } @@ -318,7 +318,7 @@ void cpunum_set_input_line_and_vector(int cpunum, int line, int state, int vecto /* if this is the first one, set the timer */ if (event_index == 0) - timer_call_after_resynch(cpunum | (line << 8), cpunum_empty_event_queue); + timer_call_after_resynch(NULL, cpunum | (line << 8), cpunum_empty_event_queue); } } } diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index 803443c175d..81099acd348 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -530,7 +530,7 @@ void debug_halt_on_next_instruction(void) void debug_refresh_display(void) { - video_frame_update(); + video_frame_update(TRUE); } diff --git a/src/emu/driver.h b/src/emu/driver.h index 797a6ca5895..7db71669c22 100644 --- a/src/emu/driver.h +++ b/src/emu/driver.h @@ -39,7 +39,6 @@ #define VIDEO_UPDATE(name) UINT32 video_update_##name(running_machine *machine, int screen, mame_bitmap *bitmap, const rectangle *cliprect) /* NULL versions */ -#define driver_init_NULL NULL #define nvram_handler_NULL NULL #define memcard_handler_NULL NULL #define machine_start_NULL NULL @@ -162,7 +161,7 @@ #ifdef MESS #define GAME_COMPUTER 0x8000 /* Driver is a computer (needs full keyboard) */ -#define GAME_COMPUTER_MODIFIED 0x0800 /* Official? Hack */ +#define GAME_COMPUTER_MODIFIED 0x4000 /* Official? Hack */ #endif @@ -508,24 +507,10 @@ struct _game_driver ***************************************************************************/ #define GAME(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS) \ -game_driver driver_##NAME = \ -{ \ - __FILE__, \ - #PARENT, \ - #NAME, \ - FULLNAME, \ - #YEAR, \ - COMPANY, \ - construct_##MACHINE, \ - ipt_##INPUT, \ - driver_init_##INIT, \ - rom_##NAME, \ - (MONITOR)|(FLAGS), \ - NULL \ -}; + GAMEL(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS,((const char *)0)) #define GAMEL(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS,LAYOUT) \ -game_driver driver_##NAME = \ +const game_driver driver_##NAME = \ { \ __FILE__, \ #PARENT, \ @@ -552,7 +537,7 @@ game_driver driver_##NAME = \ extern const game_driver * const drivers[]; -extern game_driver driver_empty; +extern const game_driver driver_empty; /*************************************************************************** diff --git a/src/emu/eigccppc.h b/src/emu/eigccppc.h index 13b4deffe62..9e2e0273b56 100644 --- a/src/emu/eigccppc.h +++ b/src/emu/eigccppc.h @@ -23,7 +23,7 @@ multiply and return the full 64 bit result -------------------------------------------------*/ -/* TBD */ +/* GCC can do a good job of this. */ /*------------------------------------------------- @@ -32,7 +32,7 @@ result -------------------------------------------------*/ -/* TBD */ +/* GCC can do a good job of this */ /*------------------------------------------------- @@ -42,9 +42,10 @@ -------------------------------------------------*/ #define mul_32x32_hi _mul_32x32_hi -INLINE INT32 _mul_32x32_hi(INT32 val1, INT32 val2) +INLINE INT32 __attribute__((const, always_inline)) +_mul_32x32_hi(INT32 val1, INT32 val2) { - INT32 result; + register INT32 result; __asm__ ( " mulhw %[result], %[val1], %[val2] \n" @@ -64,9 +65,10 @@ INLINE INT32 _mul_32x32_hi(INT32 val1, INT32 val2) -------------------------------------------------*/ #define mulu_32x32_hi _mulu_32x32_hi -INLINE UINT32 _mulu_32x32_hi(UINT32 val1, UINT32 val2) +INLINE UINT32 __attribute__((const, always_inline)) +_mulu_32x32_hi(UINT32 val1, UINT32 val2) { - UINT32 result; + register UINT32 result; __asm__ ( " mulhwu %[result], %[val1], %[val2] \n" @@ -88,10 +90,12 @@ INLINE UINT32 _mulu_32x32_hi(UINT32 val1, UINT32 val2) #if !defined(__ppc64__) && !defined(__PPC64__) && !defined(_ARCH_PPC64) #define mul_32x32_shift _mul_32x32_shift -INLINE INT32 _mul_32x32_shift(INT32 val1, INT32 val2, UINT8 shift) +INLINE INT32 __attribute__((const, always_inline)) +_mul_32x32_shift(INT32 val1, INT32 val2, UINT8 shift) { - INT32 result; + register INT32 result; + /* Valid for (0 <= shift <= 32) */ __asm__ ( " mullw %[result], %[val1], %[val2] \n" " mulhw %[val1], %[val1], %[val2] \n" @@ -120,10 +124,12 @@ INLINE INT32 _mul_32x32_shift(INT32 val1, INT32 val2, UINT8 shift) #if !defined(__ppc64__) && !defined(__PPC64__) && !defined(_ARCH_PPC64) #define mulu_32x32_shift _mulu_32x32_shift -INLINE UINT32 _mulu_32x32_shift(UINT32 val1, UINT32 val2, UINT8 shift) +INLINE UINT32 __attribute__((const, always_inline)) +_mulu_32x32_shift(UINT32 val1, UINT32 val2, UINT8 shift) { - UINT32 result; + register UINT32 result; + /* Valid for (0 <= shift <= 32) */ __asm__ ( " mullw %[result], %[val1], %[val2] \n" " mulhwu %[val1], %[val1], %[val2] \n" @@ -160,6 +166,24 @@ INLINE UINT32 _mulu_32x32_shift(UINT32 val1, UINT32 val2, UINT8 shift) /*------------------------------------------------- + div_64x32_rem - perform a signed 64 bit x 32 + bit divide and return the 32 bit quotient and + 32 bit remainder +-------------------------------------------------*/ + +/* TBD */ + + +/*------------------------------------------------- + divu_64x32_rem - perform an unsigned 64 bit x + 32 bit divide and return the 32 bit quotient + and 32 bit remainder +-------------------------------------------------*/ + +/* TBD */ + + +/*------------------------------------------------- div_32x32_shift - perform a signed divide of two 32 bit values, shifting the first before division, and returning the 32 bit quotient @@ -199,9 +223,10 @@ INLINE UINT32 _mulu_32x32_shift(UINT32 val1, UINT32 val2, UINT8 shift) -------------------------------------------------*/ #define recip_approx _recip_approx -INLINE float _recip_approx(float value) +INLINE float __attribute__((const, always_inline)) +_recip_approx(float value) { - float result; + register float result; __asm__ ( " fres %[result], %[value] \n" @@ -224,9 +249,10 @@ INLINE float _recip_approx(float value) -------------------------------------------------*/ #define count_leading_zeros _count_leading_zeros -INLINE UINT8 _count_leading_zeros(UINT32 value) +INLINE UINT8 __attribute__((const, always_inline)) +_count_leading_zeros(UINT32 value) { - UINT32 result; + register UINT32 result; __asm__ ( " cntlzw %[result], %[value] \n" @@ -244,9 +270,10 @@ INLINE UINT8 _count_leading_zeros(UINT32 value) -------------------------------------------------*/ #define count_leading_ones _count_leading_ones -INLINE UINT8 _count_leading_ones(UINT32 value) +INLINE UINT8 __attribute__((const, always_inline)) +_count_leading_ones(UINT32 value) { - UINT32 result; + register UINT32 result; __asm__ ( " not %[result], %[value] \n" @@ -272,7 +299,8 @@ INLINE UINT8 _count_leading_ones(UINT32 value) -------------------------------------------------*/ #define compare_exchange32 _compare_exchange32 -INLINE INT32 _compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange) +INLINE INT32 __attribute__((nonnull(1), always_inline)) +_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange) { register INT32 result; @@ -284,11 +312,12 @@ INLINE INT32 _compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 excha " stwcx. %[exchange], 0, %[ptr] \n" " bne- 1b \n" "2: " - : [result] "=&r" (result) - : [ptr] "r" (ptr) - , [exchange] "r" (exchange) - , [compare] "r" (compare) - : "cr0" + : [dummy] "+m" (*ptr) /* Lets GCC know that *ptr will be read/written in case it's not marked volatile */ + , [result] "=&r" (result) + : [ptr] "r" (ptr) + , [exchange] "r" (exchange) + , [compare] "r" (compare) + : "cr0" ); return result; @@ -304,7 +333,8 @@ INLINE INT32 _compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 excha #if defined(__ppc64__) || defined(__PPC64__) #define compare_exchange64 _compare_exchange64 -INLINE INT64 _compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange) +INLINE INT64 __attribute__((nonnull(1), always_inline)) +_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange) { register INT64 result; @@ -315,11 +345,12 @@ INLINE INT64 _compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 excha " stdcx. %[exchange], 0, %[ptr] \n" " bne-- 1b \n" "2: " - : [result] "=&r" (result) - : [ptr] "r" (ptr) - , [exchange] "r" (exchange) - , [compare] "r" (compare) - : "cr0" + : [dummy] "+m" (*ptr) /* Lets GCC know that *ptr will be read/written in case it's not marked volatile */ + , [result] "=&r" (result) + : [ptr] "r" (ptr) + , [exchange] "r" (exchange) + , [compare] "r" (compare) + : "cr0" ); return result; @@ -334,7 +365,8 @@ INLINE INT64 _compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 excha -------------------------------------------------*/ #define atomic_exchange32 _atomic_exchange32 -INLINE INT32 _atomic_exchange32(INT32 volatile *ptr, INT32 exchange) +INLINE INT32 __attribute__((nonnull(1), always_inline)) +_atomic_exchange32(INT32 volatile *ptr, INT32 exchange) { register INT32 result; @@ -343,10 +375,11 @@ INLINE INT32 _atomic_exchange32(INT32 volatile *ptr, INT32 exchange) " sync \n" " stwcx. %[exchange], 0, %[ptr] \n" " bne- 1b \n" - : [result] "=&r" (result) - : [ptr] "r" (ptr) - , [exchange] "r" (exchange) - : "cr0" + : [dummy] "+m" (*ptr) /* Lets GCC know that *ptr will be read/written in case it's not marked volatile */ + , [result] "=&r" (result) + : [ptr] "r" (ptr) + , [exchange] "r" (exchange) + : "cr0" ); return result; @@ -360,7 +393,8 @@ INLINE INT32 _atomic_exchange32(INT32 volatile *ptr, INT32 exchange) -------------------------------------------------*/ #define atomic_add32 _atomic_add32 -INLINE INT32 _atomic_add32(INT32 volatile *ptr, INT32 delta) +INLINE INT32 __attribute__((nonnull(1), always_inline)) +_atomic_add32(INT32 volatile *ptr, INT32 delta) { register INT32 result; @@ -370,10 +404,11 @@ INLINE INT32 _atomic_add32(INT32 volatile *ptr, INT32 delta) " sync \n" " stwcx. %[result], 0, %[ptr] \n" " bne- 1b \n" - : [result] "=&b" (result) - : [ptr] "r" (ptr) - , [delta] "r" (delta) - : "cr0" + : [dummy] "+m" (*ptr) /* Lets GCC know that *ptr will be read/written in case it's not marked volatile */ + , [result] "=&b" (result) + : [ptr] "r" (ptr) + , [delta] "r" (delta) + : "cr0" ); return result; @@ -387,7 +422,8 @@ INLINE INT32 _atomic_add32(INT32 volatile *ptr, INT32 delta) -------------------------------------------------*/ #define atomic_increment32 _atomic_increment32 -INLINE INT32 _atomic_increment32(INT32 volatile *ptr) +INLINE INT32 __attribute__((nonnull(1), always_inline)) +_atomic_increment32(INT32 volatile *ptr) { register INT32 result; @@ -397,7 +433,8 @@ INLINE INT32 _atomic_increment32(INT32 volatile *ptr) " sync \n" " stwcx. %[result], 0, %[ptr] \n" " bne- 1b \n" - : [result] "=&b" (result) + : [dummy] "+m" (*ptr) /* Lets GCC know that *ptr will be read/written in case it's not marked volatile */ + , [result] "=&b" (result) : [ptr] "r" (ptr) : "cr0" ); @@ -413,7 +450,8 @@ INLINE INT32 _atomic_increment32(INT32 volatile *ptr) -------------------------------------------------*/ #define atomic_decrement32 _atomic_decrement32 -INLINE INT32 _atomic_decrement32(INT32 volatile *ptr) +INLINE INT32 __attribute__((nonnull(1), always_inline)) +_atomic_decrement32(INT32 volatile *ptr) { register INT32 result; @@ -423,7 +461,8 @@ INLINE INT32 _atomic_decrement32(INT32 volatile *ptr) " sync \n" " stwcx. %[result], 0, %[ptr] \n" " bne- 1b \n" - : [result] "=&b" (result) + : [dummy] "+m" (*ptr) /* Lets GCC know that *ptr will be read/written in case it's not marked volatile */ + , [result] "=&b" (result) : [ptr] "r" (ptr) : "cr0" ); diff --git a/src/emu/eigccx86.h b/src/emu/eigccx86.h index 75d6ed0074d..26c5c7ca2ef 100644 --- a/src/emu/eigccx86.h +++ b/src/emu/eigccx86.h @@ -33,9 +33,10 @@ #ifndef __x86_64__ #define mul_32x32 _mul_32x32 -INLINE INT64 _mul_32x32(INT32 a, INT32 b) +INLINE INT64 __attribute__((const, always_inline)) +_mul_32x32(INT32 a, INT32 b) { - INT64 result; + register INT64 result; __asm__ ( " imull %[b] ;" @@ -58,9 +59,10 @@ INLINE INT64 _mul_32x32(INT32 a, INT32 b) #ifndef __x86_64__ #define mulu_32x32 _mulu_32x32 -INLINE UINT64 _mulu_32x32(UINT32 a, UINT32 b) +INLINE UINT64 __attribute__((const, always_inline)) +_mulu_32x32(UINT32 a, UINT32 b) { - UINT64 result; + register UINT64 result; __asm__ ( " mull %[b] ;" @@ -82,9 +84,10 @@ INLINE UINT64 _mulu_32x32(UINT32 a, UINT32 b) -------------------------------------------------*/ #define mul_32x32_hi _mul_32x32_hi -INLINE INT32 _mul_32x32_hi(INT32 a, INT32 b) +INLINE INT32 __attribute__((const, always_inline)) +_mul_32x32_hi(INT32 a, INT32 b) { - INT32 result; + register INT32 result; __asm__ ( " imull %[b] ;" @@ -105,9 +108,10 @@ INLINE INT32 _mul_32x32_hi(INT32 a, INT32 b) -------------------------------------------------*/ #define mulu_32x32_hi _mulu_32x32_hi -INLINE UINT32 _mulu_32x32_hi(UINT32 a, UINT32 b) +INLINE UINT32 __attribute__((const, always_inline)) +_mulu_32x32_hi(UINT32 a, UINT32 b) { - UINT32 result; + register UINT32 result; __asm__ ( " mull %[b] ;" @@ -130,10 +134,12 @@ INLINE UINT32 _mulu_32x32_hi(UINT32 a, UINT32 b) #ifndef __x86_64__ #define mul_32x32_shift _mul_32x32_shift -INLINE INT32 _mul_32x32_shift(INT32 a, INT32 b, UINT8 shift) +INLINE INT32 __attribute__((const, always_inline)) +_mul_32x32_shift(INT32 a, INT32 b, UINT8 shift) { - INT32 result; + register INT32 result; + /* Valid for (0 <= shift <= 31) */ __asm__ ( " imull %[b] ;" " shrdl %[shift], %%edx, %[result] ;" @@ -158,10 +164,12 @@ INLINE INT32 _mul_32x32_shift(INT32 a, INT32 b, UINT8 shift) #ifndef __x86_64__ #define mulu_32x32_shift _mulu_32x32_shift -INLINE UINT32 _mulu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift) +INLINE UINT32 __attribute__((const, always_inline)) +_mulu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift) { - UINT32 result; + register UINT32 result; + /* Valid for (0 <= shift <= 31) */ __asm__ ( " mull %[b] ;" " shrdl %[shift], %%edx, %[result] ;" @@ -184,10 +192,12 @@ INLINE UINT32 _mulu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift) #ifndef __x86_64__ #define div_64x32 _div_64x32 -INLINE INT32 _div_64x32(INT64 a, INT32 b) +INLINE INT32 __attribute__((const, always_inline)) +_div_64x32(INT64 a, INT32 b) { - INT32 result, temp; + register INT32 result, temp; + /* Throws arithmetic exception if result doesn't fit in 32 bits */ __asm__ ( " idivl %[b] ;" : [result] "=a" (result) /* Result ends up in eax */ @@ -209,10 +219,12 @@ INLINE INT32 _div_64x32(INT64 a, INT32 b) #ifndef __x86_64__ #define divu_64x32 _divu_64x32 -INLINE UINT32 _divu_64x32(UINT64 a, UINT32 b) +INLINE UINT32 __attribute__((const, always_inline)) +_divu_64x32(UINT64 a, UINT32 b) { - UINT32 result, temp; + register UINT32 result, temp; + /* Throws arithmetic exception if result doesn't fit in 32 bits */ __asm__ ( " divl %[b] ;" : [result] "=a" (result) /* Result ends up in eax */ @@ -235,10 +247,12 @@ INLINE UINT32 _divu_64x32(UINT64 a, UINT32 b) #ifndef __x86_64__ #define div_64x32_rem _div_64x32_rem -INLINE INT32 _div_64x32_rem(INT64 dividend, INT32 divisor, INT32 *remainder) +INLINE INT32 __attribute__((always_inline)) +_div_64x32_rem(INT64 dividend, INT32 divisor, INT32 *remainder) { - INT32 quotient; + register INT32 quotient; + /* Throws arithmetic exception if result doesn't fit in 32 bits */ __asm__ ( " idivl %[divisor] ;" : [result] "=a" (quotient) /* Quotient ends up in eax */ @@ -261,10 +275,12 @@ INLINE INT32 _div_64x32_rem(INT64 dividend, INT32 divisor, INT32 *remainder) #ifndef __x86_64__ #define divu_64x32_rem _divu_64x32_rem -INLINE UINT32 _divu_64x32_rem(UINT64 dividend, UINT32 divisor, UINT32 *remainder) +INLINE UINT32 __attribute__((always_inline)) +_divu_64x32_rem(UINT64 dividend, UINT32 divisor, UINT32 *remainder) { - UINT32 quotient; + register UINT32 quotient; + /* Throws arithmetic exception if result doesn't fit in 32 bits */ __asm__ ( " divl %[divisor] ;" : [result] "=a" (quotient) /* Quotient ends up in eax */ @@ -287,10 +303,13 @@ INLINE UINT32 _divu_64x32_rem(UINT64 dividend, UINT32 divisor, UINT32 *remainder #ifndef __x86_64__ #define div_32x32_shift _div_32x32_shift -INLINE INT32 _div_32x32_shift(INT32 a, INT32 b, UINT8 shift) +INLINE INT32 __attribute__((const, always_inline)) +_div_32x32_shift(INT32 a, INT32 b, UINT8 shift) { - INT32 result; + register INT32 result; + /* Valid for (0 <= shift <= 31) */ + /* Throws arithmetic exception if result doesn't fit in 32 bits */ __asm__ ( " cdq ;" " shldl %[shift], %[a], %%edx ;" @@ -316,10 +335,13 @@ INLINE INT32 _div_32x32_shift(INT32 a, INT32 b, UINT8 shift) #ifndef __x86_64__ #define divu_32x32_shift _divu_32x32_shift -INLINE UINT32 _divu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift) +INLINE UINT32 __attribute__((const, always_inline)) +_divu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift) { - INT32 result; + register INT32 result; + /* Valid for (0 <= shift <= 31) */ + /* Throws arithmetic exception if result doesn't fit in 32 bits */ __asm__ ( " clr %%edx ;" " shldl %[shift], %[a], %%edx ;" @@ -344,10 +366,12 @@ INLINE UINT32 _divu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift) #ifndef __x86_64__ #define mod_64x32 _mod_64x32 -INLINE INT32 _mod_64x32(INT64 a, INT32 b) +INLINE INT32 __attribute__((const, always_inline)) +_mod_64x32(INT64 a, INT32 b) { - INT32 result, temp; + register INT32 result, temp; + /* Throws arithmetic exception if quotient doesn't fit in 32 bits */ __asm__ ( " idivl %[b] ;" : [result] "=d" (result) /* Result ends up in edx */ @@ -369,10 +393,12 @@ INLINE INT32 _mod_64x32(INT64 a, INT32 b) #ifndef __x86_64__ #define modu_64x32 _modu_64x32 -INLINE UINT32 _modu_64x32(UINT64 a, UINT32 b) +INLINE UINT32 __attribute__((const, always_inline)) +_modu_64x32(UINT64 a, UINT32 b) { - UINT32 result, temp; + register UINT32 result, temp; + /* Throws arithmetic exception if quotient doesn't fit in 32 bits */ __asm__ ( " divl %[b] ;" : [result] "=d" (result) /* Result ends up in edx */ @@ -394,7 +420,8 @@ INLINE UINT32 _modu_64x32(UINT64 a, UINT32 b) #ifdef __SSE2__ #define recip_approx _recip_approx -INLINE float _recip_approx(float value) +INLINE float __attribute__((const)) +_recip_approx(float value) { __m128 value_xmm = _mm_set_ss(value); __m128 result_xmm = _mm_rcp_ss(value_xmm); @@ -416,9 +443,10 @@ INLINE float _recip_approx(float value) -------------------------------------------------*/ #define count_leading_zeros _count_leading_zeros -INLINE UINT8 _count_leading_zeros(UINT32 value) +INLINE UINT8 __attribute__((const, always_inline)) +_count_leading_zeros(UINT32 value) { - UINT32 result; + register UINT32 result; __asm__ ( " bsrl %[value], %[result] ;" @@ -440,9 +468,10 @@ INLINE UINT8 _count_leading_zeros(UINT32 value) -------------------------------------------------*/ #define count_leading_ones _count_leading_ones -INLINE UINT8 _count_leading_ones(UINT32 value) +INLINE UINT8 __attribute__((const, always_inline)) +_count_leading_ones(UINT32 value) { - UINT32 result; + register UINT32 result; __asm__ ( " movl %[value], %[result] ;" @@ -473,12 +502,13 @@ INLINE UINT8 _count_leading_ones(UINT32 value) -------------------------------------------------*/ #define compare_exchange32 _compare_exchange32 -INLINE INT32 _compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange) +INLINE INT32 __attribute__((nonnull(1), always_inline)) +_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange) { register INT32 result; __asm__ __volatile__ ( - " lock ; cmpxchg %[exchange], %[ptr] ;" + " lock ; cmpxchgl %[exchange], %[ptr] ;" : [ptr] "+m" (*ptr) , [result] "=a" (result) : [compare] "1" (compare) @@ -499,12 +529,13 @@ INLINE INT32 _compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 excha #ifdef __x86_64__ #define compare_exchange64 _compare_exchange64 -INLINE INT64 _compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange) +INLINE INT64 __attribute__((nonnull(1), always_inline)) +_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange) { register INT64 result; __asm__ __volatile__ ( - " lock ; cmpxchg %[exchange], %[ptr] ;" + " lock ; cmpxchgq %[exchange], %[ptr] ;" : [ptr] "+m" (*ptr) , [result] "=a" (result) : [compare] "1" (compare) @@ -524,12 +555,13 @@ INLINE INT64 _compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 excha -------------------------------------------------*/ #define atomic_exchange32 _atomic_exchange32 -INLINE INT32 _atomic_exchange32(INT32 volatile *ptr, INT32 exchange) +INLINE INT32 __attribute__((nonnull(1), always_inline)) +_atomic_exchange32(INT32 volatile *ptr, INT32 exchange) { register INT32 result; __asm__ __volatile__ ( - " lock ; xchg %[exchange], %[ptr] ;" + " lock ; xchgl %[exchange], %[ptr] ;" : [ptr] "+m" (*ptr) , [result] "=r" (result) : [exchange] "1" (exchange) @@ -546,12 +578,13 @@ INLINE INT32 _atomic_exchange32(INT32 volatile *ptr, INT32 exchange) -------------------------------------------------*/ #define atomic_add32 _atomic_add32 -INLINE INT32 _atomic_add32(INT32 volatile *ptr, INT32 delta) +INLINE INT32 __attribute__((nonnull(1), always_inline)) +_atomic_add32(INT32 volatile *ptr, INT32 delta) { register INT32 result = delta; __asm__ __volatile__ ( - " lock ; xadd %[result], %[ptr] ;" + " lock ; xaddl %[result], %[ptr] ;" : [ptr] "+m" (*ptr) , [result] "+r" (result) : @@ -569,12 +602,13 @@ INLINE INT32 _atomic_add32(INT32 volatile *ptr, INT32 delta) -------------------------------------------------*/ #define atomic_increment32 _atomic_increment32 -INLINE INT32 _atomic_increment32(INT32 volatile *ptr) +INLINE INT32 __attribute__((nonnull(1), always_inline)) +_atomic_increment32(INT32 volatile *ptr) { register INT32 result = 1; __asm__ __volatile__ ( - " lock ; xadd %[result], %[ptr] ;" + " lock ; xaddl %[result], %[ptr] ;" : [ptr] "+m" (*ptr) , [result] "+r" (result) : @@ -592,12 +626,13 @@ INLINE INT32 _atomic_increment32(INT32 volatile *ptr) -------------------------------------------------*/ #define atomic_decrement32 _atomic_decrement32 -INLINE INT32 _atomic_decrement32(INT32 volatile *ptr) +INLINE INT32 __attribute__((nonnull(1), always_inline)) +_atomic_decrement32(INT32 volatile *ptr) { register INT32 result = -1; __asm__ __volatile__ ( - " lock ; xadd %[result], %[ptr] ;" + " lock ; xaddl %[result], %[ptr] ;" : [ptr] "+m" (*ptr) , [result] "+r" (result) : diff --git a/src/emu/machine/6522via.c b/src/emu/machine/6522via.c index 21a067d8d3b..3e7964a62da 100644 --- a/src/emu/machine/6522via.c +++ b/src/emu/machine/6522via.c @@ -251,7 +251,7 @@ static void via_shift(int which) v->shift_counter = (v->shift_counter + 1) % 8; if (v->shift_counter) - timer_set(v_cycles_to_time(v, 2), which, via_shift_callback); + timer_set(v_cycles_to_time(v, 2), NULL, which, via_shift_callback); else { if (!(v->ifr & INT_SR)) @@ -365,9 +365,9 @@ void via_reset(void) v.time2 = via[i].time2; v.clock = via[i].clock; - v.t1 = timer_alloc(via_t1_timeout); + v.t1 = timer_alloc(via_t1_timeout, NULL); v.t1_active = 0; - v.t2 = timer_alloc(via_t2_timeout); + v.t2 = timer_alloc(via_t2_timeout, NULL); v.t2_active = 0; via[i] = v; @@ -524,7 +524,7 @@ int via_read(int which, int offset) if (SO_O2_CONTROL(v->acr)) { v->shift_counter=0; - timer_set(v_cycles_to_time(v, 2), which,via_shift_callback); + timer_set(v_cycles_to_time(v, 2), NULL, which,via_shift_callback); } break; @@ -754,7 +754,7 @@ void via_write(int which, int offset, int data) via_clear_int(which, INT_SR); if (SO_O2_CONTROL(v->acr)) { - timer_set(v_cycles_to_time(v, 2), which,via_shift_callback); + timer_set(v_cycles_to_time(v, 2), NULL, which, via_shift_callback); } break; diff --git a/src/emu/machine/6526cia.c b/src/emu/machine/6526cia.c index 0b3e1af3af2..23729e413a8 100644 --- a/src/emu/machine/6526cia.c +++ b/src/emu/machine/6526cia.c @@ -117,7 +117,7 @@ static cia_state cia_array[2]; * *************************************/ -static TIMER_CALLBACK_PTR( cia_timer_proc ); +static TIMER_CALLBACK( cia_timer_proc ); static void cia_timer_underflow(cia_state *cia, int timer); static TIMER_CALLBACK( cia_clock_tod_callback ); @@ -171,14 +171,14 @@ void cia_config(int which, const cia6526_interface *intf) for (t = 0; t < (sizeof(cia->timer) / sizeof(cia->timer[0])); t++) { cia_timer *timer = &cia->timer[t]; - timer->timer = timer_alloc_ptr(cia_timer_proc, timer); + timer->timer = timer_alloc(cia_timer_proc, timer); timer->cia = cia; timer->irq = 0x01 << t; } /* setup TOD timer, if appropriate */ if (intf->tod_clock) - timer_pulse(ATTOTIME_IN_HZ(intf->tod_clock), which, cia_clock_tod_callback); + timer_pulse(ATTOTIME_IN_HZ(intf->tod_clock), NULL, which, cia_clock_tod_callback); /* special case; for the first CIA, set up an exit handler to clear things out */ if (which == 0) @@ -323,12 +323,12 @@ static void cia_timer_update(cia_timer *timer, INT32 new_count) { /* timer is on and is connected to clock */ attotime period = attotime_mul(ATTOTIME_IN_HZ(timer->cia->clock), (timer->count ? timer->count : 0x10000)); - timer_adjust_ptr(timer->timer, period, attotime_zero); + timer_adjust(timer->timer, period, 0, attotime_zero); } else { /* timer is off or not connected to clock */ - timer_adjust_ptr(timer->timer, attotime_never, attotime_zero); + timer_adjust(timer->timer, attotime_never, 0, attotime_zero); } } @@ -401,9 +401,9 @@ static void cia_timer_underflow(cia_state *cia, int timer) } -static TIMER_CALLBACK_PTR( cia_timer_proc ) +static TIMER_CALLBACK( cia_timer_proc ) { - cia_timer *timer = param; + cia_timer *timer = ptr; cia_state *cia = timer->cia; cia_timer_underflow(cia, timer - cia->timer); diff --git a/src/emu/machine/6532riot.c b/src/emu/machine/6532riot.c index 42abec15464..855d1f1ec97 100644 --- a/src/emu/machine/6532riot.c +++ b/src/emu/machine/6532riot.c @@ -286,7 +286,7 @@ void r6532_reset(int which) r6532[which].shift = 10; - r6532[which].counter_timer = timer_alloc(r6532_irq_timer_callback); + r6532[which].counter_timer = timer_alloc(r6532_irq_timer_callback, NULL); r6532_set_timer( which, 0xFF ); diff --git a/src/emu/machine/6840ptm.c b/src/emu/machine/6840ptm.c index 8fff877fdcf..4a0492afb68 100644 --- a/src/emu/machine/6840ptm.c +++ b/src/emu/machine/6840ptm.c @@ -355,9 +355,9 @@ void ptm6840_config(int which, const ptm6840_interface *intf) } } - ptm[which].timer[0] = timer_alloc(ptm6840_t1_timeout); - ptm[which].timer[1] = timer_alloc(ptm6840_t2_timeout); - ptm[which].timer[2] = timer_alloc(ptm6840_t3_timeout); + ptm[which].timer[0] = timer_alloc(ptm6840_t1_timeout, NULL); + ptm[which].timer[1] = timer_alloc(ptm6840_t2_timeout, NULL); + ptm[which].timer[2] = timer_alloc(ptm6840_t3_timeout, NULL); for (i = 0; i < 3; i++) timer_enable(ptm[which].timer[i], FALSE); diff --git a/src/emu/machine/6850acia.c b/src/emu/machine/6850acia.c index 17686e96020..3f3e9b51ea3 100644 --- a/src/emu/machine/6850acia.c +++ b/src/emu/machine/6850acia.c @@ -168,8 +168,8 @@ void acia6850_config(int which, const struct acia6850_interface *intf) acia_p->cts_pin = intf->cts_pin; acia_p->rts_pin = intf->rts_pin; acia_p->dcd_pin = intf->dcd_pin; - acia_p->rx_timer = timer_alloc(receive_event); - acia_p->tx_timer = timer_alloc(transmit_event); + acia_p->rx_timer = timer_alloc(receive_event, NULL); + acia_p->tx_timer = timer_alloc(transmit_event, NULL); acia_p->int_callback = intf->int_callback; acia_p->first_reset = 1; acia_p->status_read = 0; diff --git a/src/emu/machine/74123.c b/src/emu/machine/74123.c index c6199233665..bc7f1f2cc2d 100644 --- a/src/emu/machine/74123.c +++ b/src/emu/machine/74123.c @@ -75,9 +75,9 @@ static void set_output(TTL74123_state *chip) } -static TIMER_CALLBACK_PTR( clear_callback ) +static TIMER_CALLBACK( clear_callback ) { - TTL74123_state *chip = param; + TTL74123_state *chip = ptr; set_output(chip); } @@ -96,7 +96,7 @@ void TTL74123_config(int which, const TTL74123_interface *intf) chip->intf = intf; chip->which = which; - chip->timer = timer_alloc_ptr(clear_callback, chip); + chip->timer = timer_alloc(clear_callback, chip); /* start with the defaults */ chip->A = intf->A; @@ -129,7 +129,7 @@ static void start_pulse(TTL74123_state *chip) if (attotime_compare(timer_timeelapsed(chip->timer), delay_time) >= 0) { - timer_adjust_ptr(chip->timer, duration, attotime_never); + timer_adjust(chip->timer, duration, 0, attotime_never); if (LOG) logerror("74123 #%d: Retriggering pulse. Duration: %f\n", chip->which, attotime_to_double(duration)); } @@ -141,7 +141,7 @@ static void start_pulse(TTL74123_state *chip) else { /* starting */ - timer_adjust_ptr(chip->timer, duration, attotime_never); + timer_adjust(chip->timer, duration, 0, attotime_never); set_output(chip); @@ -181,7 +181,7 @@ void TTL74123_clear_w(int which, int data) /* clear the output if A=LO, B=HI and falling edge on clear */ if (!data && chip->clear && chip->B && !chip->A && !chip->clear) { - timer_adjust_ptr(chip->timer, attotime_zero, attotime_never); + timer_adjust(chip->timer, attotime_zero, 0, attotime_never); if (LOG) logerror("74123 #%d: Cleared\n", which); } diff --git a/src/emu/machine/8042kbdc.c b/src/emu/machine/8042kbdc.c index 392acbe7c9a..bb8b3555ab1 100644 --- a/src/emu/machine/8042kbdc.c +++ b/src/emu/machine/8042kbdc.c @@ -275,7 +275,7 @@ void kbdc8042_init(const struct kbdc8042_interface *intf) kbdc8042.inport = 0xa0; at_8042_set_outport(0xfe, 1); - timer_pulse(ATTOTIME_IN_HZ(60), 0, kbdc8042_time); + timer_pulse(ATTOTIME_IN_HZ(60), NULL, 0, kbdc8042_time); } static void at_8042_receive(UINT8 data) diff --git a/src/emu/machine/8237dma.c b/src/emu/machine/8237dma.c index 12303219ba9..43b092d3030 100644 --- a/src/emu/machine/8237dma.c +++ b/src/emu/machine/8237dma.c @@ -75,8 +75,8 @@ int dma8237_init(int count) for (which = 0; which < dma_count; which++) { dma[which].status = 0x0F; - dma[which].timer = timer_alloc(dma8237_timerproc); - dma[which].msbflip_timer = timer_alloc(dma8237_msbflip_timerproc); + dma[which].timer = timer_alloc(dma8237_timerproc, NULL); + dma[which].msbflip_timer = timer_alloc(dma8237_msbflip_timerproc, NULL); dma[which].eop = 1; } return 0; @@ -406,7 +406,7 @@ void dma8237_drq_write(int which, int channel, int state) int param; param = (which << 3) | (channel << 1) | (state ? 1 : 0); - //timer_call_after_resynch(param, dma8237_drq_write_callback); + //timer_call_after_resynch(NULL, param, dma8237_drq_write_callback); dma8237_drq_write_callback(param); } diff --git a/src/emu/machine/am53cf96.c b/src/emu/machine/am53cf96.c index a902508eb89..9e5467138f7 100644 --- a/src/emu/machine/am53cf96.c +++ b/src/emu/machine/am53cf96.c @@ -159,10 +159,10 @@ WRITE32_HANDLER( am53cf96_w ) case 3: // reset SCSI bus scsi_regs[REG_INTSTATE] = 4; // command sent OK xfer_state = 0; - timer_set( ATTOTIME_IN_HZ( 16384 ), 0, am53cf96_irq ); + timer_set( ATTOTIME_IN_HZ( 16384 ), NULL, 0, am53cf96_irq ); break; case 0x42: // select with ATN steps - timer_set( ATTOTIME_IN_HZ( 16384 ), 0, am53cf96_irq ); + timer_set( ATTOTIME_IN_HZ( 16384 ), NULL, 0, am53cf96_irq ); if ((fifo[1] == 0) || (fifo[1] == 0x48) || (fifo[1] == 0x4b)) { scsi_regs[REG_INTSTATE] = 6; @@ -192,7 +192,7 @@ WRITE32_HANDLER( am53cf96_w ) case 0x10: // information transfer (must not change xfer_state) case 0x11: // second phase of information transfer case 0x12: // message accepted - timer_set( ATTOTIME_IN_HZ( 16384 ), 0, am53cf96_irq ); + timer_set( ATTOTIME_IN_HZ( 16384 ), NULL, 0, am53cf96_irq ); scsi_regs[REG_INTSTATE] = 6; // command sent OK break; default: diff --git a/src/emu/machine/ds2401.c b/src/emu/machine/ds2401.c index baa987a7e19..cd3ebd52274 100644 --- a/src/emu/machine/ds2401.c +++ b/src/emu/machine/ds2401.c @@ -168,8 +168,8 @@ void ds2401_init( int which, UINT8 *data ) state_save_register_item( "ds2401", which, c->tx ); state_save_register_item_pointer( "ds2401", which, data, SIZE_DATA ); - c->timer = timer_alloc( ds2401_tick ); - c->reset_timer = timer_alloc( ds2401_reset ); + c->timer = timer_alloc( ds2401_tick , NULL); + c->reset_timer = timer_alloc( ds2401_reset , NULL); } void ds2401_write( int which, int data ) diff --git a/src/emu/machine/ds2404.c b/src/emu/machine/ds2404.c index fb4fc09696e..bc40ff9d88e 100644 --- a/src/emu/machine/ds2404.c +++ b/src/emu/machine/ds2404.c @@ -305,7 +305,7 @@ void DS2404_init(int ref_year, int ref_month, int ref_day) ds2404.rtc[ 3 ] = ( current_time >> 16 ) & 0xff; ds2404.rtc[ 4 ] = ( current_time >> 24 ) & 0xff; - timer = timer_alloc( DS2404_tick ); + timer = timer_alloc( DS2404_tick , NULL); timer_adjust( timer, ATTOTIME_IN_HZ( 256 ), 0, ATTOTIME_IN_HZ( 256 ) ); } diff --git a/src/emu/machine/generic.c b/src/emu/machine/generic.c index 45643b36b11..3b87a3a9229 100644 --- a/src/emu/machine/generic.c +++ b/src/emu/machine/generic.c @@ -578,7 +578,7 @@ void cpu_interrupt_enable(int cpunum, int enabled) /* make sure there are no queued interrupts */ if (enabled == 0) - timer_call_after_resynch(cpunum, clear_all_lines); + timer_call_after_resynch(NULL, cpunum, clear_all_lines); } diff --git a/src/emu/machine/idectrl.c b/src/emu/machine/idectrl.c index e965186b0ab..bd08522cdfc 100644 --- a/src/emu/machine/idectrl.c +++ b/src/emu/machine/idectrl.c @@ -186,13 +186,13 @@ static struct ide_state idestate[MAX_IDE_CONTROLLERS]; * *************************************/ -static TIMER_CALLBACK_PTR( reset_callback ); +static TIMER_CALLBACK( reset_callback ); static void ide_build_features(struct ide_state *ide); static void continue_read(struct ide_state *ide); static void read_sector_done(struct ide_state *ide); -static TIMER_CALLBACK_PTR( read_sector_done_callback ); +static TIMER_CALLBACK( read_sector_done_callback ); static void read_first_sector(struct ide_state *ide); static void read_next_sector(struct ide_state *ide); @@ -237,17 +237,17 @@ INLINE void clear_interrupt(struct ide_state *ide) * *************************************/ -static TIMER_CALLBACK_PTR( delayed_interrupt ) +static TIMER_CALLBACK( delayed_interrupt ) { - struct ide_state *ide = param; + struct ide_state *ide = ptr; ide->status &= ~IDE_STATUS_BUSY; signal_interrupt(ide); } -static TIMER_CALLBACK_PTR( delayed_interrupt_buffer_ready ) +static TIMER_CALLBACK( delayed_interrupt_buffer_ready ) { - struct ide_state *ide = param; + struct ide_state *ide = ptr; ide->status &= ~IDE_STATUS_BUSY; ide->status |= IDE_STATUS_BUFFER_READY; signal_interrupt(ide); @@ -262,9 +262,9 @@ INLINE void signal_delayed_interrupt(struct ide_state *ide, attotime time, int b /* set a timer */ if (buffer_ready) - timer_set_ptr(time, ide, delayed_interrupt_buffer_ready); + timer_set(time, ide, 0, delayed_interrupt_buffer_ready); else - timer_set_ptr(time, ide, delayed_interrupt); + timer_set(time, ide, 0, delayed_interrupt); } @@ -328,8 +328,8 @@ int ide_controller_init_custom(int which, struct ide_interface *intf, chd_file * ide_build_features(ide); /* create a timer for timing status */ - ide->last_status_timer = timer_alloc(NULL); - ide->reset_timer = timer_alloc_ptr(reset_callback, ide); + ide->last_status_timer = timer_alloc(NULL, NULL); + ide->reset_timer = timer_alloc(reset_callback, ide); /* register ide status */ state_save_register_item("ide", which, ide->adapter_control); @@ -432,9 +432,9 @@ void ide_set_user_password(int which, UINT8 *password) } -static TIMER_CALLBACK_PTR( reset_callback ) +static TIMER_CALLBACK( reset_callback ) { - ide_controller_reset_ptr(param); + ide_controller_reset_ptr(ptr); } @@ -736,9 +736,9 @@ static void ide_build_features(struct ide_state *ide) * *************************************/ -static TIMER_CALLBACK_PTR( security_error_done ) +static TIMER_CALLBACK( security_error_done ) { - struct ide_state *ide = param; + struct ide_state *ide = ptr; /* clear error state */ ide->status &= ~IDE_STATUS_ERROR; @@ -752,7 +752,7 @@ static void security_error(struct ide_state *ide) ide->status &= ~IDE_STATUS_DRIVE_READY; /* just set a timer and mark ourselves error */ - timer_set_ptr(TIME_SECURITY_ERROR, ide, security_error_done); + timer_set(TIME_SECURITY_ERROR, ide, 0, security_error_done); } @@ -904,9 +904,9 @@ static void read_sector_done(struct ide_state *ide) } -static TIMER_CALLBACK_PTR( read_sector_done_callback ) +static TIMER_CALLBACK( read_sector_done_callback ) { - read_sector_done(param); + read_sector_done(ptr); } @@ -927,10 +927,10 @@ static void read_first_sector(struct ide_state *ide) seek_time = TIME_SEEK_MULTISECTOR; ide->cur_lba = new_lba; - timer_set_ptr(seek_time, ide, read_sector_done_callback); + timer_set(seek_time, ide, 0, read_sector_done_callback); } else - timer_set_ptr(TIME_PER_SECTOR, ide, read_sector_done_callback); + timer_set(TIME_PER_SECTOR, ide, 0, read_sector_done_callback); } @@ -946,11 +946,11 @@ static void read_next_sector(struct ide_state *ide) read_sector_done(ide); else /* just set a timer */ - timer_set_ptr(ATTOTIME_IN_USEC(1), ide, read_sector_done_callback); + timer_set(ATTOTIME_IN_USEC(1), ide, 0, read_sector_done_callback); } else /* just set a timer */ - timer_set_ptr(TIME_PER_SECTOR, ide, read_sector_done_callback); + timer_set(TIME_PER_SECTOR, ide, 0, read_sector_done_callback); } @@ -962,7 +962,7 @@ static void read_next_sector(struct ide_state *ide) *************************************/ static void write_sector_done(struct ide_state *ide); -static TIMER_CALLBACK_PTR( write_sector_done_callback ); +static TIMER_CALLBACK( write_sector_done_callback ); static void continue_write(struct ide_state *ide) { @@ -983,13 +983,13 @@ static void continue_write(struct ide_state *ide) else { /* set a timer to do the write */ - timer_set_ptr(TIME_PER_SECTOR, ide, write_sector_done_callback); + timer_set(TIME_PER_SECTOR, ide, 0, write_sector_done_callback); } } else { /* set a timer to do the write */ - timer_set_ptr(TIME_PER_SECTOR, ide, write_sector_done_callback); + timer_set(TIME_PER_SECTOR, ide, 0, write_sector_done_callback); } } @@ -1106,9 +1106,9 @@ static void write_sector_done(struct ide_state *ide) } -static TIMER_CALLBACK_PTR( write_sector_done_callback ) +static TIMER_CALLBACK( write_sector_done_callback ) { - write_sector_done(param); + write_sector_done(ptr); } @@ -1563,7 +1563,7 @@ static void ide_controller_write(struct ide_state *ide, offs_t offset, int size, { ide->status |= IDE_STATUS_BUSY; ide->status &= ~IDE_STATUS_DRIVE_READY; - timer_adjust_ptr(ide->reset_timer, ATTOTIME_IN_MSEC(5), attotime_zero); + timer_adjust(ide->reset_timer, ATTOTIME_IN_MSEC(5), 0, attotime_zero); } break; } diff --git a/src/emu/machine/intelfsh.c b/src/emu/machine/intelfsh.c index 54b894cb5d7..bead65aac67 100644 --- a/src/emu/machine/intelfsh.c +++ b/src/emu/machine/intelfsh.c @@ -48,9 +48,9 @@ struct flash_chip static struct flash_chip chips[FLASH_CHIPS_MAX]; -static TIMER_CALLBACK_PTR( erase_finished ) +static TIMER_CALLBACK( erase_finished ) { - struct flash_chip *c = param; + struct flash_chip *c = ptr; switch( c->flash_mode ) { @@ -131,7 +131,7 @@ void intelflash_init(int chip, int type, void *data) c->status = 0x80; c->flash_mode = FM_NORMAL; c->flash_master_lock = 0; - c->timer = timer_alloc_ptr(erase_finished, c); + c->timer = timer_alloc(erase_finished, c); c->flash_memory = data; state_save_register_item( "intelfsh", chip, c->status ); @@ -335,7 +335,7 @@ void intelflash_write(int chip, UINT32 address, UINT32 data) c->status = 1 << 3; c->flash_mode = FM_ERASEAMD4; - timer_adjust_ptr( c->timer, ATTOTIME_IN_SEC( 17 ), attotime_zero ); + timer_adjust( c->timer, ATTOTIME_IN_SEC( 17 ), 0, attotime_zero ); } else if( ( data & 0xff ) == 0x30 ) { @@ -360,7 +360,7 @@ void intelflash_write(int chip, UINT32 address, UINT32 data) c->status = 1 << 3; c->flash_mode = FM_ERASEAMD4; - timer_adjust_ptr( c->timer, ATTOTIME_IN_SEC( 1 ), attotime_zero ); + timer_adjust( c->timer, ATTOTIME_IN_SEC( 1 ), 0, attotime_zero ); } else { @@ -429,7 +429,7 @@ void intelflash_write(int chip, UINT32 address, UINT32 data) c->status = 0x00; c->flash_mode = FM_READSTATUS; - timer_adjust_ptr( c->timer, ATTOTIME_IN_SEC( 1 ), attotime_zero ); + timer_adjust( c->timer, ATTOTIME_IN_SEC( 1 ), 0, attotime_zero ); break; } else diff --git a/src/emu/machine/mb3773.c b/src/emu/machine/mb3773.c index be0d5d7e6cd..e94217ad624 100644 --- a/src/emu/machine/mb3773.c +++ b/src/emu/machine/mb3773.c @@ -33,7 +33,7 @@ void mb3773_set_ck( UINT8 new_ck ) void mb3773_init( void ) { - watchdog_timer = timer_alloc( watchdog_timeout ); + watchdog_timer = timer_alloc( watchdog_timeout , NULL); reset_timer(); state_save_register_global( ck ); } diff --git a/src/emu/machine/mc146818.c b/src/emu/machine/mc146818.c index eaf2cc98773..b8390bbb788 100644 --- a/src/emu/machine/mc146818.c +++ b/src/emu/machine/mc146818.c @@ -201,7 +201,7 @@ void mc146818_init(MC146818_TYPE type) memset(mc146818, 0, sizeof(*mc146818)); mc146818->type = type; mc146818->last_refresh = timer_get_time(); - timer_pulse(ATTOTIME_IN_HZ(1), 0, mc146818_timer); + timer_pulse(ATTOTIME_IN_HZ(1), NULL, 0, mc146818_timer); mc146818_set_base_datetime(); } diff --git a/src/emu/machine/pc16552d.c b/src/emu/machine/pc16552d.c index 85159a51b69..ef3fb180c10 100644 --- a/src/emu/machine/pc16552d.c +++ b/src/emu/machine/pc16552d.c @@ -394,10 +394,10 @@ void pc16552d_init(int chip, int frequency, void (* irq_handler)(int channel, in duart[chip].ch[1].pending_interrupt = 0; // allocate transmit timers - duart[chip].ch[0].tx_fifo_timer = timer_alloc(tx_fifo_timer_callback); + duart[chip].ch[0].tx_fifo_timer = timer_alloc(tx_fifo_timer_callback, NULL); timer_adjust(duart[chip].ch[0].tx_fifo_timer, attotime_never, (chip * 2) + 0, attotime_never); - duart[chip].ch[1].tx_fifo_timer = timer_alloc(tx_fifo_timer_callback); + duart[chip].ch[1].tx_fifo_timer = timer_alloc(tx_fifo_timer_callback, NULL); timer_adjust(duart[chip].ch[1].tx_fifo_timer, attotime_never, (chip * 2) + 1, attotime_never); } diff --git a/src/emu/machine/pic8259.c b/src/emu/machine/pic8259.c index 7630404491a..5b6637548bf 100644 --- a/src/emu/machine/pic8259.c +++ b/src/emu/machine/pic8259.c @@ -81,7 +81,7 @@ int pic8259_init(int count, void (*set_int_line)(int which, int interrupt)) for (i = 0; i < count; i++) { - pic[i].timer = timer_alloc(pic8259_timerproc); + pic[i].timer = timer_alloc(pic8259_timerproc, NULL); pic[i].set_int_line = set_int_line; } diff --git a/src/emu/machine/pit8253.c b/src/emu/machine/pit8253.c index 4499d66d3c6..dd0967dc626 100644 --- a/src/emu/machine/pit8253.c +++ b/src/emu/machine/pit8253.c @@ -781,14 +781,14 @@ int pit8253_init(int count, const struct pit8253_config *config) timer->outputtimer = NULL; else { - timer->outputtimer = timer_alloc(outputcallback); + timer->outputtimer = timer_alloc(outputcallback, NULL); timer_adjust(timer->outputtimer, attotime_never, i | (timerno<<4), attotime_zero); } if (timer->freq_callback == NULL) timer->freqtimer = NULL; else { - timer->freqtimer = timer_alloc(freqcallback); + timer->freqtimer = timer_alloc(freqcallback, NULL); timer_adjust(timer->freqtimer, attotime_never, i | (timerno<<4), attotime_zero); } diff --git a/src/emu/machine/rtc65271.c b/src/emu/machine/rtc65271.c index 5352a91c6d5..dd5374bd981 100644 --- a/src/emu/machine/rtc65271.c +++ b/src/emu/machine/rtc65271.c @@ -316,9 +316,9 @@ void rtc65271_init(UINT8 *xram, void (*interrupt_callback)(int state)) rtc.xram = xram; - rtc.update_timer = timer_alloc(rtc_begin_update_callback); + rtc.update_timer = timer_alloc(rtc_begin_update_callback, NULL); timer_adjust(rtc.update_timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(1)); - rtc.SQW_timer = timer_alloc(rtc_SQW_callback); + rtc.SQW_timer = timer_alloc(rtc_SQW_callback, NULL); rtc.interrupt_callback = interrupt_callback; } @@ -501,7 +501,7 @@ static TIMER_CALLBACK( rtc_begin_update_callback ) rtc.regs[reg_A] |= reg_A_UIP; /* schedule end of update cycle */ - timer_set(UPDATE_CYCLE_TIME, 0, rtc_end_update_callback); + timer_set(UPDATE_CYCLE_TIME, NULL, 0, rtc_end_update_callback); } } diff --git a/src/emu/machine/timekpr.c b/src/emu/machine/timekpr.c index 125ac7308a6..b54b2d22441 100644 --- a/src/emu/machine/timekpr.c +++ b/src/emu/machine/timekpr.c @@ -34,7 +34,7 @@ struct timekeeper_chip int offset_flags; }; -struct timekeeper_chip timekeeper[ MAX_TIMEKEEPER_CHIPS ]; +static struct timekeeper_chip timekeeper[ MAX_TIMEKEEPER_CHIPS ]; #define MASK_SECONDS ( 0x7f ) #define MASK_MINUTES ( 0x7f ) @@ -139,9 +139,9 @@ static void counters_from_ram( int chip ) c->century = counter_from_ram( c->data, c->offset_century ); } -static TIMER_CALLBACK_PTR( timekeeper_tick ) +static TIMER_CALLBACK( timekeeper_tick ) { - struct timekeeper_chip *c = param; + struct timekeeper_chip *c = ptr; int carry; @@ -300,9 +300,9 @@ void timekeeper_init( int chip, int type, UINT8 *data ) state_save_register_item( "timekeeper", chip, c->century ); state_save_register_item_pointer( "timekeeper", chip, c->data, c->size ); - timer = timer_alloc_ptr( timekeeper_tick, c ); + timer = timer_alloc( timekeeper_tick, c ); duration = ATTOTIME_IN_SEC(1); - timer_adjust_ptr( timer, duration, duration ); + timer_adjust( timer, duration, 0, duration ); } static void timekeeper_nvram( int chip, mame_file *file, int read_or_write ) diff --git a/src/emu/machine/tmp68301.c b/src/emu/machine/tmp68301.c index e00a6e30bdb..74633ae8452 100644 --- a/src/emu/machine/tmp68301.c +++ b/src/emu/machine/tmp68301.c @@ -110,7 +110,7 @@ MACHINE_RESET( tmp68301 ) { int i; for (i = 0; i < 3; i++) - tmp68301_timer[i] = timer_alloc(tmp68301_timer_callback); + tmp68301_timer[i] = timer_alloc(tmp68301_timer_callback, NULL); for (i = 0; i < 3; i++) tmp68301_IE[i] = 0; diff --git a/src/emu/machine/upd4701.c b/src/emu/machine/upd4701.c index 591561913dc..9acd21e232e 100644 --- a/src/emu/machine/upd4701.c +++ b/src/emu/machine/upd4701.c @@ -26,7 +26,7 @@ struct uPD4701_chip int cf; }; -struct uPD4701_chip uPD4701[ UPD4701_MAXCHIP ]; +static struct uPD4701_chip uPD4701[ UPD4701_MAXCHIP ]; #define MASK_SWITCHES ( 7 ) #define MASK_COUNTER ( 0xfff ) diff --git a/src/emu/machine/wd33c93.c b/src/emu/machine/wd33c93.c index 6aab9dcab00..9fa3bb408ae 100644 --- a/src/emu/machine/wd33c93.c +++ b/src/emu/machine/wd33c93.c @@ -351,7 +351,7 @@ static void wd33c93_select_cmd( void ) } /* queue up a service request out in the future */ - timer_set( ATTOTIME_IN_USEC(50), 0, wd33c93_service_request ); + timer_set( ATTOTIME_IN_USEC(50), NULL, 0, wd33c93_service_request ); } else { @@ -423,7 +423,7 @@ static void wd33c93_selectxfer_cmd( void ) scsi_data.busphase = PHS_MESS_IN; /* queue up a service request out in the future */ - timer_set( ATTOTIME_IN_MSEC(50), 0, wd33c93_service_request ); + timer_set( ATTOTIME_IN_MSEC(50), NULL, 0, wd33c93_service_request ); } } else @@ -453,7 +453,7 @@ static void wd33c93_xferinfo_cmd( void ) scsi_data.regs[WD_AUXILIARY_STATUS] |= ASR_CIP; /* the command will be completed once the data is transferred */ - timer_set( ATTOTIME_IN_MSEC(1), 0, wd33c93_deassert_cip ); + timer_set( ATTOTIME_IN_MSEC(1), NULL, 0, wd33c93_deassert_cip ); } /* Command handlers */ @@ -802,7 +802,7 @@ extern void wd33c93_init( struct WD33C93interface *interface ) } /* allocate a timer for commands */ - scsi_data.cmd_timer = timer_alloc(wd33c93_complete_cb); + scsi_data.cmd_timer = timer_alloc(wd33c93_complete_cb, NULL); scsi_data.temp_input = auto_malloc( TEMP_INPUT_LEN ); diff --git a/src/emu/machine/x76f041.c b/src/emu/machine/x76f041.c index e277e06f676..62c3921f03e 100644 --- a/src/emu/machine/x76f041.c +++ b/src/emu/machine/x76f041.c @@ -78,7 +78,7 @@ struct x76f041_chip #define BCR_Z ( 2 ) #define BCR_T ( 1 ) -struct x76f041_chip x76f041[ X76F041_MAXCHIP ]; +static struct x76f041_chip x76f041[ X76F041_MAXCHIP ]; #define COMMAND_WRITE ( 0x00 ) #define COMMAND_READ ( 0x20 ) diff --git a/src/emu/machine/x76f100.c b/src/emu/machine/x76f100.c index d9cca5d33a5..a627d575bfe 100644 --- a/src/emu/machine/x76f100.c +++ b/src/emu/machine/x76f100.c @@ -60,7 +60,7 @@ struct x76f100_chip #define SIZE_READ_PASSWORD ( SIZE_WRITE_BUFFER ) #define SIZE_DATA ( 112 ) -struct x76f100_chip x76f100[ X76F100_MAXCHIP ]; +static struct x76f100_chip x76f100[ X76F100_MAXCHIP ]; #define COMMAND_WRITE ( 0x80 ) #define COMMAND_READ ( 0x81 ) diff --git a/src/emu/machine/z80ctc.c b/src/emu/machine/z80ctc.c index 8ff9351e821..47af23bf417 100644 --- a/src/emu/machine/z80ctc.c +++ b/src/emu/machine/z80ctc.c @@ -162,10 +162,10 @@ void z80ctc_init(int which, z80ctc_interface *intf) ctc->period256 = attotime_mul(ATTOTIME_IN_HZ(intf->baseclock), 256); ctc->notimer = intf->notimer; ctc->intr = intf->intr; - ctc->timer[0] = timer_alloc(timercallback); - ctc->timer[1] = timer_alloc(timercallback); - ctc->timer[2] = timer_alloc(timercallback); - ctc->timer[3] = timer_alloc(timercallback); + ctc->timer[0] = timer_alloc(timercallback, NULL); + ctc->timer[1] = timer_alloc(timercallback, NULL); + ctc->timer[2] = timer_alloc(timercallback, NULL); + ctc->timer[3] = timer_alloc(timercallback, NULL); ctc->zc[0] = intf->zc0; ctc->zc[1] = intf->zc1; ctc->zc[2] = intf->zc2; @@ -391,7 +391,7 @@ void z80ctc_trg_w(int which, int ch, UINT8 data) /* if we hit zero, do the same thing as for a timer interrupt */ if (!ctc->down[ch]) - timercallback(Machine, (which << 2) + ch); + timercallback(Machine, NULL, (which << 2) + ch); } } } diff --git a/src/emu/machine/z80sio.c b/src/emu/machine/z80sio.c index 1da4fa1eb5d..5ea9459f467 100644 --- a/src/emu/machine/z80sio.c +++ b/src/emu/machine/z80sio.c @@ -296,8 +296,8 @@ void z80sio_init(int which, z80sio_interface *intf) memset(sio, 0, sizeof(*sio)); - sio->chan[0].receive_timer = timer_alloc(serial_callback); - sio->chan[1].receive_timer = timer_alloc(serial_callback); + sio->chan[0].receive_timer = timer_alloc(serial_callback, NULL); + sio->chan[1].receive_timer = timer_alloc(serial_callback, NULL); sio->irq_cb = intf->irq_cb; sio->dtr_changed_cb = intf->dtr_changed_cb; @@ -587,7 +587,7 @@ static TIMER_CALLBACK( change_input_line ) void z80sio_set_cts(int which, int ch, int state) { /* operate deferred */ - timer_call_after_resynch((SIO_RR0_CTS << 8) + (state != 0) * 0x80 + which * 2 + ch, change_input_line); + timer_call_after_resynch(NULL, (SIO_RR0_CTS << 8) + (state != 0) * 0x80 + which * 2 + ch, change_input_line); } @@ -599,7 +599,7 @@ void z80sio_set_cts(int which, int ch, int state) void z80sio_set_dcd(int which, int ch, int state) { /* operate deferred */ - timer_call_after_resynch((SIO_RR0_DCD << 8) + (state != 0) * 0x80 + which * 2 + ch, change_input_line); + timer_call_after_resynch(NULL, (SIO_RR0_DCD << 8) + (state != 0) * 0x80 + which * 2 + ch, change_input_line); } diff --git a/src/emu/mame.c b/src/emu/mame.c index bc50082303a..2d23eaad4e5 100644 --- a/src/emu/mame.c +++ b/src/emu/mame.c @@ -378,7 +378,7 @@ int mame_execute(core_options *options) begin_resource_tracking(); /* perform a soft reset -- this takes us to the running phase */ - soft_reset(machine, 0); + soft_reset(machine, NULL, 0); /* run the CPUs until a reset or exit */ mame->hard_reset_pending = FALSE; @@ -392,7 +392,7 @@ int mame_execute(core_options *options) /* otherwise, just pump video updates through */ else - video_frame_update(); + video_frame_update(FALSE); /* handle save/load */ if (mame->saveload_schedule_callback) @@ -1508,7 +1508,7 @@ static void init_machine(running_machine *machine) /* initialize the timers and allocate a soft_reset timer */ /* this must be done before cpu_init so that CPU's can allocate timers */ timer_init(machine); - mame->soft_reset_timer = timer_alloc(soft_reset); + mame->soft_reset_timer = timer_alloc(soft_reset, NULL); /* init the osd layer */ osd_init(machine); diff --git a/src/emu/mame.h b/src/emu/mame.h index 63a2edf9981..328ee632c8d 100644 --- a/src/emu/mame.h +++ b/src/emu/mame.h @@ -245,7 +245,7 @@ struct _mame_system_time /*************************************************************************** - GLOBALS + GLOBAL VARAIBLES ***************************************************************************/ extern running_machine *Machine; diff --git a/src/emu/memory.c b/src/emu/memory.c index d8fdee22a21..826ea4496d4 100644 --- a/src/emu/memory.c +++ b/src/emu/memory.c @@ -595,6 +595,12 @@ void memory_set_opbase(offs_t pc) entry = space->readlookup[LEVEL1_INDEX(pc)]; if (entry >= SUBTABLE_BASE) entry = space->readlookup[LEVEL2_INDEX(entry,pc)]; + + /* if this entry if the current one, no need to go further */ + if (entry == opcode_entry) + return; + + /* keep track of current entry */ opcode_entry = entry; /* if we don't map to a bank, see if there are any banks we can map to */ diff --git a/src/emu/memory.h b/src/emu/memory.h index ffe03d46136..61f59a3d654 100644 --- a/src/emu/memory.h +++ b/src/emu/memory.h @@ -158,45 +158,48 @@ typedef struct _data_accessors data_accessors; #define AMEF_UNMAP(x) (((x) << AMEF_UNMAP_SHIFT) | AMEF_SPECIFIES_UNMAP) /* specifies a given unmap value */ /* ----- static data access handler constants ----- */ -#define STATIC_INVALID 0 /* invalid - should never be used */ -#define STATIC_BANK1 1 /* banked memory #1 */ -#define STATIC_BANK2 2 /* banked memory #2 */ -#define STATIC_BANK3 3 /* banked memory #3 */ -#define STATIC_BANK4 4 /* banked memory #4 */ -#define STATIC_BANK5 5 /* banked memory #5 */ -#define STATIC_BANK6 6 /* banked memory #6 */ -#define STATIC_BANK7 7 /* banked memory #7 */ -#define STATIC_BANK8 8 /* banked memory #8 */ -#define STATIC_BANK9 9 /* banked memory #9 */ -#define STATIC_BANK10 10 /* banked memory #10 */ -#define STATIC_BANK11 11 /* banked memory #11 */ -#define STATIC_BANK12 12 /* banked memory #12 */ -#define STATIC_BANK13 13 /* banked memory #13 */ -#define STATIC_BANK14 14 /* banked memory #14 */ -#define STATIC_BANK15 15 /* banked memory #15 */ -#define STATIC_BANK16 16 /* banked memory #16 */ -#define STATIC_BANK17 17 /* banked memory #17 */ -#define STATIC_BANK18 18 /* banked memory #18 */ -#define STATIC_BANK19 19 /* banked memory #19 */ -#define STATIC_BANK20 20 /* banked memory #20 */ -#define STATIC_BANK21 21 /* banked memory #21 */ -#define STATIC_BANK22 22 /* banked memory #22 */ -#define STATIC_BANK23 23 /* banked memory #23 */ -#define STATIC_BANK24 24 /* banked memory #24 */ -#define STATIC_BANK25 25 /* banked memory #25 */ -#define STATIC_BANK26 26 /* banked memory #26 */ -#define STATIC_BANK27 27 /* banked memory #27 */ -#define STATIC_BANK28 28 /* banked memory #28 */ -#define STATIC_BANK29 29 /* banked memory #29 */ -#define STATIC_BANK30 30 /* banked memory #30 */ -#define STATIC_BANK31 31 /* banked memory #31 */ -#define STATIC_BANK32 32 /* banked memory #32 */ +enum +{ + STATIC_INVALID = 0, /* invalid - should never be used */ + STATIC_BANK1, /* banked memory */ + STATIC_BANK2, + STATIC_BANK3, + STATIC_BANK4, + STATIC_BANK5, + STATIC_BANK6, + STATIC_BANK7, + STATIC_BANK8, + STATIC_BANK9, + STATIC_BANK10, + STATIC_BANK11, + STATIC_BANK12, + STATIC_BANK13, + STATIC_BANK14, + STATIC_BANK15, + STATIC_BANK16, + STATIC_BANK17, + STATIC_BANK18, + STATIC_BANK19, + STATIC_BANK20, + STATIC_BANK21, + STATIC_BANK22, + STATIC_BANK23, + STATIC_BANK24, + STATIC_BANK25, + STATIC_BANK26, + STATIC_BANK27, + STATIC_BANK28, + STATIC_BANK29, + STATIC_BANK30, + STATIC_BANK31, + STATIC_BANK32, /* entries 33-67 are reserved for dynamically allocated internal banks */ -#define STATIC_RAM 68 /* RAM - standard reads/writes */ -#define STATIC_ROM 69 /* ROM - standard reads, no writes */ -#define STATIC_NOP 70 /* unmapped - all unmapped memory goes here */ -#define STATIC_UNMAP 71 /* unmapped - all unmapped memory goes here */ -#define STATIC_COUNT 72 /* total number of static handlers */ + STATIC_RAM = 68, /* RAM - standard reads/writes */ + STATIC_ROM, /* ROM - standard reads, no writes */ + STATIC_NOP, + STATIC_UNMAP, /* unmapped - all unmapped memory goes here */ + STATIC_COUNT /* total number of static handlers */ +}; /* ----- banking constants ----- */ #define MAX_BANKS 66 /* maximum number of banks */ @@ -717,10 +720,13 @@ address_map *construct_map_##_name(address_map *map) \ ***************************************************************************/ /* ----- address spaces ----- */ -#define ADDRESS_SPACES 3 /* maximum number of address spaces */ -#define ADDRESS_SPACE_PROGRAM 0 /* program address space */ -#define ADDRESS_SPACE_DATA 1 /* data address space */ -#define ADDRESS_SPACE_IO 2 /* I/O address space */ +enum +{ + ADDRESS_SPACE_PROGRAM = 0, /* program address space */ + ADDRESS_SPACE_DATA, /* data address space */ + ADDRESS_SPACE_IO, /* I/O address space */ + ADDRESS_SPACES /* maximum number of address spaces */ +}; extern const char *address_space_names[ADDRESS_SPACES]; @@ -1153,11 +1159,7 @@ INLINE UINT32 cpu_readop_arg32(offs_t A) { if (address_is_unsafe(A)) { memory_se INLINE UINT64 cpu_readop_arg64(offs_t A) { if (address_is_unsafe(A)) { memory_set_opbase(A); } return cpu_readop_arg64_unsafe(A); } /* ----- bank switching for CPU cores ----- */ -#define change_pc(pc) \ -do { \ - if (active_address_space[ADDRESS_SPACE_PROGRAM].readlookup[LEVEL1_INDEX((pc) & active_address_space[ADDRESS_SPACE_PROGRAM].addrmask)] != opcode_entry) \ - memory_set_opbase(pc); \ -} while (0) \ +#define change_pc(pc) memory_set_opbase(pc); /* ----- forces the next branch to generate a call to the opbase handler ----- */ #define catch_nextBranch() (opcode_entry = 0xff) diff --git a/src/emu/render.h b/src/emu/render.h index c86f4c62e14..f017eb69f4a 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -87,19 +87,25 @@ enum LAYER_CONFIG_ENABLE_SCREEN_OVERLAY) /* texture formats */ -#define TEXFORMAT_UNDEFINED 0 /* require a format to be specified */ -#define TEXFORMAT_PALETTE16 1 /* 16bpp palettized, alpha ignored */ -#define TEXFORMAT_PALETTEA16 2 /* 16bpp palettized, alpha respected */ -#define TEXFORMAT_RGB15 3 /* 16bpp 5-5-5 RGB */ -#define TEXFORMAT_RGB32 4 /* 32bpp 8-8-8 RGB */ -#define TEXFORMAT_ARGB32 5 /* 32bpp 8-8-8-8 ARGB */ -#define TEXFORMAT_YUY16 6 /* 16bpp 8-8 Y/Cb, Y/Cr in sequence */ +enum +{ + TEXFORMAT_UNDEFINED = 0, /* require a format to be specified */ + TEXFORMAT_PALETTE16, /* 16bpp palettized, alpha ignored */ + TEXFORMAT_PALETTEA16, /* 16bpp palettized, alpha respected */ + TEXFORMAT_RGB15, /* 16bpp 5-5-5 RGB */ + TEXFORMAT_RGB32, /* 32bpp 8-8-8 RGB */ + TEXFORMAT_ARGB32, /* 32bpp 8-8-8-8 ARGB */ + TEXFORMAT_YUY16 /* 16bpp 8-8 Y/Cb, Y/Cr in sequence */ +}; /* blending modes */ -#define BLENDMODE_NONE 0 /* no blending */ -#define BLENDMODE_ALPHA 1 /* standard alpha blend */ -#define BLENDMODE_RGB_MULTIPLY 2 /* apply source alpha to source pix, then multiply RGB values */ -#define BLENDMODE_ADD 3 /* apply source alpha to source pix, then add to destination */ +enum +{ + BLENDMODE_NONE = 0, /* no blending */ + BLENDMODE_ALPHA, /* standard alpha blend */ + BLENDMODE_RGB_MULTIPLY, /* apply source alpha to source pix, then multiply RGB values */ + BLENDMODE_ADD /* apply source alpha to source pix, then add to destination */ +}; /* flags for primitives */ diff --git a/src/emu/romload.h b/src/emu/romload.h index 3f1598bd8f6..21b7a83b41f 100644 --- a/src/emu/romload.h +++ b/src/emu/romload.h @@ -24,17 +24,19 @@ ***************************************************************************/ /* ----- per-entry constants ----- */ -#define ROMENTRYTYPE_REGION 1 /* this entry marks the start of a region */ -#define ROMENTRYTYPE_END 2 /* this entry marks the end of a region */ -#define ROMENTRYTYPE_RELOAD 3 /* this entry reloads the previous ROM */ -#define ROMENTRYTYPE_CONTINUE 4 /* this entry continues loading the previous ROM */ -#define ROMENTRYTYPE_FILL 5 /* this entry fills an area with a constant value */ -#define ROMENTRYTYPE_COPY 6 /* this entry copies data from another region/offset */ -#define ROMENTRYTYPE_CARTRIDGE 7 /* this entry specifies a cartridge (MESS) */ -#define ROMENTRYTYPE_IGNORE 8 /* this entry continues loading the previous ROM but throws the data away */ -#define ROMENTRYTYPE_SYSTEM_BIOS 9 /* this entry specifies a bios */ -#define ROMENTRYTYPE_COUNT 10 - +enum +{ + ROMENTRYTYPE_REGION = 1, /* this entry marks the start of a region */ + ROMENTRYTYPE_END, /* this entry marks the end of a region */ + ROMENTRYTYPE_RELOAD, /* this entry reloads the previous ROM */ + ROMENTRYTYPE_CONTINUE, /* this entry continues loading the previous ROM */ + ROMENTRYTYPE_FILL, /* this entry fills an area with a constant value */ + ROMENTRYTYPE_COPY, /* this entry copies data from another region/offset */ + ROMENTRYTYPE_CARTRIDGE, /* this entry specifies a cartridge (MESS) */ + ROMENTRYTYPE_IGNORE, /* this entry continues loading the previous ROM but throws the data away */ + ROMENTRYTYPE_SYSTEM_BIOS, /* this entry specifies a bios */ + ROMENTRYTYPE_COUNT +}; /* ----- per-region constants ----- */ #define ROMREGION_WIDTHMASK 0x00000003 /* native width of region, as power of 2 */ diff --git a/src/emu/sound.c b/src/emu/sound.c index df7c9277cff..8c0ffc5cbca 100644 --- a/src/emu/sound.c +++ b/src/emu/sound.c @@ -194,7 +194,7 @@ void sound_init(running_machine *machine) finalmix = auto_malloc(Machine->sample_rate * sizeof(*finalmix)); /* allocate a global timer for sound timing */ - sound_update_timer = timer_alloc(sound_update); + sound_update_timer = timer_alloc(sound_update, NULL); timer_adjust(sound_update_timer, update_frequency, 0, update_frequency); /* initialize the streams engine */ diff --git a/src/emu/sound/2203intf.c b/src/emu/sound/2203intf.c index 839802de6eb..6322b3db356 100644 --- a/src/emu/sound/2203intf.c +++ b/src/emu/sound/2203intf.c @@ -55,15 +55,15 @@ static void IRQHandler(void *param,int irq) } /* Timer overflow callback from timer.c */ -static TIMER_CALLBACK_PTR( timer_callback_2203_0 ) +static TIMER_CALLBACK( timer_callback_2203_0 ) { - struct ym2203_info *info = param; + struct ym2203_info *info = ptr; YM2203TimerOver(info->chip,0); } -static TIMER_CALLBACK_PTR( timer_callback_2203_1 ) +static TIMER_CALLBACK( timer_callback_2203_1 ) { - struct ym2203_info *info = param; + struct ym2203_info *info = ptr; YM2203TimerOver(info->chip,1); } @@ -86,7 +86,7 @@ static void timer_handler(void *param,int c,int count,int clock) { /* Start FM Timer */ attotime period = attotime_mul(ATTOTIME_IN_HZ(clock), count); if (!timer_enable(info->timer[c], 1)) - timer_adjust_ptr(info->timer[c], period, attotime_zero); + timer_adjust(info->timer[c], period, 0, attotime_zero); } } @@ -119,8 +119,8 @@ static void *ym2203_start(int sndindex, int clock, const void *config) if (!info->psg) return NULL; /* Timer Handler set */ - info->timer[0] = timer_alloc_ptr(timer_callback_2203_0, info); - info->timer[1] = timer_alloc_ptr(timer_callback_2203_1, info); + info->timer[0] = timer_alloc(timer_callback_2203_0, info); + info->timer[1] = timer_alloc(timer_callback_2203_1, info); /* stream system initialize */ info->stream = stream_create(0,1,rate,info,ym2203_stream_update); diff --git a/src/emu/sound/2608intf.c b/src/emu/sound/2608intf.c index 13c3d018809..1ae2cce7514 100644 --- a/src/emu/sound/2608intf.c +++ b/src/emu/sound/2608intf.c @@ -69,15 +69,15 @@ static void IRQHandler(void *param,int irq) } /* Timer overflow callback from timer.c */ -static TIMER_CALLBACK_PTR( timer_callback_2608_0 ) +static TIMER_CALLBACK( timer_callback_2608_0 ) { - struct ym2608_info *info = param; + struct ym2608_info *info = ptr; YM2608TimerOver(info->chip,0); } -static TIMER_CALLBACK_PTR( timer_callback_2608_1 ) +static TIMER_CALLBACK( timer_callback_2608_1 ) { - struct ym2608_info *info = param; + struct ym2608_info *info = ptr; YM2608TimerOver(info->chip,1); } @@ -92,7 +92,7 @@ static void timer_handler(void *param,int c,int count,int clock) { /* Start FM Timer */ attotime period = attotime_mul(ATTOTIME_IN_HZ(clock), count); if (!timer_enable(info->timer[c], 1)) - timer_adjust_ptr(info->timer[c], period, attotime_zero); + timer_adjust(info->timer[c], period, 0, attotime_zero); } } @@ -135,8 +135,8 @@ static void *ym2608_start(int sndindex, int clock, const void *config) if (!info->psg) return NULL; /* Timer Handler set */ - info->timer[0] = timer_alloc_ptr(timer_callback_2608_0, info); - info->timer[1] = timer_alloc_ptr(timer_callback_2608_1, info); + info->timer[0] = timer_alloc(timer_callback_2608_0, info); + info->timer[1] = timer_alloc(timer_callback_2608_1, info); /* stream system initialize */ info->stream = stream_create(0,2,rate,info,ym2608_stream_update); diff --git a/src/emu/sound/2610intf.c b/src/emu/sound/2610intf.c index d180da6607c..a0a7a839762 100644 --- a/src/emu/sound/2610intf.c +++ b/src/emu/sound/2610intf.c @@ -69,15 +69,15 @@ static void IRQHandler(void *param,int irq) } /* Timer overflow callback from timer.c */ -static TIMER_CALLBACK_PTR( timer_callback_0 ) +static TIMER_CALLBACK( timer_callback_0 ) { - struct ym2610_info *info = param; + struct ym2610_info *info = ptr; YM2610TimerOver(info->chip,0); } -static TIMER_CALLBACK_PTR( timer_callback_1 ) +static TIMER_CALLBACK( timer_callback_1 ) { - struct ym2610_info *info = param; + struct ym2610_info *info = ptr; YM2610TimerOver(info->chip,1); } @@ -93,7 +93,7 @@ static void timer_handler(void *param,int c,int count,int clock) attotime period = attotime_mul(ATTOTIME_IN_HZ(clock), count); if (!timer_enable(info->timer[c], 1)) - timer_adjust_ptr(info->timer[c], period, attotime_zero); + timer_adjust(info->timer[c], period, 0, attotime_zero); } } @@ -138,8 +138,8 @@ static void *ym2610_start(int sndindex, int clock, const void *config) if (!info->psg) return NULL; /* Timer Handler set */ - info->timer[0] = timer_alloc_ptr(timer_callback_0, info); - info->timer[1] = timer_alloc_ptr(timer_callback_1, info); + info->timer[0] = timer_alloc(timer_callback_0, info); + info->timer[1] = timer_alloc(timer_callback_1, info); /* stream system initialize */ info->stream = stream_create(0,2,rate,info,ym2610_stream_update); @@ -190,8 +190,8 @@ static void *ym2610b_start(int sndindex, int clock, const void *config) if (!info->psg) return NULL; /* Timer Handler set */ - info->timer[0] =timer_alloc_ptr(timer_callback_0, info); - info->timer[1] =timer_alloc_ptr(timer_callback_1, info); + info->timer[0] =timer_alloc(timer_callback_0, info); + info->timer[1] =timer_alloc(timer_callback_1, info); /* stream system initialize */ info->stream = stream_create(0,2,rate,info,ym2610b_stream_update); diff --git a/src/emu/sound/2612intf.c b/src/emu/sound/2612intf.c index fbc9275f4ef..95b1a6e5b3e 100644 --- a/src/emu/sound/2612intf.c +++ b/src/emu/sound/2612intf.c @@ -34,15 +34,15 @@ static void IRQHandler(void *param,int irq) } /* Timer overflow callback from timer.c */ -static TIMER_CALLBACK_PTR( timer_callback_2612_0 ) +static TIMER_CALLBACK( timer_callback_2612_0 ) { - struct ym2612_info *info = param; + struct ym2612_info *info = ptr; YM2612TimerOver(info->chip,0); } -static TIMER_CALLBACK_PTR( timer_callback_2612_1 ) +static TIMER_CALLBACK( timer_callback_2612_1 ) { - struct ym2612_info *info = param; + struct ym2612_info *info = ptr; YM2612TimerOver(info->chip,1); } @@ -57,7 +57,7 @@ static void timer_handler(void *param,int c,int count,int clock) { /* Start FM Timer */ attotime period = attotime_mul(ATTOTIME_IN_HZ(clock), count); if (!timer_enable(info->timer[c], 1)) - timer_adjust_ptr(info->timer[c], period, attotime_zero); + timer_adjust(info->timer[c], period, 0, attotime_zero); } } @@ -99,8 +99,8 @@ static void *ym2612_start(int sndindex, int clock, const void *config) /* FM init */ /* Timer Handler set */ - info->timer[0] = timer_alloc_ptr(timer_callback_2612_0, info); - info->timer[1] = timer_alloc_ptr(timer_callback_2612_1, info); + info->timer[0] = timer_alloc(timer_callback_2612_0, info); + info->timer[1] = timer_alloc(timer_callback_2612_1, info); /* stream system initialize */ info->stream = stream_create(0,2,rate,info,ym2612_stream_update); diff --git a/src/emu/sound/262intf.c b/src/emu/sound/262intf.c index cc314703ac0..d8d2b8acfa9 100644 --- a/src/emu/sound/262intf.c +++ b/src/emu/sound/262intf.c @@ -28,15 +28,15 @@ static void IRQHandler_262(void *param,int irq) if (info->intf->handler) (info->intf->handler)(irq); } -static TIMER_CALLBACK_PTR( timer_callback_262_0 ) +static TIMER_CALLBACK( timer_callback_262_0 ) { - struct ymf262_info *info = param; + struct ymf262_info *info = ptr; YMF262TimerOver(info->chip, 0); } -static TIMER_CALLBACK_PTR( timer_callback_262_1 ) +static TIMER_CALLBACK( timer_callback_262_1 ) { - struct ymf262_info *info = param; + struct ymf262_info *info = ptr; YMF262TimerOver(info->chip, 1); } @@ -49,7 +49,7 @@ static void timer_handler_262(void *param,int timer, attotime period) } else { /* Start FM Timer */ - timer_adjust_ptr(info->timer[timer], period, attotime_zero); + timer_adjust(info->timer[timer], period, 0, attotime_zero); } } @@ -89,8 +89,8 @@ static void *ymf262_start(int sndindex, int clock, const void *config) YMF262SetIRQHandler (info->chip, IRQHandler_262, info); YMF262SetUpdateHandler(info->chip, _stream_update, info); - info->timer[0] = timer_alloc_ptr(timer_callback_262_0, info); - info->timer[1] = timer_alloc_ptr(timer_callback_262_1, info); + info->timer[0] = timer_alloc(timer_callback_262_0, info); + info->timer[1] = timer_alloc(timer_callback_262_1, info); return info; } diff --git a/src/emu/sound/3812intf.c b/src/emu/sound/3812intf.c index 6ad352864e0..2f18d91fb04 100644 --- a/src/emu/sound/3812intf.c +++ b/src/emu/sound/3812intf.c @@ -39,15 +39,15 @@ static void IRQHandler_3812(void *param,int irq) struct ym3812_info *info = param; if (info->intf->handler) (info->intf->handler)(irq ? ASSERT_LINE : CLEAR_LINE); } -static TIMER_CALLBACK_PTR( timer_callback_3812_0 ) +static TIMER_CALLBACK( timer_callback_3812_0 ) { - struct ym3812_info *info = param; + struct ym3812_info *info = ptr; YM3812TimerOver(info->chip,0); } -static TIMER_CALLBACK_PTR( timer_callback_3812_1 ) +static TIMER_CALLBACK( timer_callback_3812_1 ) { - struct ym3812_info *info = param; + struct ym3812_info *info = ptr; YM3812TimerOver(info->chip,1); } @@ -60,7 +60,7 @@ static void TimerHandler_3812(void *param,int c,attotime period) } else { /* Start FM Timer */ - timer_adjust_ptr(info->timer[c], period, attotime_zero); + timer_adjust(info->timer[c], period, 0, attotime_zero); } } @@ -101,8 +101,8 @@ static void *ym3812_start(int sndindex, int clock, const void *config) YM3812SetIRQHandler (info->chip, IRQHandler_3812, info); YM3812SetUpdateHandler(info->chip, _stream_update_3812, info); - info->timer[0] = timer_alloc_ptr(timer_callback_3812_0, info); - info->timer[1] = timer_alloc_ptr(timer_callback_3812_1, info); + info->timer[0] = timer_alloc(timer_callback_3812_0, info); + info->timer[1] = timer_alloc(timer_callback_3812_1, info); return info; } @@ -209,14 +209,14 @@ static void IRQHandler_3526(void *param,int irq) if (info->intf->handler) (info->intf->handler)(irq ? ASSERT_LINE : CLEAR_LINE); } /* Timer overflow callback from timer.c */ -static TIMER_CALLBACK_PTR( timer_callback_3526_0 ) +static TIMER_CALLBACK( timer_callback_3526_0 ) { - struct ym3526_info *info = param; + struct ym3526_info *info = ptr; YM3526TimerOver(info->chip,0); } -static TIMER_CALLBACK_PTR( timer_callback_3526_1 ) +static TIMER_CALLBACK( timer_callback_3526_1 ) { - struct ym3526_info *info = param; + struct ym3526_info *info = ptr; YM3526TimerOver(info->chip,1); } /* TimerHandler from fm.c */ @@ -229,7 +229,7 @@ static void TimerHandler_3526(void *param,int c,attotime period) } else { /* Start FM Timer */ - timer_adjust_ptr(info->timer[c], period, attotime_zero); + timer_adjust(info->timer[c], period, 0, attotime_zero); } } @@ -269,8 +269,8 @@ static void *ym3526_start(int sndindex, int clock, const void *config) YM3526SetIRQHandler (info->chip, IRQHandler_3526, info); YM3526SetUpdateHandler(info->chip, _stream_update_3526, info); - info->timer[0] = timer_alloc_ptr(timer_callback_3526_0, info); - info->timer[1] = timer_alloc_ptr(timer_callback_3526_1, info); + info->timer[0] = timer_alloc(timer_callback_3526_0, info); + info->timer[1] = timer_alloc(timer_callback_3526_1, info); return info; } @@ -375,14 +375,14 @@ static void IRQHandler_8950(void *param,int irq) struct y8950_info *info = param; if (info->intf->handler) (info->intf->handler)(irq ? ASSERT_LINE : CLEAR_LINE); } -static TIMER_CALLBACK_PTR( timer_callback_8950_0 ) +static TIMER_CALLBACK( timer_callback_8950_0 ) { - struct y8950_info *info = param; + struct y8950_info *info = ptr; Y8950TimerOver(info->chip,0); } -static TIMER_CALLBACK_PTR( timer_callback_8950_1 ) +static TIMER_CALLBACK( timer_callback_8950_1 ) { - struct y8950_info *info = param; + struct y8950_info *info = ptr; Y8950TimerOver(info->chip,1); } static void TimerHandler_8950(void *param,int c,attotime period) @@ -394,7 +394,7 @@ static void TimerHandler_8950(void *param,int c,attotime period) } else { /* Start FM Timer */ - timer_adjust_ptr(info->timer[c], period, attotime_zero); + timer_adjust(info->timer[c], period, 0, attotime_zero); } } @@ -475,8 +475,8 @@ static void *y8950_start(int sndindex, int clock, const void *config) Y8950SetIRQHandler (info->chip, IRQHandler_8950, info); Y8950SetUpdateHandler(info->chip, _stream_update_8950, info); - info->timer[0] = timer_alloc_ptr(timer_callback_8950_0, info); - info->timer[1] = timer_alloc_ptr(timer_callback_8950_1, info); + info->timer[0] = timer_alloc(timer_callback_8950_0, info); + info->timer[1] = timer_alloc(timer_callback_8950_1, info); return info; } diff --git a/src/emu/sound/es5503.c b/src/emu/sound/es5503.c index 8ba61b254c5..86bb1a5a5f2 100644 --- a/src/emu/sound/es5503.c +++ b/src/emu/sound/es5503.c @@ -132,9 +132,9 @@ static void es5503_halt_osc(ES5503Chip *chip, int onum, int type, UINT32 *accumu } } -static TIMER_CALLBACK_PTR( es5503_timer_cb ) +static TIMER_CALLBACK( es5503_timer_cb ) { - ES5503Osc *osc = param; + ES5503Osc *osc = ptr; ES5503Chip *chip = (ES5503Chip *)osc->chip; stream_update(chip->stream); @@ -262,7 +262,7 @@ static void *es5503_start(int sndindex, int clock, const void *config) chip->oscillators[osc].irqpend = 0; chip->oscillators[osc].accumulator = 0; - chip->oscillators[osc].timer = timer_alloc_ptr(es5503_timer_cb, &chip->oscillators[osc]); + chip->oscillators[osc].timer = timer_alloc(es5503_timer_cb, &chip->oscillators[osc]); chip->oscillators[osc].chip = (void *)chip; } @@ -460,13 +460,13 @@ WRITE8_HANDLER(ES5503_reg_0_w) // ok, we run for this long period = attotime_mul(ATTOTIME_IN_HZ(chip->output_rate), length); - timer_adjust_ptr(chip->oscillators[osc].timer, period, period); + timer_adjust(chip->oscillators[osc].timer, period, 0, period); } } else if (!(chip->oscillators[osc].control & 1) && (data&1)) { // key off - timer_adjust_ptr(chip->oscillators[osc].timer, attotime_never, attotime_never); + timer_adjust(chip->oscillators[osc].timer, attotime_never, 0, attotime_never); } chip->oscillators[osc].control = data; diff --git a/src/emu/sound/ics2115.c b/src/emu/sound/ics2115.c index aee2e9c20bf..282fec25abc 100644 --- a/src/emu/sound/ics2115.c +++ b/src/emu/sound/ics2115.c @@ -164,16 +164,16 @@ static void keyon(struct ics2115 *chip, int osc) } -static TIMER_CALLBACK_PTR( timer_cb_0 ) +static TIMER_CALLBACK( timer_cb_0 ) { - struct ics2115 *chip = param; + struct ics2115 *chip = ptr; chip->irq_pend |= 1<<0; recalc_irq(chip); } -static TIMER_CALLBACK_PTR( timer_cb_1 ) +static TIMER_CALLBACK( timer_cb_1 ) { - struct ics2115 *chip = param; + struct ics2115 *chip = ptr; chip->irq_pend |= 1<<1; recalc_irq(chip); } @@ -195,9 +195,9 @@ static void recalc_timer(struct ics2115 *chip, int timer) if(chip->timer[timer].period != period) { chip->timer[timer].period = period; if(period) - timer_adjust_ptr(chip->timer[timer].timer, ATTOTIME_IN_NSEC(period), ATTOTIME_IN_NSEC(period)); + timer_adjust(chip->timer[timer].timer, ATTOTIME_IN_NSEC(period), 0, ATTOTIME_IN_NSEC(period)); else - timer_adjust_ptr(chip->timer[timer].timer, attotime_never, attotime_zero); + timer_adjust(chip->timer[timer].timer, attotime_never, 0, attotime_zero); } } @@ -458,8 +458,8 @@ static void *ics2115_start(int sndindex, int clock, const void *config) chip->intf = config; chip->index = sndindex; chip->rom = memory_region(chip->intf->region); - chip->timer[0].timer = timer_alloc_ptr(timer_cb_0, chip); - chip->timer[1].timer = timer_alloc_ptr(timer_cb_1, chip); + chip->timer[0].timer = timer_alloc(timer_cb_0, chip); + chip->timer[1].timer = timer_alloc(timer_cb_1, chip); chip->ulaw = auto_malloc(256*sizeof(INT16)); chip->stream = stream_create(0, 2, 33075, chip, update); @@ -532,8 +532,8 @@ static void ics2115_reset(void *_chip) chip->irq_en = 0; chip->irq_pend = 0; memset(chip->voice, 0, sizeof(chip->voice)); - timer_adjust_ptr(chip->timer[0].timer, attotime_never, attotime_zero); - timer_adjust_ptr(chip->timer[1].timer, attotime_never, attotime_zero); + timer_adjust(chip->timer[0].timer, attotime_never, 0, attotime_zero); + timer_adjust(chip->timer[1].timer, attotime_never, 0, attotime_zero); chip->timer[0].period = 0; chip->timer[1].period = 0; recalc_irq(chip); diff --git a/src/emu/sound/k053260.c b/src/emu/sound/k053260.c index 6ab7691314a..6a6b6fc1d1a 100644 --- a/src/emu/sound/k053260.c +++ b/src/emu/sound/k053260.c @@ -222,7 +222,7 @@ static void *k053260_start(int sndindex, int clock, const void *config) /* setup SH1 timer if necessary */ if ( ic->intf->irq ) - timer_pulse( attotime_mul(ATTOTIME_IN_HZ(clock), 32), 0, ic->intf->irq ); + timer_pulse( attotime_mul(ATTOTIME_IN_HZ(clock), 32), NULL, 0, ic->intf->irq ); return ic; } diff --git a/src/emu/sound/k053260.h b/src/emu/sound/k053260.h index e4f53e5e1fb..1240f0729d8 100644 --- a/src/emu/sound/k053260.h +++ b/src/emu/sound/k053260.h @@ -8,7 +8,7 @@ struct K053260_interface { int region; /* memory region of sample ROM(s) */ - void (*irq)(running_machine *machine, int param ); /* called on SH1 complete cycle ( clock / 32 ) */ + timer_callback irq; /* called on SH1 complete cycle ( clock / 32 ) */ }; diff --git a/src/emu/sound/k054539.c b/src/emu/sound/k054539.c index 1944272112f..ac0e28a8dd1 100644 --- a/src/emu/sound/k054539.c +++ b/src/emu/sound/k054539.c @@ -439,9 +439,9 @@ else } -static TIMER_CALLBACK_PTR( K054539_irq ) +static TIMER_CALLBACK( K054539_irq ) { - struct k054539_info *info = param; + struct k054539_info *info = ptr; if(info->regs[0x22f] & 0x20) info->intf->irq (); } @@ -473,7 +473,7 @@ static void K054539_init_chip(struct k054539_info *info, int clock, int sndindex // One or more of the registers must be the timer period // And anyway, this particular frequency is probably wrong // 480 hz is TRUSTED by gokuparo disco stage - the looping sample doesn't line up otherwise - timer_pulse_ptr(ATTOTIME_IN_HZ(480), info, K054539_irq); + timer_pulse(ATTOTIME_IN_HZ(480), info, 0, K054539_irq); info->stream = stream_create(0, 2, clock, info, K054539_update); diff --git a/src/emu/sound/msm5205.c b/src/emu/sound/msm5205.c index 678ca78b919..4da5bb899c7 100644 --- a/src/emu/sound/msm5205.c +++ b/src/emu/sound/msm5205.c @@ -111,9 +111,9 @@ static void MSM5205_update(void *param,stream_sample_t **inputs, stream_sample_t } /* timer callback at VCLK low eddge */ -static TIMER_CALLBACK_PTR( MSM5205_vclk_callback ) +static TIMER_CALLBACK( MSM5205_vclk_callback ) { - struct MSM5205Voice *voice = param; + struct MSM5205Voice *voice = ptr; int val; int new_signal; /* callback user handler and latch next data */ @@ -184,7 +184,7 @@ static void *msm5205_start(int sndindex, int clock, const void *config) /* stream system initialize */ voice->stream = stream_create(0,1,clock,voice,MSM5205_update); - voice->timer = timer_alloc_ptr(MSM5205_vclk_callback, voice); + voice->timer = timer_alloc(MSM5205_vclk_callback, voice); /* initialize */ msm5205_reset(voice); @@ -220,7 +220,7 @@ void MSM5205_vclk_w (int num, int vclk) if( voice->vclk != vclk) { voice->vclk = vclk; - if( !vclk ) MSM5205_vclk_callback(Machine, voice); + if( !vclk ) MSM5205_vclk_callback(Machine, voice, 0); } } } @@ -269,10 +269,10 @@ void MSM5205_playmode_w(int num,int select) if( prescaler ) { attotime period = attotime_mul(ATTOTIME_IN_HZ(voice->clock), prescaler); - timer_adjust_ptr(voice->timer, period, period); + timer_adjust(voice->timer, period, 0, period); } else - timer_adjust_ptr(voice->timer, attotime_never, attotime_zero); + timer_adjust(voice->timer, attotime_never, 0, attotime_zero); } if( voice->bitwidth != bitwidth ) diff --git a/src/emu/sound/pokey.c b/src/emu/sound/pokey.c index 4d01cbcdfc7..8a557067edc 100644 --- a/src/emu/sound/pokey.c +++ b/src/emu/sound/pokey.c @@ -239,17 +239,8 @@ struct POKEYregisters #define P9(chip) chip->poly9[chip->p9] #define P17(chip) chip->poly17[chip->p17] -static TIMER_CALLBACK_PTR( pokey_timer_expire_1 ); -static TIMER_CALLBACK_PTR( pokey_timer_expire_2 ); -static TIMER_CALLBACK_PTR( pokey_timer_expire_4 ); -static TIMER_CALLBACK_PTR( pokey_pot_trigger_0 ); -static TIMER_CALLBACK_PTR( pokey_pot_trigger_1 ); -static TIMER_CALLBACK_PTR( pokey_pot_trigger_2 ); -static TIMER_CALLBACK_PTR( pokey_pot_trigger_3 ); -static TIMER_CALLBACK_PTR( pokey_pot_trigger_4 ); -static TIMER_CALLBACK_PTR( pokey_pot_trigger_5 ); -static TIMER_CALLBACK_PTR( pokey_pot_trigger_6 ); -static TIMER_CALLBACK_PTR( pokey_pot_trigger_7 ); +static TIMER_CALLBACK( pokey_timer_expire ); +static TIMER_CALLBACK( pokey_pot_trigger ); #define SAMPLE -1 @@ -675,20 +666,20 @@ static void *pokey_start(int sndindex, int clock, const void *config) chip->clockmult = DIV_64; chip->KBCODE = 0x09; /* Atari 800 'no key' */ chip->SKCTL = SK_RESET; /* let the RNG run after reset */ - chip->rtimer = timer_alloc(NULL); + chip->rtimer = timer_alloc(NULL, NULL); - chip->timer[0] = timer_alloc_ptr(pokey_timer_expire_1, chip); - chip->timer[1] = timer_alloc_ptr(pokey_timer_expire_2, chip); - chip->timer[2] = timer_alloc_ptr(pokey_timer_expire_4, chip); + chip->timer[0] = timer_alloc(pokey_timer_expire, chip); + chip->timer[1] = timer_alloc(pokey_timer_expire, chip); + chip->timer[2] = timer_alloc(pokey_timer_expire, chip); - chip->ptimer[0] = timer_alloc_ptr(pokey_pot_trigger_0, chip); - chip->ptimer[1] = timer_alloc_ptr(pokey_pot_trigger_1, chip); - chip->ptimer[2] = timer_alloc_ptr(pokey_pot_trigger_2, chip); - chip->ptimer[3] = timer_alloc_ptr(pokey_pot_trigger_3, chip); - chip->ptimer[4] = timer_alloc_ptr(pokey_pot_trigger_4, chip); - chip->ptimer[5] = timer_alloc_ptr(pokey_pot_trigger_5, chip); - chip->ptimer[6] = timer_alloc_ptr(pokey_pot_trigger_6, chip); - chip->ptimer[7] = timer_alloc_ptr(pokey_pot_trigger_7, chip); + chip->ptimer[0] = timer_alloc(pokey_pot_trigger, chip); + chip->ptimer[1] = timer_alloc(pokey_pot_trigger, chip); + chip->ptimer[2] = timer_alloc(pokey_pot_trigger, chip); + chip->ptimer[3] = timer_alloc(pokey_pot_trigger, chip); + chip->ptimer[4] = timer_alloc(pokey_pot_trigger, chip); + chip->ptimer[5] = timer_alloc(pokey_pot_trigger, chip); + chip->ptimer[6] = timer_alloc(pokey_pot_trigger, chip); + chip->ptimer[7] = timer_alloc(pokey_pot_trigger, chip); chip->pot_r[0] = chip->intf.pot_r[0]; chip->pot_r[1] = chip->intf.pot_r[1]; @@ -710,8 +701,11 @@ static void *pokey_start(int sndindex, int clock, const void *config) return chip; } -static void pokey_timer_expire_common(struct POKEYregisters *p, int timers) +static TIMER_CALLBACK( pokey_timer_expire ) { + struct POKEYregisters *p = ptr; + int timers = param; + LOG_TIMER(("POKEY #%p timer %d with IRQEN $%02x\n", p, timers, p->IRQEN)); /* check if some of the requested timer interrupts are enabled */ @@ -727,22 +721,6 @@ static void pokey_timer_expire_common(struct POKEYregisters *p, int timers) } } -static TIMER_CALLBACK_PTR( pokey_timer_expire_1 ) -{ - struct POKEYregisters *chip = param; - pokey_timer_expire_common(chip, chip->timer_param[TIMER1]); -} -static TIMER_CALLBACK_PTR( pokey_timer_expire_2 ) -{ - struct POKEYregisters *chip = param; - pokey_timer_expire_common(chip, chip->timer_param[TIMER2]); -} -static TIMER_CALLBACK_PTR( pokey_timer_expire_4 ) -{ - struct POKEYregisters *chip = param; - pokey_timer_expire_common(chip, chip->timer_param[TIMER4]); -} - #if VERBOSE_SOUND static char *audc2str(int val) { @@ -795,9 +773,9 @@ static char *audctl2str(int val) } #endif -static TIMER_CALLBACK_PTR( pokey_serin_ready ) +static TIMER_CALLBACK( pokey_serin_ready ) { - struct POKEYregisters *p = param; + struct POKEYregisters *p = ptr; if( p->IRQEN & IRQ_SERIN ) { /* set the enabled timer irq status bits */ @@ -808,9 +786,9 @@ static TIMER_CALLBACK_PTR( pokey_serin_ready ) } } -static TIMER_CALLBACK_PTR( pokey_serout_ready ) +static TIMER_CALLBACK( pokey_serout_ready ) { - struct POKEYregisters *p = param; + struct POKEYregisters *p = ptr; if( p->IRQEN & IRQ_SEROR ) { p->IRQST |= IRQ_SEROR; @@ -819,9 +797,9 @@ static TIMER_CALLBACK_PTR( pokey_serout_ready ) } } -static TIMER_CALLBACK_PTR( pokey_serout_complete ) +static TIMER_CALLBACK( pokey_serout_complete ) { - struct POKEYregisters *p = param; + struct POKEYregisters *p = ptr; if( p->IRQEN & IRQ_SEROC ) { p->IRQST |= IRQ_SEROC; @@ -830,21 +808,14 @@ static TIMER_CALLBACK_PTR( pokey_serout_complete ) } } -static void pokey_pot_trigger_common(struct POKEYregisters *p, int pot) +static TIMER_CALLBACK( pokey_pot_trigger ) { + struct POKEYregisters *p = ptr; + int pot = param; LOG(("POKEY #%p POT%d triggers after %dus\n", p, pot, (int)(1000000 * attotime_to_double(timer_timeelapsed(p->ptimer[pot]))))); p->ALLPOT &= ~(1 << pot); /* set the enabled timer irq status bits */ } -static TIMER_CALLBACK_PTR( pokey_pot_trigger_0 ) { pokey_pot_trigger_common(param, 0); } -static TIMER_CALLBACK_PTR( pokey_pot_trigger_1 ) { pokey_pot_trigger_common(param, 1); } -static TIMER_CALLBACK_PTR( pokey_pot_trigger_2 ) { pokey_pot_trigger_common(param, 2); } -static TIMER_CALLBACK_PTR( pokey_pot_trigger_3 ) { pokey_pot_trigger_common(param, 3); } -static TIMER_CALLBACK_PTR( pokey_pot_trigger_4 ) { pokey_pot_trigger_common(param, 4); } -static TIMER_CALLBACK_PTR( pokey_pot_trigger_5 ) { pokey_pot_trigger_common(param, 5); } -static TIMER_CALLBACK_PTR( pokey_pot_trigger_6 ) { pokey_pot_trigger_common(param, 6); } -static TIMER_CALLBACK_PTR( pokey_pot_trigger_7 ) { pokey_pot_trigger_common(param, 7); } - #define AD_TIME ((p->SKCTL & SK_PADDLE) ? p->ad_time_fast : p->ad_time_slow) static void pokey_potgo(struct POKEYregisters *p) @@ -870,7 +841,7 @@ static void pokey_potgo(struct POKEYregisters *p) /* final value */ p->POTx[pot] = r; - timer_adjust_ptr(p->ptimer[pot], attotime_mul(AD_TIME, r), attotime_zero); + timer_adjust(p->ptimer[pot], attotime_mul(AD_TIME, r), pot, attotime_zero); } } } @@ -1137,9 +1108,9 @@ static void pokey_register_w(int chip, int offs, int data) /* first remove any existing timers */ LOG_TIMER(("POKEY #%d STIMER $%02x\n", chip, data)); - timer_adjust_ptr(p->timer[TIMER1], attotime_never, attotime_zero); - timer_adjust_ptr(p->timer[TIMER2], attotime_never, attotime_zero); - timer_adjust_ptr(p->timer[TIMER4], attotime_never, attotime_zero); + timer_adjust(p->timer[TIMER1], attotime_never, p->timer_param[TIMER1], attotime_zero); + timer_adjust(p->timer[TIMER2], attotime_never, p->timer_param[TIMER2], attotime_zero); + timer_adjust(p->timer[TIMER4], attotime_never, p->timer_param[TIMER4], attotime_zero); /* reset all counters to zero (side effect) */ p->polyadjust = 0; @@ -1157,7 +1128,7 @@ static void pokey_register_w(int chip, int offs, int data) /* set timer #1 _and_ #2 event after timer_div clocks of joined CHAN1+CHAN2 */ p->timer_period[TIMER2] = attotime_mul(p->clock_period, p->divisor[CHAN2]); p->timer_param[TIMER2] = (chip<<3)|IRQ_TIMR2|IRQ_TIMR1; - timer_adjust_ptr(p->timer[TIMER2], p->timer_period[TIMER2], p->timer_period[TIMER2]); + timer_adjust(p->timer[TIMER2], p->timer_period[TIMER2], p->timer_param[TIMER2], p->timer_period[TIMER2]); } } else @@ -1168,7 +1139,7 @@ static void pokey_register_w(int chip, int offs, int data) /* set timer #1 event after timer_div clocks of CHAN1 */ p->timer_period[TIMER1] = attotime_mul(p->clock_period, p->divisor[CHAN1]); p->timer_param[TIMER1] = (chip<<3)|IRQ_TIMR1; - timer_adjust_ptr(p->timer[TIMER1], p->timer_period[TIMER1], p->timer_period[TIMER1]); + timer_adjust(p->timer[TIMER1], p->timer_period[TIMER1], p->timer_param[TIMER1], p->timer_period[TIMER1]); } if( p->divisor[CHAN2] > 4 ) @@ -1177,7 +1148,7 @@ static void pokey_register_w(int chip, int offs, int data) /* set timer #2 event after timer_div clocks of CHAN2 */ p->timer_period[TIMER2] = attotime_mul(p->clock_period, p->divisor[CHAN2]); p->timer_param[TIMER2] = (chip<<3)|IRQ_TIMR2; - timer_adjust_ptr(p->timer[TIMER2], p->timer_period[TIMER2], p->timer_period[TIMER2]); + timer_adjust(p->timer[TIMER2], p->timer_period[TIMER2], p->timer_param[TIMER2], p->timer_period[TIMER2]); } } @@ -1194,7 +1165,7 @@ static void pokey_register_w(int chip, int offs, int data) /* set timer #4 event after timer_div clocks of CHAN4 */ p->timer_period[TIMER4] = attotime_mul(p->clock_period, p->divisor[CHAN4]); p->timer_param[TIMER4] = (chip<<3)|IRQ_TIMR4; - timer_adjust_ptr(p->timer[TIMER4], p->timer_period[TIMER4], p->timer_period[TIMER4]); + timer_adjust(p->timer[TIMER4], p->timer_period[TIMER4], p->timer_param[TIMER4], p->timer_period[TIMER4]); } } } @@ -1206,7 +1177,7 @@ static void pokey_register_w(int chip, int offs, int data) /* set timer #4 event after timer_div clocks of CHAN4 */ p->timer_period[TIMER4] = attotime_mul(p->clock_period, p->divisor[CHAN4]); p->timer_param[TIMER4] = (chip<<3)|IRQ_TIMR4; - timer_adjust_ptr(p->timer[TIMER4], p->timer_period[TIMER4], p->timer_period[TIMER4]); + timer_adjust(p->timer[TIMER4], p->timer_period[TIMER4], p->timer_param[TIMER4], p->timer_period[TIMER4]); } } @@ -1236,9 +1207,9 @@ static void pokey_register_w(int chip, int offs, int data) * loaders from Ballblazer and Escape from Fractalus * The real times are unknown */ - timer_set_ptr(ATTOTIME_IN_USEC(200), p, pokey_serout_ready); + timer_set(ATTOTIME_IN_USEC(200), p, 0, pokey_serout_ready); /* 10 bits (assumption 1 start, 8 data and 1 stop bit) take how long? */ - timer_set_ptr(ATTOTIME_IN_USEC(2000), p, pokey_serout_complete); + timer_set(ATTOTIME_IN_USEC(2000), p, 0, pokey_serout_complete); break; case IRQEN_C: @@ -1303,7 +1274,7 @@ static void pokey_register_w(int chip, int offs, int data) if( new_val < p->counter[CHAN1] ) p->counter[CHAN1] = new_val; if( p->interrupt_cb && p->timer[TIMER1] ) - timer_adjust_ptr(p->timer[TIMER1], attotime_mul(p->clock_period, new_val), p->timer_period[TIMER1]); + timer_adjust(p->timer[TIMER1], attotime_mul(p->clock_period, new_val), p->timer_param[TIMER1], p->timer_period[TIMER1]); p->audible[CHAN1] = !( (p->AUDC[CHAN1] & VOLUME_ONLY) || (p->AUDC[CHAN1] & VOLUME_MASK) == 0 || @@ -1339,7 +1310,7 @@ static void pokey_register_w(int chip, int offs, int data) if( new_val < p->counter[CHAN2] ) p->counter[CHAN2] = new_val; if( p->interrupt_cb && p->timer[TIMER2] ) - timer_adjust_ptr(p->timer[TIMER2], attotime_mul(p->clock_period, new_val), p->timer_period[TIMER2]); + timer_adjust(p->timer[TIMER2], attotime_mul(p->clock_period, new_val), p->timer_param[TIMER2], p->timer_period[TIMER2]); p->audible[CHAN2] = !( (p->AUDC[CHAN2] & VOLUME_ONLY) || (p->AUDC[CHAN2] & VOLUME_MASK) == 0 || @@ -1404,7 +1375,7 @@ static void pokey_register_w(int chip, int offs, int data) if( new_val < p->counter[CHAN4] ) p->counter[CHAN4] = new_val; if( p->interrupt_cb && p->timer[TIMER4] ) - timer_adjust_ptr(p->timer[TIMER4], attotime_mul(p->clock_period, new_val), p->timer_period[TIMER4]); + timer_adjust(p->timer[TIMER4], attotime_mul(p->clock_period, new_val), p->timer_param[TIMER4], p->timer_period[TIMER4]); p->audible[CHAN4] = !( (p->AUDC[CHAN4] & VOLUME_ONLY) || (p->AUDC[CHAN4] & VOLUME_MASK) == 0 || @@ -1452,25 +1423,25 @@ WRITE8_HANDLER( quad_pokey_w ) void pokey1_serin_ready(int after) { struct POKEYregisters *p = sndti_token(SOUND_POKEY, 0); - timer_set_ptr(attotime_mul(p->clock_period, after), p, pokey_serin_ready); + timer_set(attotime_mul(p->clock_period, after), p, 0, pokey_serin_ready); } void pokey2_serin_ready(int after) { struct POKEYregisters *p = sndti_token(SOUND_POKEY, 1); - timer_set_ptr(attotime_mul(p->clock_period, after), p, pokey_serin_ready); + timer_set(attotime_mul(p->clock_period, after), p, 0, pokey_serin_ready); } void pokey3_serin_ready(int after) { struct POKEYregisters *p = sndti_token(SOUND_POKEY, 2); - timer_set_ptr(attotime_mul(p->clock_period, after), p, pokey_serin_ready); + timer_set(attotime_mul(p->clock_period, after), p, 0, pokey_serin_ready); } void pokey4_serin_ready(int after) { struct POKEYregisters *p = sndti_token(SOUND_POKEY, 3); - timer_set_ptr(attotime_mul(p->clock_period, after), p, pokey_serin_ready); + timer_set(attotime_mul(p->clock_period, after), p, 0, pokey_serin_ready); } static void pokey_break_w(int chip, int shift) diff --git a/src/emu/sound/scsp.c b/src/emu/sound/scsp.c index 78b788838c4..43b8b465d32 100644 --- a/src/emu/sound/scsp.c +++ b/src/emu/sound/scsp.c @@ -308,9 +308,9 @@ static void ResetInterrupts(struct _SCSP *SCSP) CheckPendingIRQ(SCSP); } -static TIMER_CALLBACK_PTR( timerA_cb ) +static TIMER_CALLBACK( timerA_cb ) { - struct _SCSP *SCSP = (struct _SCSP *)param; + struct _SCSP *SCSP = (struct _SCSP *)ptr; SCSP->TimCnt[0] = 0xFFFF; SCSP->udata.data[0x20/2]|=0x40; @@ -320,9 +320,9 @@ static TIMER_CALLBACK_PTR( timerA_cb ) CheckPendingIRQ(SCSP); } -static TIMER_CALLBACK_PTR( timerB_cb ) +static TIMER_CALLBACK( timerB_cb ) { - struct _SCSP *SCSP = (struct _SCSP *)param; + struct _SCSP *SCSP = (struct _SCSP *)ptr; SCSP->TimCnt[1] = 0xFFFF; SCSP->udata.data[0x20/2]|=0x80; @@ -332,9 +332,9 @@ static TIMER_CALLBACK_PTR( timerB_cb ) CheckPendingIRQ(SCSP); } -static TIMER_CALLBACK_PTR( timerC_cb ) +static TIMER_CALLBACK( timerC_cb ) { - struct _SCSP *SCSP = (struct _SCSP *)param; + struct _SCSP *SCSP = (struct _SCSP *)ptr; SCSP->TimCnt[2] = 0xFFFF; SCSP->udata.data[0x20/2]|=0x100; @@ -524,9 +524,9 @@ static void SCSP_Init(struct _SCSP *SCSP, const struct SCSPinterface *intf, int } } - SCSP->timerA = timer_alloc_ptr(timerA_cb, SCSP); - SCSP->timerB = timer_alloc_ptr(timerB_cb, SCSP); - SCSP->timerC = timer_alloc_ptr(timerC_cb, SCSP); + SCSP->timerA = timer_alloc(timerA_cb, SCSP); + SCSP->timerB = timer_alloc(timerB_cb, SCSP); + SCSP->timerC = timer_alloc(timerC_cb, SCSP); for(i=0;i<0x400;++i) { @@ -720,7 +720,7 @@ static void SCSP_UpdateReg(struct _SCSP *SCSP, int reg) time = (44100 / SCSP->TimPris[0]) / (255-(SCSP->udata.data[0x18/2]&0xff)); if (time) { - timer_adjust_ptr(SCSP->timerA, ATTOTIME_IN_HZ(time), attotime_never); + timer_adjust(SCSP->timerA, ATTOTIME_IN_HZ(time), 0, attotime_never); } } } @@ -739,7 +739,7 @@ static void SCSP_UpdateReg(struct _SCSP *SCSP, int reg) time = (44100 / SCSP->TimPris[1]) / (255-(SCSP->udata.data[0x1A/2]&0xff)); if (time) { - timer_adjust_ptr(SCSP->timerB, ATTOTIME_IN_HZ(time), attotime_never); + timer_adjust(SCSP->timerB, ATTOTIME_IN_HZ(time), 0, attotime_never); } } } @@ -758,7 +758,7 @@ static void SCSP_UpdateReg(struct _SCSP *SCSP, int reg) time = (44100 / SCSP->TimPris[2]) / (255-(SCSP->udata.data[0x1C/2]&0xff)); if (time) { - timer_adjust_ptr(SCSP->timerC, ATTOTIME_IN_HZ(time), attotime_never); + timer_adjust(SCSP->timerC, ATTOTIME_IN_HZ(time), 0, attotime_never); } } } diff --git a/src/emu/sound/sp0250.c b/src/emu/sound/sp0250.c index fc6e00bec00..343f63fb8fb 100644 --- a/src/emu/sound/sp0250.c +++ b/src/emu/sound/sp0250.c @@ -117,9 +117,9 @@ static void sp0250_load_values(struct sp0250 *sp) sp->playing = 1; } -static TIMER_CALLBACK_PTR( sp0250_timer_tick ) +static TIMER_CALLBACK( sp0250_timer_tick ) { - struct sp0250 *sp = param; + struct sp0250 *sp = ptr; stream_update(sp->stream); } @@ -200,7 +200,7 @@ static void *sp0250_start(int sndindex, int clock, const void *config) sp->RNG = 1; sp->drq = intf->drq_callback; sp->drq(ASSERT_LINE); - timer_pulse_ptr(attotime_mul(ATTOTIME_IN_HZ(clock), CLOCK_DIVIDER), sp, sp0250_timer_tick); + timer_pulse(attotime_mul(ATTOTIME_IN_HZ(clock), CLOCK_DIVIDER), sp, 0, sp0250_timer_tick); sp->stream = stream_create(0, 1, clock / CLOCK_DIVIDER, sp, sp0250_update); diff --git a/src/emu/sound/upd7759.c b/src/emu/sound/upd7759.c index 2748c647dfa..37b5a40906e 100644 --- a/src/emu/sound/upd7759.c +++ b/src/emu/sound/upd7759.c @@ -522,9 +522,9 @@ static void upd7759_update(void *param, stream_sample_t **inputs, stream_sample_ *************************************************************/ -static TIMER_CALLBACK_PTR( upd7759_slave_update ) +static TIMER_CALLBACK( upd7759_slave_update ) { - struct upd7759_chip *chip = param; + struct upd7759_chip *chip = ptr; UINT8 olddrq = chip->drq; /* update the stream */ @@ -540,7 +540,7 @@ static TIMER_CALLBACK_PTR( upd7759_slave_update ) /* set a timer to go off when that is done */ if (chip->state != STATE_IDLE) - timer_adjust_ptr(chip->timer, attotime_mul(chip->clock_period, chip->clocks_left), attotime_zero); + timer_adjust(chip->timer, attotime_mul(chip->clock_period, chip->clocks_left), 0, attotime_zero); } @@ -575,7 +575,7 @@ static void upd7759_reset(struct upd7759_chip *chip) /* turn off any timer */ if (chip->timer) - timer_adjust_ptr(chip->timer, attotime_never, attotime_zero); + timer_adjust(chip->timer, attotime_never, 0, attotime_zero); } @@ -643,7 +643,7 @@ static void *upd7759_start(int sndindex, int clock, const void *config) if (intf->region != 0) chip->rom = chip->rombase = memory_region(intf->region); else - chip->timer = timer_alloc_ptr(upd7759_slave_update, chip); + chip->timer = timer_alloc(upd7759_slave_update, chip); /* set the DRQ callback */ chip->drqcallback = intf->drqcallback; @@ -702,7 +702,7 @@ void upd7759_start_w(int which, UINT8 data) /* for slave mode, start the timer going */ if (chip->timer) - timer_adjust_ptr(chip->timer, attotime_zero, attotime_zero); + timer_adjust(chip->timer, attotime_zero, 0, attotime_zero); } } diff --git a/src/emu/sound/ym2151.c b/src/emu/sound/ym2151.c index dd3b0e45b5f..063cfcc7477 100644 --- a/src/emu/sound/ym2151.c +++ b/src/emu/sound/ym2151.c @@ -783,9 +783,9 @@ INLINE void envelope_KONKOFF(YM2151Operator * op, int v) #ifdef USE_MAME_TIMERS -static TIMER_CALLBACK_PTR( irqAon_callback ) +static TIMER_CALLBACK( irqAon_callback ) { - YM2151 *chip = param; + YM2151 *chip = ptr; int oldstate = chip->irqlinestate; chip->irqlinestate |= 1; @@ -793,9 +793,9 @@ static TIMER_CALLBACK_PTR( irqAon_callback ) if (oldstate == 0 && chip->irqhandler) (*chip->irqhandler)(1); } -static TIMER_CALLBACK_PTR( irqBon_callback ) +static TIMER_CALLBACK( irqBon_callback ) { - YM2151 *chip = param; + YM2151 *chip = ptr; int oldstate = chip->irqlinestate; chip->irqlinestate |= 2; @@ -803,9 +803,9 @@ static TIMER_CALLBACK_PTR( irqBon_callback ) if (oldstate == 0 && chip->irqhandler) (*chip->irqhandler)(1); } -static TIMER_CALLBACK_PTR( irqAoff_callback ) +static TIMER_CALLBACK( irqAoff_callback ) { - YM2151 *chip = param; + YM2151 *chip = ptr; int oldstate = chip->irqlinestate; chip->irqlinestate &= ~1; @@ -813,9 +813,9 @@ static TIMER_CALLBACK_PTR( irqAoff_callback ) if (oldstate == 1 && chip->irqhandler) (*chip->irqhandler)(0); } -static TIMER_CALLBACK_PTR( irqBoff_callback ) +static TIMER_CALLBACK( irqBoff_callback ) { - YM2151 *chip = param; + YM2151 *chip = ptr; int oldstate = chip->irqlinestate; chip->irqlinestate &= ~2; @@ -823,34 +823,34 @@ static TIMER_CALLBACK_PTR( irqBoff_callback ) if (oldstate == 2 && chip->irqhandler) (*chip->irqhandler)(0); } -static TIMER_CALLBACK_PTR( timer_callback_a ) +static TIMER_CALLBACK( timer_callback_a ) { - YM2151 *chip = param; - timer_adjust_ptr(chip->timer_A, chip->timer_A_time[ chip->timer_A_index ], attotime_zero); + YM2151 *chip = ptr; + timer_adjust(chip->timer_A, chip->timer_A_time[ chip->timer_A_index ], 0, attotime_zero); chip->timer_A_index_old = chip->timer_A_index; if (chip->irq_enable & 0x04) { chip->status |= 1; - timer_set_ptr(attotime_zero,chip,irqAon_callback); + timer_set(attotime_zero,chip,0,irqAon_callback); } if (chip->irq_enable & 0x80) chip->csm_req = 2; /* request KEY ON / KEY OFF sequence */ } -static TIMER_CALLBACK_PTR( timer_callback_b ) +static TIMER_CALLBACK( timer_callback_b ) { - YM2151 *chip = param; - timer_adjust_ptr(chip->timer_B, chip->timer_B_time[ chip->timer_B_index ], attotime_zero); + YM2151 *chip = ptr; + timer_adjust(chip->timer_B, chip->timer_B_time[ chip->timer_B_index ], 0, attotime_zero); chip->timer_B_index_old = chip->timer_B_index; if (chip->irq_enable & 0x08) { chip->status |= 2; - timer_set_ptr(attotime_zero,chip,irqBon_callback); + timer_set(attotime_zero,chip,0,irqBon_callback); } } #if 0 -static TIMER_CALLBACK_PTR( timer_callback_chip_busy ) +static TIMER_CALLBACK( timer_callback_chip_busy ) { - YM2151 *chip = param; + YM2151 *chip = ptr; chip->status &= 0x7f; /* reset busy flag */ } #endif @@ -1056,7 +1056,7 @@ void YM2151WriteReg(void *_chip, int r, int v) #if 0 /* There is no info on what YM2151 really does when busy flag is set */ if ( chip->status & 0x80 ) return; - timer_set_ptr ( attotime_mul(ATTOTIME_IN_HZ(chip->clock), 64), chip, timer_callback_chip_busy); + timer_set ( attotime_mul(ATTOTIME_IN_HZ(chip->clock), 64), chip, 0, timer_callback_chip_busy); chip->status |= 0x80; /* set busy flag for 64 chip clock cycles */ #endif @@ -1107,7 +1107,7 @@ void YM2151WriteReg(void *_chip, int r, int v) { #ifdef USE_MAME_TIMERS chip->status &= ~1; - timer_set_ptr(attotime_zero,chip,irqAoff_callback); + timer_set(attotime_zero,chip,0,irqAoff_callback); #else int oldstate = chip->status & 3; chip->status &= ~1; @@ -1119,7 +1119,7 @@ void YM2151WriteReg(void *_chip, int r, int v) { #ifdef USE_MAME_TIMERS chip->status &= ~2; - timer_set_ptr(attotime_zero,chip,irqBoff_callback); + timer_set(attotime_zero,chip,0,irqBoff_callback); #else int oldstate = chip->status & 3; chip->status &= ~2; @@ -1133,7 +1133,7 @@ void YM2151WriteReg(void *_chip, int r, int v) /* start timer _only_ if it wasn't already started (it will reload time value next round) */ if (!timer_enable(chip->timer_B, 1)) { - timer_adjust_ptr(chip->timer_B, chip->timer_B_time[ chip->timer_B_index ], attotime_zero); + timer_adjust(chip->timer_B, chip->timer_B_time[ chip->timer_B_index ], 0, attotime_zero); chip->timer_B_index_old = chip->timer_B_index; } #else @@ -1158,7 +1158,7 @@ void YM2151WriteReg(void *_chip, int r, int v) /* start timer _only_ if it wasn't already started (it will reload time value next round) */ if (!timer_enable(chip->timer_A, 1)) { - timer_adjust_ptr(chip->timer_A, chip->timer_A_time[ chip->timer_A_index ], attotime_zero); + timer_adjust(chip->timer_A, chip->timer_A_time[ chip->timer_A_index ], 0, attotime_zero); chip->timer_A_index_old = chip->timer_A_index; } #else @@ -1542,8 +1542,8 @@ void * YM2151Init(int index, int clock, int rate) #ifdef USE_MAME_TIMERS /* this must be done _before_ a call to YM2151ResetChip() */ - PSG->timer_A = timer_alloc_ptr(timer_callback_a, PSG); - PSG->timer_B = timer_alloc_ptr(timer_callback_b, PSG); + PSG->timer_A = timer_alloc(timer_callback_a, PSG); + PSG->timer_B = timer_alloc(timer_callback_b, PSG); #else PSG->tim_A = 0; PSG->tim_B = 0; diff --git a/src/emu/sound/ymf271.c b/src/emu/sound/ymf271.c index 710fdc3b9d6..204db210961 100644 --- a/src/emu/sound/ymf271.c +++ b/src/emu/sound/ymf271.c @@ -1338,9 +1338,9 @@ static void ymf271_write_pcm(YMF271Chip *chip, int data) } } -static TIMER_CALLBACK_PTR( ymf271_timer_a_tick ) +static TIMER_CALLBACK( ymf271_timer_a_tick ) { - YMF271Chip *chip = param; + YMF271Chip *chip = ptr; chip->status |= 1; @@ -1351,9 +1351,9 @@ static TIMER_CALLBACK_PTR( ymf271_timer_a_tick ) } } -static TIMER_CALLBACK_PTR( ymf271_timer_b_tick ) +static TIMER_CALLBACK( ymf271_timer_b_tick ) { - YMF271Chip *chip = param; + YMF271Chip *chip = ptr; chip->status |= 2; @@ -1449,7 +1449,7 @@ static void ymf271_write_timer(YMF271Chip *chip, int data) //period = (double)(256.0 - chip->timerAVal ) * ( 384.0 * 4.0 / (double)CLOCK); period = attotime_mul(ATTOTIME_IN_HZ(chip->clock), 384 * (1024 - chip->timerAVal)); - timer_adjust_ptr(chip->timA, period, period); + timer_adjust(chip->timA, period, 0, period); } if (data & 0x20) { // timer B reset @@ -1460,7 +1460,7 @@ static void ymf271_write_timer(YMF271Chip *chip, int data) period = attotime_mul(ATTOTIME_IN_HZ(chip->clock), 384 * 16 * (256 - chip->timerBVal)); - timer_adjust_ptr(chip->timB, period, period); + timer_adjust(chip->timB, period, 0, period); } break; @@ -1719,8 +1719,8 @@ static void init_state(YMF271Chip *chip) static void ymf271_init(YMF271Chip *chip, UINT8 *rom, void (*cb)(int), read8_handler ext_read, write8_handler ext_write) { - chip->timA = timer_alloc_ptr(ymf271_timer_a_tick, chip); - chip->timB = timer_alloc_ptr(ymf271_timer_b_tick, chip); + chip->timA = timer_alloc(ymf271_timer_a_tick, chip); + chip->timB = timer_alloc(ymf271_timer_b_tick, chip); chip->rom = rom; chip->irq_callback = cb; diff --git a/src/emu/sound/ymf278b.c b/src/emu/sound/ymf278b.c index a8ef72015f4..25abb08cbf1 100644 --- a/src/emu/sound/ymf278b.c +++ b/src/emu/sound/ymf278b.c @@ -352,9 +352,9 @@ static void ymf278b_irq_check(YMF278BChip *chip) chip->irq_callback(chip->irq_line); } -static TIMER_CALLBACK_PTR( ymf278b_timer_a_tick ) +static TIMER_CALLBACK( ymf278b_timer_a_tick ) { - YMF278BChip *chip = param; + YMF278BChip *chip = ptr; if(!(chip->enable & 0x40)) { chip->current_irq |= 0x40; @@ -362,9 +362,9 @@ static TIMER_CALLBACK_PTR( ymf278b_timer_a_tick ) } } -static TIMER_CALLBACK_PTR( ymf278b_timer_b_tick ) +static TIMER_CALLBACK( ymf278b_timer_b_tick ) { - YMF278BChip *chip = param; + YMF278BChip *chip = ptr; if(!(chip->enable & 0x20)) { chip->current_irq |= 0x20; @@ -381,10 +381,10 @@ static void ymf278b_timer_a_reset(YMF278BChip *chip) if (chip->clock != YMF278B_STD_CLOCK) period = attotime_div(attotime_mul(period, chip->clock), YMF278B_STD_CLOCK); - timer_adjust_ptr(chip->timer_a, period, period); + timer_adjust(chip->timer_a, period, 0, period); } else - timer_adjust_ptr(chip->timer_a, attotime_never, attotime_zero); + timer_adjust(chip->timer_a, attotime_never, 0, attotime_zero); } static void ymf278b_timer_b_reset(YMF278BChip *chip) @@ -396,10 +396,10 @@ static void ymf278b_timer_b_reset(YMF278BChip *chip) if (chip->clock != YMF278B_STD_CLOCK) period = attotime_div(attotime_mul(period, chip->clock), YMF278B_STD_CLOCK); - timer_adjust_ptr(chip->timer_a, period, period); + timer_adjust(chip->timer_a, period, 0, period); } else - timer_adjust_ptr(chip->timer_b, attotime_never, attotime_zero); + timer_adjust(chip->timer_b, attotime_never, 0, attotime_zero); } static void ymf278b_A_w(YMF278BChip *chip, UINT8 reg, UINT8 data) @@ -670,8 +670,8 @@ static void ymf278b_init(YMF278BChip *chip, UINT8 *rom, void (*cb)(int), int clo { chip->rom = rom; chip->irq_callback = cb; - chip->timer_a = timer_alloc_ptr(ymf278b_timer_a_tick, chip); - chip->timer_b = timer_alloc_ptr(ymf278b_timer_b_tick, chip); + chip->timer_a = timer_alloc(ymf278b_timer_a_tick, chip); + chip->timer_b = timer_alloc(ymf278b_timer_b_tick, chip); chip->irq_line = CLEAR_LINE; chip->clock = clock; diff --git a/src/emu/sound/ymz280b.c b/src/emu/sound/ymz280b.c index e27edd8ca4e..3af8405b342 100644 --- a/src/emu/sound/ymz280b.c +++ b/src/emu/sound/ymz280b.c @@ -108,16 +108,16 @@ static const int index_scale[8] = { 0x0e6, 0x0e6, 0x0e6, 0x0e6, 0x133, 0x199, 0x static int diff_lookup[16]; /* timer callback */ -static TIMER_CALLBACK_PTR( update_irq_state_timer_0 ); -static TIMER_CALLBACK_PTR( update_irq_state_timer_1 ); -static TIMER_CALLBACK_PTR( update_irq_state_timer_2 ); -static TIMER_CALLBACK_PTR( update_irq_state_timer_3 ); -static TIMER_CALLBACK_PTR( update_irq_state_timer_4 ); -static TIMER_CALLBACK_PTR( update_irq_state_timer_5 ); -static TIMER_CALLBACK_PTR( update_irq_state_timer_6 ); -static TIMER_CALLBACK_PTR( update_irq_state_timer_7 ); - -static void (*update_irq_state_cb[])(running_machine *, void *) = +static TIMER_CALLBACK( update_irq_state_timer_0 ); +static TIMER_CALLBACK( update_irq_state_timer_1 ); +static TIMER_CALLBACK( update_irq_state_timer_2 ); +static TIMER_CALLBACK( update_irq_state_timer_3 ); +static TIMER_CALLBACK( update_irq_state_timer_4 ); +static TIMER_CALLBACK( update_irq_state_timer_5 ); +static TIMER_CALLBACK( update_irq_state_timer_6 ); +static TIMER_CALLBACK( update_irq_state_timer_7 ); + +static timer_callback update_irq_state_cb[] = { update_irq_state_timer_0, update_irq_state_timer_1, @@ -199,7 +199,7 @@ static void YMZ280B_state_save_update_step(void *param) struct YMZ280BVoice *voice = &chip->voice[j]; update_step(chip, voice); if(voice->irq_schedule) - timer_set_ptr(attotime_zero, chip, update_irq_state_cb[j]); + timer_set(attotime_zero, chip, 0, update_irq_state_cb[j]); } } @@ -217,14 +217,14 @@ static void update_irq_state_timer_common(void *param, int voicenum) voice->irq_schedule = 0; } -static TIMER_CALLBACK_PTR( update_irq_state_timer_0 ) { update_irq_state_timer_common(param, 0); } -static TIMER_CALLBACK_PTR( update_irq_state_timer_1 ) { update_irq_state_timer_common(param, 1); } -static TIMER_CALLBACK_PTR( update_irq_state_timer_2 ) { update_irq_state_timer_common(param, 2); } -static TIMER_CALLBACK_PTR( update_irq_state_timer_3 ) { update_irq_state_timer_common(param, 3); } -static TIMER_CALLBACK_PTR( update_irq_state_timer_4 ) { update_irq_state_timer_common(param, 4); } -static TIMER_CALLBACK_PTR( update_irq_state_timer_5 ) { update_irq_state_timer_common(param, 5); } -static TIMER_CALLBACK_PTR( update_irq_state_timer_6 ) { update_irq_state_timer_common(param, 6); } -static TIMER_CALLBACK_PTR( update_irq_state_timer_7 ) { update_irq_state_timer_common(param, 7); } +static TIMER_CALLBACK( update_irq_state_timer_0 ) { update_irq_state_timer_common(ptr, 0); } +static TIMER_CALLBACK( update_irq_state_timer_1 ) { update_irq_state_timer_common(ptr, 1); } +static TIMER_CALLBACK( update_irq_state_timer_2 ) { update_irq_state_timer_common(ptr, 2); } +static TIMER_CALLBACK( update_irq_state_timer_3 ) { update_irq_state_timer_common(ptr, 3); } +static TIMER_CALLBACK( update_irq_state_timer_4 ) { update_irq_state_timer_common(ptr, 4); } +static TIMER_CALLBACK( update_irq_state_timer_5 ) { update_irq_state_timer_common(ptr, 5); } +static TIMER_CALLBACK( update_irq_state_timer_6 ) { update_irq_state_timer_common(ptr, 6); } +static TIMER_CALLBACK( update_irq_state_timer_7 ) { update_irq_state_timer_common(ptr, 7); } /********************************************************************************************** @@ -575,7 +575,7 @@ static void ymz280b_update(void *param, stream_sample_t **inputs, stream_sample_ voice->playing = 0; /* set update_irq_state_timer. IRQ is signaled on next CPU execution. */ - timer_set_ptr(attotime_zero, chip, update_irq_state_cb[v]); + timer_set(attotime_zero, chip, 0, update_irq_state_cb[v]); voice->irq_schedule = 1; } } diff --git a/src/emu/timer.c b/src/emu/timer.c index cd1b4fe3eb1..3cd4abb5008 100644 --- a/src/emu/timer.c +++ b/src/emu/timer.c @@ -45,18 +45,16 @@ /* in timer.h: typedef struct _emu_timer emu_timer; */ struct _emu_timer { - emu_timer * next; - emu_timer * prev; - void (*callback)(running_machine *, int); - void (*callback_ptr)(running_machine *, void *); - int callback_param; - void * callback_ptr_param; + emu_timer * next; + emu_timer * prev; + timer_callback callback; + INT32 param; + void * ptr; const char * file; int line; const char * func; UINT8 enabled; UINT8 temporary; - UINT8 ptr; attotime period; attotime start; attotime expire; @@ -324,22 +322,12 @@ void timer_set_global_time(attotime newbase) callback_timer_expire_time = timer->expire; /* call the callback */ - if (was_enabled) + if (was_enabled && timer->callback != NULL) { - if (!timer->ptr && timer->callback) - { - LOG(("Timer %s:%d[%s] fired (expire=%s)\n", timer->file, timer->line, timer->func, attotime_string(timer->expire, 9))); - profiler_mark(PROFILER_TIMER_CALLBACK); - (*timer->callback)(Machine, timer->callback_param); - profiler_mark(PROFILER_END); - } - else if (timer->ptr && timer->callback_ptr) - { - LOG(("Timer %s:%d[%s] fired (expire=%s)\n", timer->file, timer->line, timer->func, attotime_string(timer->expire, 9))); - profiler_mark(PROFILER_TIMER_CALLBACK); - (*timer->callback_ptr)(Machine, timer->callback_ptr_param); - profiler_mark(PROFILER_END); - } + LOG(("Timer %s:%d[%s] fired (expire=%s)\n", timer->file, timer->line, timer->func, attotime_string(timer->expire, 9))); + profiler_mark(PROFILER_TIMER_CALLBACK); + (*timer->callback)(Machine, timer->ptr, timer->param); + profiler_mark(PROFILER_END); } /* clear the callback timer global */ @@ -392,7 +380,7 @@ static void timer_register_save(emu_timer *timer) /* use different instances to differentiate the bits */ state_save_push_tag(0); - state_save_register_item(buf, count, timer->callback_param); + state_save_register_item(buf, count, timer->param); state_save_register_item(buf, count, timer->enabled); state_save_register_item(buf, count, timer->period.seconds); state_save_register_item(buf, count, timer->period.attoseconds); @@ -414,7 +402,7 @@ static void timer_postload(void) emu_timer *t; /* remove all timers and make a private list */ - while (timer_head) + while (timer_head != NULL) { t = timer_head; @@ -432,7 +420,7 @@ static void timer_postload(void) } /* now add them all back in; this effectively re-sorts them by time */ - while (privlist) + while (privlist != NULL) { t = privlist; privlist = t->next; @@ -474,19 +462,17 @@ int timer_count_anonymous(void) isn't primed yet -------------------------------------------------*/ -INLINE emu_timer *_timer_alloc_common(void (*callback)(running_machine *, int), void (*callback_ptr)(running_machine *, void *), void *param, const char *file, int line, const char *func, int temp) +INLINE emu_timer *_timer_alloc_common(timer_callback callback, void *ptr, const char *file, int line, const char *func, int temp) { attotime time = get_current_time(); emu_timer *timer = timer_new(); /* fill in the record */ timer->callback = callback; - timer->callback_ptr = callback_ptr; - timer->callback_param = 0; - timer->callback_ptr_param = param; + timer->ptr = ptr; + timer->param = 0; timer->enabled = FALSE; timer->temporary = temp; - timer->ptr = (callback_ptr != NULL); timer->period = attotime_zero; timer->file = file; timer->line = line; @@ -508,14 +494,9 @@ INLINE emu_timer *_timer_alloc_common(void (*callback)(running_machine *, int), return timer; } -emu_timer *_timer_alloc(void (*callback)(running_machine *, int), const char *file, int line, const char *func) -{ - return _timer_alloc_common(callback, NULL, NULL, file, line, func, FALSE); -} - -emu_timer *_timer_alloc_ptr(void (*callback_ptr)(running_machine *, void *), void *param, const char *file, int line, const char *func) +emu_timer *_timer_alloc_internal(timer_callback callback, void *ptr, const char *file, int line, const char *func) { - return _timer_alloc_common(NULL, callback_ptr, param, file, line, func, FALSE); + return _timer_alloc_common(callback, ptr, file, line, func, FALSE); } @@ -554,7 +535,7 @@ static void timer_remove(emu_timer *which) fire periodically -------------------------------------------------*/ -INLINE void timer_adjust_common(emu_timer *which, attotime duration, INT32 param, attotime period) +void timer_adjust(emu_timer *which, attotime duration, INT32 param, attotime period) { attotime time = get_current_time(); @@ -563,7 +544,7 @@ INLINE void timer_adjust_common(emu_timer *which, attotime duration, INT32 param callback_timer_modified = TRUE; /* compute the time of the next firing and insert into the list */ - which->callback_param = param; + which->param = param; which->enabled = TRUE; /* clamp negative times to 0 */ @@ -585,20 +566,6 @@ INLINE void timer_adjust_common(emu_timer *which, attotime duration, INT32 param activecpu_abort_timeslice(); } -void timer_adjust(emu_timer *which, attotime duration, INT32 param, attotime period) -{ - if (which->ptr) - fatalerror("timer_adjust called on a ptr timer!"); - timer_adjust_common(which, duration, param, period); -} - -void timer_adjust_ptr(emu_timer *which, attotime duration, attotime period) -{ - if (!which->ptr) - fatalerror("timer_adjust_ptr called on a non-ptr timer!"); - timer_adjust_common(which, duration, 0, period); -} - /*************************************************************************** @@ -611,44 +578,24 @@ void timer_adjust_ptr(emu_timer *which, attotime duration, attotime period) period -------------------------------------------------*/ -void _timer_pulse(attotime period, INT32 param, void (*callback)(running_machine *, int), const char *file, int line, const char *func) +void _timer_pulse_internal(attotime period, void *ptr, INT32 param, timer_callback callback, const char *file, int line, const char *func) { - emu_timer *timer = _timer_alloc_common(callback, NULL, NULL, file, line, func, FALSE); - - /* adjust to our liking */ + emu_timer *timer = _timer_alloc_common(callback, ptr, file, line, func, FALSE); timer_adjust(timer, period, param, period); } -void _timer_pulse_ptr(attotime period, void *param, void (*callback)(running_machine *, void *), const char *file, int line, const char *func) -{ - emu_timer *timer = _timer_alloc_common(NULL, callback, param, file, line, func, FALSE); - - /* adjust to our liking */ - timer_adjust_ptr(timer, period, period); -} - /*------------------------------------------------- timer_set - allocate a one-shot timer, which calls the callback after the given duration -------------------------------------------------*/ -void _timer_set(attotime duration, INT32 param, void (*callback)(running_machine *, int), const char *file, int line, const char *func) +void _timer_set_internal(attotime duration, void *ptr, INT32 param, timer_callback callback, const char *file, int line, const char *func) { - emu_timer *timer = _timer_alloc_common(callback, NULL, NULL, file, line, func, TRUE); - - /* adjust to our liking */ + emu_timer *timer = _timer_alloc_common(callback, ptr, file, line, func, TRUE); timer_adjust(timer, duration, param, attotime_zero); } -void _timer_set_ptr(attotime duration, void *param, void (*callback)(running_machine *, void *), const char *file, int line, const char *func) -{ - emu_timer *timer = _timer_alloc_common(NULL, callback, param, file, line, func, TRUE); - - /* adjust to our liking */ - timer_adjust_ptr(timer, duration, attotime_zero); -} - /*************************************************************************** @@ -661,11 +608,7 @@ void _timer_set_ptr(attotime duration, void *param, void (*callback)(running_mac void timer_reset(emu_timer *which, attotime duration) { - /* adjust the timer */ - if (!which->ptr) - timer_adjust(which, duration, which->callback_param, which->period); - else - timer_adjust_ptr(which, duration, which->period); + timer_adjust(which, duration, which->param, which->period); } @@ -708,13 +651,13 @@ int timer_enabled(emu_timer *which) int timer_get_param(emu_timer *which) { - return which->callback_param; + return which->param; } void *timer_get_param_ptr(emu_timer *which) { - return which->callback_ptr_param; + return which->ptr; } diff --git a/src/emu/timer.h b/src/emu/timer.h index e8193b4b170..afc25da583d 100644 --- a/src/emu/timer.h +++ b/src/emu/timer.h @@ -37,16 +37,13 @@ #define PERIOD_OF_555_ASTABLE(r1,r2,c) ATTOTIME_IN_NSEC((attoseconds_t)( 693000000 * ((double)(r1) + 2.0 * (double)(r2)) * (double)(c))) /* macros that map all allocations to provide file/line/functions to the callee */ -#define timer_alloc(c) _timer_alloc(c, __FILE__, __LINE__, #c) -#define timer_alloc_ptr(c,p) _timer_alloc_ptr(c, p, __FILE__, __LINE__, #c) -#define timer_pulse(e,p,c) _timer_pulse(e, p, c, __FILE__, __LINE__, #c) -#define timer_pulse_ptr(e,p,c) _timer_pulse_ptr(e, p, c, __FILE__, __LINE__, #c) -#define timer_set(d,p,c) _timer_set(d, p, c, __FILE__, __LINE__, #c) -#define timer_set_ptr(d,p,c) _timer_set_ptr(d, p, c, __FILE__, __LINE__, #c) +#define timer_alloc(c,ptr) _timer_alloc_internal(c, ptr, __FILE__, __LINE__, #c) +#define timer_pulse(e,ptr,p,c) _timer_pulse_internal(e, ptr, p, c, __FILE__, __LINE__, #c) +#define timer_set(d,ptr,p,c) _timer_set_internal(d, ptr, p, c, __FILE__, __LINE__, #c) +#define timer_call_after_resynch(ptr,p,c) _timer_set_internal(attotime_zero, ptr, p, c, __FILE__, __LINE__, #c) /* macros for a timer callback functions */ -#define TIMER_CALLBACK(name) void name(running_machine *machine, int param) -#define TIMER_CALLBACK_PTR(name) void name(running_machine *machine, void *param) +#define TIMER_CALLBACK(name) void name(running_machine *machine, void *ptr, int param) @@ -54,6 +51,9 @@ TYPE DEFINITIONS ***************************************************************************/ +/* a timer callback looks like this */ +typedef void (*timer_callback)(running_machine *machine, void *ptr, INT32 param); + /* opaque type for representing a timer */ typedef struct _emu_timer emu_timer; @@ -104,24 +104,20 @@ int timer_count_anonymous(void); /* ----- core timer management ----- */ /* allocate a permament timer that isn't primed yet */ -emu_timer *_timer_alloc(void (*callback)(running_machine *, int), const char *file, int line, const char *func); -emu_timer *_timer_alloc_ptr(void (*callback)(running_machine *, void *), void *param, const char *file, int line, const char *func); +emu_timer *_timer_alloc_internal(timer_callback callback, void *param, const char *file, int line, const char *func); /* adjust the time when this timer will fire, and whether or not it will fire periodically */ void timer_adjust(emu_timer *which, attotime duration, INT32 param, attotime period); -void timer_adjust_ptr(emu_timer *which, attotime duration, attotime period); /* ----- anonymous timer management ----- */ -/* allocate a pulse timer, which repeatedly calls the callback using the given period */ -void _timer_pulse(attotime period, INT32 param, void (*callback)(running_machine *, int), const char *file, int line, const char *func); -void _timer_pulse_ptr(attotime period, void *param, void (*callback)(running_machine *, void *), const char *file, int line, const char *func); - /* allocate a one-shot timer, which calls the callback after the given duration */ -void _timer_set(attotime duration, INT32 param, void (*callback)(running_machine *, int), const char *file, int line, const char *func); -void _timer_set_ptr(attotime duration, void *param, void (*callback)(running_machine *, void *), const char *file, int line, const char *func); +void _timer_set_internal(attotime druation, void *ptr, INT32 param, timer_callback callback, const char *file, int line, const char *func); + +/* allocate a pulse timer, which repeatedly calls the callback using the given period */ +void _timer_pulse_internal(attotime period, void *ptr, INT32 param, timer_callback callback, const char *file, int line, const char *func); @@ -160,26 +156,4 @@ attotime timer_starttime(emu_timer *which); attotime timer_firetime(emu_timer *which); - - -/*************************************************************************** - INLINE FUNCTIONS -***************************************************************************/ - -/*------------------------------------------------- - timer_call_after_resynch - synchs the CPUs - and calls the callback immediately --------------------------------------------------*/ - -INLINE void timer_call_after_resynch(INT32 param, void (*callback)(running_machine *, int)) -{ - timer_set(attotime_zero, param, callback); -} - -INLINE void timer_call_after_resynch_ptr(void *param, void (*callback)(running_machine *, void *)) -{ - timer_set_ptr(attotime_zero, param, callback); -} - - #endif /* __TIMER_H__ */ diff --git a/src/emu/ui.c b/src/emu/ui.c index 4267422f0f7..adbef791c1c 100644 --- a/src/emu/ui.c +++ b/src/emu/ui.c @@ -367,11 +367,11 @@ int ui_display_startup_screens(int first_time, int show_disclaimer) /* loop while we have a handler */ while (ui_handler_callback != handler_ingame && !mame_is_scheduled_event_pending(Machine) && !ui_menu_is_force_game_select()) - video_frame_update(); + video_frame_update(FALSE); /* clear the handler and force an update */ ui_set_handler(handler_ingame, 0); - video_frame_update(); + video_frame_update(FALSE); } /* if we're the empty driver, force the menus on */ @@ -400,7 +400,7 @@ void ui_set_startup_text(const char *text, int force) if (force || (curtime - lastupdatetime) > osd_ticks_per_second() / 4) { lastupdatetime = curtime; - video_frame_update(); + video_frame_update(FALSE); } } diff --git a/src/emu/uimenu.c b/src/emu/uimenu.c index b33f3e6eecd..4f1aeaf7e0d 100644 --- a/src/emu/uimenu.c +++ b/src/emu/uimenu.c @@ -229,8 +229,8 @@ INLINE int get_num_dips(void) { int num = 0; - while (dip_switch_model[num].dip_name != NULL && num++ < MAX_PHYSICAL_DIPS) - ; + while (dip_switch_model[num].dip_name != NULL && num < MAX_PHYSICAL_DIPS) + num++; return num; } diff --git a/src/emu/video.c b/src/emu/video.c index d7c98cda799..f89b961ed89 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -300,7 +300,7 @@ void video_init(running_machine *machine) internal_screen_info *info = &viddata->scrinfo[scrnum]; /* allocate a timer to reset partial updates */ - info->scanline0_timer = timer_alloc(scanline0_callback); + info->scanline0_timer = timer_alloc(scanline0_callback, NULL); /* make pointers back to the config and state */ info->config = &machine->drv->screen[scrnum]; @@ -1016,7 +1016,7 @@ static TIMER_CALLBACK( scanline0_callback ) operations -------------------------------------------------*/ -void video_frame_update(void) +void video_frame_update(int debug) { attotime current_time = timer_get_time(); int skipped_it = global.skipping_this_frame; @@ -1026,7 +1026,7 @@ void video_frame_update(void) #ifdef MAME_DEBUG if (phase == MAME_PHASE_RUNNING) #else - if (phase == MAME_PHASE_RUNNING && !mame_is_paused(Machine)) + if (phase == MAME_PHASE_RUNNING && (debug || !mame_is_paused(Machine))) #endif { int anything_changed = finish_screen_updates(Machine); @@ -1044,30 +1044,32 @@ void video_frame_update(void) ui_update_and_render(); /* if we're throttling, synchronize before rendering */ - if (!skipped_it && effective_throttle()) + if (!debug && !skipped_it && effective_throttle()) update_throttle(current_time); /* ask the OSD to update */ profiler_mark(PROFILER_BLIT); - osd_update(skipped_it); + osd_update(!debug && skipped_it); profiler_mark(PROFILER_END); /* perform tasks for this frame */ - mame_frame_update(Machine); + if (!debug) + mame_frame_update(Machine); /* update frameskipping */ - update_frameskip(); + if (!debug) + update_frameskip(); /* update speed computations */ - if (!skipped_it) + if (!debug && !skipped_it) recompute_speed(current_time); /* call the end-of-frame callback */ if (phase == MAME_PHASE_RUNNING) { /* reset partial updates if we're paused or if the debugger is active */ - if (video_screen_exists(0) && (mame_is_paused(Machine) || mame_debug_is_active())) - scanline0_callback(Machine, 0); + if (video_screen_exists(0) && (mame_is_paused(Machine) || debug || mame_debug_is_active())) + scanline0_callback(Machine, NULL, 0); /* otherwise, call the video EOF callback */ else if (Machine->drv->video_eof != NULL) diff --git a/src/emu/video.h b/src/emu/video.h index da602318588..7f031bd49ee 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -117,7 +117,7 @@ int video_screen_exists(int scrnum); /* ----- global rendering ----- */ /* update the screen, handling frame skipping and rendering */ -void video_frame_update(void); +void video_frame_update(int debug); /* ----- throttling/frameskipping/performance ----- */ diff --git a/src/emu/video/crtc6845.c b/src/emu/video/crtc6845.c index 69040b0b892..34eb9bcc78d 100644 --- a/src/emu/video/crtc6845.c +++ b/src/emu/video/crtc6845.c @@ -54,7 +54,7 @@ static crtc6845_state crtc6845; static void crtc6845_state_save_postload(void *param); static void configure_screen(crtc6845_state *chip, int postload); static void update_timer(crtc6845_state *chip); -static TIMER_CALLBACK_PTR( display_enable_changed_timer_cb ); +static TIMER_CALLBACK( display_enable_changed_timer_cb ); void crtc6845_init(void) @@ -98,7 +98,7 @@ void crtc6845_config(int which, const crtc6845_interface *intf) /* create the timer if the user is interested in getting display enable notifications */ if (intf->display_enable_changed) - chip->display_enable_changed_timer = timer_alloc_ptr(display_enable_changed_timer_cb, chip); + chip->display_enable_changed_timer = timer_alloc(display_enable_changed_timer_cb, chip); } @@ -334,14 +334,14 @@ static void update_timer(crtc6845_state *chip) else duration = attotime_never; - timer_adjust_ptr(chip->display_enable_changed_timer, duration, attotime_never); + timer_adjust(chip->display_enable_changed_timer, duration, 0, attotime_never); } } -static TIMER_CALLBACK_PTR( display_enable_changed_timer_cb ) +static TIMER_CALLBACK( display_enable_changed_timer_cb ) { - crtc6845_state *chip = param; + crtc6845_state *chip = ptr; /* call the callback function -- we know it exists */ chip->intf->display_enable_changed(is_display_enabled(chip)); diff --git a/src/emu/video/rgbvmx.h b/src/emu/video/rgbvmx.h index bb215d1966a..cab5ac26034 100644 --- a/src/emu/video/rgbvmx.h +++ b/src/emu/video/rgbvmx.h @@ -12,7 +12,9 @@ #ifndef __RGBVMX__ #define __RGBVMX__ +#ifndef __APPLE_ALTIVEC__ #include <altivec.h> +#endif /*************************************************************************** diff --git a/src/emu/video/tms34061.c b/src/emu/video/tms34061.c index 49d20d31da2..f601842cd1d 100644 --- a/src/emu/video/tms34061.c +++ b/src/emu/video/tms34061.c @@ -117,7 +117,7 @@ void tms34061_start(struct tms34061_interface *interface) tms34061.regs[TMS34061_VERCOUNTER] = 0x0000; /* start vertical interrupt timer */ - tms34061.timer = timer_alloc(tms34061_interrupt); + tms34061.timer = timer_alloc(tms34061_interrupt, NULL); } diff --git a/src/emu/video/voodoo.c b/src/emu/video/voodoo.c index 4ff1e60257e..342878ca4b7 100644 --- a/src/emu/video/voodoo.c +++ b/src/emu/video/voodoo.c @@ -199,9 +199,9 @@ static void init_tmu(voodoo_state *v, tmu_state *t, int type, voodoo_reg *reg, v static void soft_reset(voodoo_state *v); static void check_stalled_cpu(voodoo_state *v, attotime current_time); static void flush_fifos(voodoo_state *v, attotime current_time); -static TIMER_CALLBACK_PTR( stall_cpu_callback ); +static TIMER_CALLBACK( stall_cpu_callback ); static void stall_cpu(voodoo_state *v, int state, attotime current_time); -static TIMER_CALLBACK_PTR( vblank_callback ); +static TIMER_CALLBACK( vblank_callback ); static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data); static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask, int forcefront); static INT32 texture_w(voodoo_state *v, offs_t offset, UINT32 data); @@ -380,7 +380,7 @@ void voodoo_start(int which, int scrnum, int type, int fbmem_in_mb, int tmem0_in v->pci.fifo.size = 64*2; v->pci.fifo.in = v->pci.fifo.out = 0; v->pci.stall_state = NOT_STALLED; - v->pci.continue_timer = timer_alloc_ptr(stall_cpu_callback, v); + v->pci.continue_timer = timer_alloc(stall_cpu_callback, v); /* allocate memory */ if (type <= VOODOO_2) @@ -803,7 +803,7 @@ static void init_fbi(voodoo_state *v, fbi_state *f, void *memory, int fbmem) } /* allocate a VBLANK timer */ - f->vblank_timer = timer_alloc_ptr(vblank_callback, v); + f->vblank_timer = timer_alloc(vblank_callback, v); f->vblank = FALSE; /* initialize the memory FIFO */ @@ -1087,13 +1087,13 @@ static void adjust_vblank_timer(voodoo_state *v) /* if zero, adjust to next frame, otherwise we may get stuck in an infinite loop */ if (attotime_compare(vblank_period, attotime_zero) == 0) vblank_period = video_screen_get_frame_period(v->scrnum); - timer_adjust_ptr(v->fbi.vblank_timer, vblank_period, attotime_never); + timer_adjust(v->fbi.vblank_timer, vblank_period, 0, attotime_never); } -static TIMER_CALLBACK_PTR( vblank_off_callback ) +static TIMER_CALLBACK( vblank_off_callback ) { - voodoo_state *v = param; + voodoo_state *v = ptr; if (LOG_VBLANK_SWAP) logerror("--- vblank end\n"); @@ -1107,9 +1107,9 @@ static TIMER_CALLBACK_PTR( vblank_off_callback ) } -static TIMER_CALLBACK_PTR( vblank_callback ) +static TIMER_CALLBACK( vblank_callback ) { - voodoo_state *v = param; + voodoo_state *v = ptr; if (LOG_VBLANK_SWAP) logerror("--- vblank start\n"); @@ -1135,7 +1135,7 @@ static TIMER_CALLBACK_PTR( vblank_callback ) swap_buffers(v); /* set a timer for the next off state */ - timer_set_ptr(video_screen_get_time_until_pos(v->scrnum, 0, 0), v, vblank_off_callback); + timer_set(video_screen_get_time_until_pos(v->scrnum, 0, 0), v, 0, vblank_off_callback); /* set internal state and call the client */ v->fbi.vblank = TRUE; @@ -2139,9 +2139,9 @@ static void cmdfifo_w(voodoo_state *v, cmdfifo_info *f, offs_t offset, UINT32 da * *************************************/ -static TIMER_CALLBACK_PTR( stall_cpu_callback ) +static TIMER_CALLBACK( stall_cpu_callback ) { - check_stalled_cpu(param, timer_get_time()); + check_stalled_cpu(ptr, timer_get_time()); } @@ -2194,7 +2194,7 @@ static void check_stalled_cpu(voodoo_state *v, attotime current_time) /* if not, set a timer for the next one */ else { - timer_adjust_ptr(v->pci.continue_timer, attotime_sub(v->pci.op_end_time, current_time), attotime_never); + timer_adjust(v->pci.continue_timer, attotime_sub(v->pci.op_end_time, current_time), 0, attotime_never); } } @@ -2215,7 +2215,7 @@ static void stall_cpu(voodoo_state *v, int state, attotime current_time) cpu_spinuntil_trigger(v->trigger); /* set a timer to clear the stall */ - timer_adjust_ptr(v->pci.continue_timer, attotime_sub(v->pci.op_end_time, current_time), attotime_never); + timer_adjust(v->pci.continue_timer, attotime_sub(v->pci.op_end_time, current_time), 0, attotime_never); } |