diff options
author | Aaron Giles <aaron@aarongiles.com> | 2007-12-17 16:33:33 +0000 |
---|---|---|
committer | Aaron Giles <aaron@aarongiles.com> | 2007-12-17 16:33:33 +0000 |
commit | 8a8ccc594989d85f2277c48d3c158f7cee41d06b (patch) | |
tree | 821ddcb66109a2340909394308a4b348d4cb2a53 /src/emu | |
parent | 7b77f1218624ea26dbb2efd85a19f795f5d4e02e (diff) |
Changes for MAME 0.121u1.mame0121u1
Diffstat (limited to 'src/emu')
68 files changed, 3392 insertions, 1476 deletions
diff --git a/src/emu/attotime.c b/src/emu/attotime.c index 41bde38fd47..bb24ce57340 100644 --- a/src/emu/attotime.c +++ b/src/emu/attotime.c @@ -179,8 +179,8 @@ attotime attotime_sub_attoseconds(attotime _time1, attoseconds_t _attoseconds) attotime attotime_mul(attotime _time1, UINT32 factor) { - INT32 attolo, attohi, reslo, reshi; - INT64 temp; + UINT32 attolo, attohi, reslo, reshi; + UINT64 temp; /* if one of the items is attotime_never, return attotime_never */ if (_time1.seconds >= ATTOTIME_MAX_SECONDS) @@ -191,18 +191,18 @@ attotime attotime_mul(attotime _time1, UINT32 factor) return attotime_zero; /* split attoseconds into upper and lower halves which fit into 32 bits */ - attohi = div_64x32_rem(_time1.attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &attolo); + attohi = divu_64x32_rem(_time1.attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &attolo); /* scale the lower half, then split into high/low parts */ - temp = mul_32x32(attolo, factor); - temp = div_64x32_rem(temp, ATTOSECONDS_PER_SECOND_SQRT, &reslo); + temp = mulu_32x32(attolo, factor); + temp = divu_64x32_rem(temp, ATTOSECONDS_PER_SECOND_SQRT, &reslo); /* scale the upper half, then split into high/low parts */ - temp += mul_32x32(attohi, factor); - temp = div_64x32_rem(temp, ATTOSECONDS_PER_SECOND_SQRT, &reshi); + temp += mulu_32x32(attohi, factor); + temp = divu_64x32_rem(temp, ATTOSECONDS_PER_SECOND_SQRT, &reshi); /* scale the seconds */ - temp += mul_32x32(_time1.seconds, factor); + temp += mulu_32x32(_time1.seconds, factor); if (temp >= ATTOTIME_MAX_SECONDS) return attotime_never; @@ -218,9 +218,9 @@ attotime attotime_mul(attotime _time1, UINT32 factor) attotime attotime_div(attotime _time1, UINT32 factor) { - INT32 attolo, attohi, reshi, reslo, remainder; + UINT32 attolo, attohi, reshi, reslo, remainder; attotime result; - INT64 temp; + UINT64 temp; /* if one of the items is attotime_never, return attotime_never */ if (_time1.seconds >= ATTOTIME_MAX_SECONDS) @@ -231,21 +231,21 @@ attotime attotime_div(attotime _time1, UINT32 factor) return _time1; /* split attoseconds into upper and lower halves which fit into 32 bits */ - attohi = div_64x32_rem(_time1.attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &attolo); + attohi = divu_64x32_rem(_time1.attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &attolo); /* divide the seconds and get the remainder */ - result.seconds = div_64x32_rem(_time1.seconds, factor, &remainder); + result.seconds = divu_64x32_rem(_time1.seconds, factor, &remainder); /* combine the upper half of attoseconds with the remainder and divide that */ - temp = (INT64)attohi + mul_32x32(remainder, ATTOSECONDS_PER_SECOND_SQRT); - reshi = div_64x32_rem(temp, factor, &remainder); + temp = (INT64)attohi + mulu_32x32(remainder, ATTOSECONDS_PER_SECOND_SQRT); + reshi = divu_64x32_rem(temp, factor, &remainder); /* combine the lower half of attoseconds with the remainder and divide that */ - temp = attolo + mul_32x32(remainder, ATTOSECONDS_PER_SECOND_SQRT); - reslo = div_64x32_rem(temp, factor, &remainder); + temp = attolo + mulu_32x32(remainder, ATTOSECONDS_PER_SECOND_SQRT); + reslo = divu_64x32_rem(temp, factor, &remainder); /* round based on the remainder */ - result.attoseconds = (attoseconds_t)reslo + mul_32x32(reshi, ATTOSECONDS_PER_SECOND_SQRT); + result.attoseconds = (attoseconds_t)reslo + mulu_32x32(reshi, ATTOSECONDS_PER_SECOND_SQRT); if (remainder >= factor / 2) if (++result.attoseconds >= ATTOSECONDS_PER_SECOND) { @@ -297,15 +297,15 @@ const char *attotime_string(attotime _time, int precision) /* case 2: we want 9 or fewer digits of precision */ else if (precision <= 9) { - INT32 upper = _time.attoseconds / ATTOSECONDS_PER_SECOND_SQRT; + UINT32 upper = _time.attoseconds / ATTOSECONDS_PER_SECOND_SQRT; sprintf(buffer, "%d.%0*d", _time.seconds, precision, upper); } /* case 3: more than 9 digits of precision */ else { - INT32 lower; - INT32 upper = div_64x32_rem(_time.attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &lower); + UINT32 lower; + UINT32 upper = divu_64x32_rem(_time.attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &lower); sprintf(buffer, "%d.%09d%0*d", _time.seconds, upper, precision - 9, lower); } return buffer; diff --git a/src/emu/clifront.c b/src/emu/clifront.c index ad7c39a74d2..15717b824bd 100644 --- a/src/emu/clifront.c +++ b/src/emu/clifront.c @@ -67,7 +67,7 @@ static void match_roms(const char *hash, int length, int *found); COMMAND-LINE OPTIONS ***************************************************************************/ -const options_entry cli_options[] = +static const options_entry cli_options[] = { /* core commands */ { NULL, NULL, OPTION_HEADER, "CORE COMMANDS" }, diff --git a/src/emu/cpu/adsp2100/adsp2100.c b/src/emu/cpu/adsp2100/adsp2100.c index ee80da32cff..2f0680c10b1 100644 --- a/src/emu/cpu/adsp2100/adsp2100.c +++ b/src/emu/cpu/adsp2100/adsp2100.c @@ -2048,7 +2048,7 @@ static void adsp21xx_get_info(UINT32 state, cpuinfo *info) } } -void adsp21xx_load_boot_data(UINT8 *srcdata, UINT32 *dstdata) +static void adsp21xx_load_boot_data(UINT8 *srcdata, UINT32 *dstdata) { /* see how many words we need to copy */ int pagelen = (srcdata[(3)] + 1) * 8; diff --git a/src/emu/cpu/alph8201/alph8201.c b/src/emu/cpu/alph8201/alph8201.c index 53b8db87c9a..2eade343cf4 100644 --- a/src/emu/cpu/alph8201/alph8201.c +++ b/src/emu/cpu/alph8201/alph8201.c @@ -184,7 +184,7 @@ typedef struct { } s_opcode; static ALPHA8201_Regs R; -int ALPHA8201_ICount; +static int ALPHA8201_ICount; static int inst_cycles; #define intRAM R.RAM diff --git a/src/emu/cpu/cop400/cop400.h b/src/emu/cpu/cop400/cop400.h index 56b1a6012d9..27969c248ef 100644 --- a/src/emu/cpu/cop400/cop400.h +++ b/src/emu/cpu/cop400/cop400.h @@ -36,6 +36,7 @@ enum { }; extern void cop410_get_info(UINT32 state, cpuinfo *info); +extern void cop411_get_info(UINT32 state, cpuinfo *info); extern void cop420_get_info(UINT32 state, cpuinfo *info); #ifdef MAME_DEBUG diff --git a/src/emu/cpu/cp1610/cp1610.c b/src/emu/cpu/cp1610/cp1610.c index 4259b98fba9..3463bd7fa9f 100644 --- a/src/emu/cpu/cp1610/cp1610.c +++ b/src/emu/cpu/cp1610/cp1610.c @@ -1545,7 +1545,7 @@ static void cp1610_xori(int d) cp1610_icount -= 8; } -void cp1610_reset(void) +static void cp1610_reset(void) { /* This is how we set the reset vector */ cpunum_set_input_line(cpu_getactivecpu(), CP1610_RESET, PULSE_LINE); @@ -2157,7 +2157,7 @@ static void cp1610_do_jumps(void) } /* Execute cycles - returns number of cycles actually run */ -int cp1610_execute(int cycles) +static int cp1610_execute(int cycles) { UINT16 opcode; @@ -3382,7 +3382,7 @@ static void cp1610_set_context (void *src) cp1610 = *(cp1610_Regs *) src; } -void cp1610_init(int index, int clock, const void *config, int (*irqcallback)(int)) +static void cp1610_init(int index, int clock, const void *config, int (*irqcallback)(int)) { cp1610.intr_enabled = 0; cp1610.reset_pending = 0; diff --git a/src/emu/cpu/cpu.mak b/src/emu/cpu/cpu.mak index 06c86237c95..bb398a1c734 100644 --- a/src/emu/cpu/cpu.mak +++ b/src/emu/cpu/cpu.mak @@ -498,7 +498,8 @@ DBGOBJS += $(CPUOBJ)/e132xs/32xsdasm.o endif $(CPUOBJ)/e132xs/e132xs.o: $(CPUSRC)/e132xs/e132xs.c \ - $(CPUSRC)/e132xs/e132xs.h + $(CPUSRC)/e132xs/e132xs.h \ + $(CPUSRC)/e132xs/e132xsop.c diff --git a/src/emu/cpu/e132xs/e132xs.c b/src/emu/cpu/e132xs/e132xs.c index 022ebd372eb..3942942e6e6 100644 --- a/src/emu/cpu/e132xs/e132xs.c +++ b/src/emu/cpu/e132xs/e132xs.c @@ -212,9 +212,16 @@ *********************************************************************/ #include "debugger.h" +#include "eminline.h" #include "e132xs.h" #include "osd_cpu.h" +#ifdef MAME_DEBUG +#define DEBUG_PRINTF(x) do { mame_printf_debug x; } while (0) +#else +#define DEBUG_PRINTF(x) do { } while (0) +#endif + static UINT8 (*hyp_cpu_read_byte)(offs_t address); static UINT16 (*hyp_cpu_read_half_word)(offs_t address); static UINT32 (*hyp_cpu_read_word)(offs_t address); @@ -231,115 +238,6 @@ int hyp_type_16bit; static int hyperstone_ICount; -static void hyperstone_chk(void); -static void hyperstone_movd(void); -static void hyperstone_divu(void); -static void hyperstone_divs(void); -static void hyperstone_xm(void); -static void hyperstone_mask(void); -static void hyperstone_sum(void); -static void hyperstone_sums(void); -static void hyperstone_cmp(void); -static void hyperstone_mov(void); -static void hyperstone_add(void); -static void hyperstone_adds(void); -static void hyperstone_cmpb(void); -static void hyperstone_andn(void); -static void hyperstone_or(void); -static void hyperstone_xor(void); -static void hyperstone_subc(void); -static void hyperstone_not(void); -static void hyperstone_sub(void); -static void hyperstone_subs(void); -static void hyperstone_addc(void); -static void hyperstone_and(void); -static void hyperstone_neg(void); -static void hyperstone_negs(void); -static void hyperstone_cmpi(void); -static void hyperstone_movi(void); -static void hyperstone_addi(void); -static void hyperstone_addsi(void); -static void hyperstone_cmpbi(void); -static void hyperstone_andni(void); -static void hyperstone_ori(void); -static void hyperstone_xori(void); -static void hyperstone_shrdi(void); -static void hyperstone_shrd(void); -static void hyperstone_shr(void); -static void hyperstone_sardi(void); -static void hyperstone_sard(void); -static void hyperstone_sar(void); -static void hyperstone_shldi(void); -static void hyperstone_shld(void); -static void hyperstone_shl(void); -static void reserved(void); -static void hyperstone_testlz(void); -static void hyperstone_rol(void); -static void hyperstone_ldxx1(void); -static void hyperstone_ldxx2(void); -static void hyperstone_stxx1(void); -static void hyperstone_stxx2(void); -static void hyperstone_shri(void); -static void hyperstone_sari(void); -static void hyperstone_shli(void); -static void hyperstone_mulu(void); -static void hyperstone_muls(void); -static void hyperstone_set(void); -static void hyperstone_mul(void); -static void hyperstone_fadd(void); -static void hyperstone_faddd(void); -static void hyperstone_fsub(void); -static void hyperstone_fsubd(void); -static void hyperstone_fmul(void); -static void hyperstone_fmuld(void); -static void hyperstone_fdiv(void); -static void hyperstone_fdivd(void); -static void hyperstone_fcmp(void); -static void hyperstone_fcmpd(void); -static void hyperstone_fcmpu(void); -static void hyperstone_fcmpud(void); -static void hyperstone_fcvt(void); -static void hyperstone_fcvtd(void); -static void hyperstone_extend(void); -static void hyperstone_do(void); -static void hyperstone_ldwr(void); -static void hyperstone_lddr(void); -static void hyperstone_ldwp(void); -static void hyperstone_lddp(void); -static void hyperstone_stwr(void); -static void hyperstone_stdr(void); -static void hyperstone_stwp(void); -static void hyperstone_stdp(void); -static void hyperstone_dbv(void); -static void hyperstone_dbnv(void); -static void hyperstone_dbe(void); -static void hyperstone_dbne(void); -static void hyperstone_dbc(void); -static void hyperstone_dbnc(void); -static void hyperstone_dbse(void); -static void hyperstone_dbht(void); -static void hyperstone_dbn(void); -static void hyperstone_dbnn(void); -static void hyperstone_dble(void); -static void hyperstone_dbgt(void); -static void hyperstone_dbr(void); -static void hyperstone_frame(void); -static void hyperstone_call(void); -static void hyperstone_bv(void); -static void hyperstone_bnv(void); -static void hyperstone_be(void); -static void hyperstone_bne(void); -static void hyperstone_bc(void); -static void hyperstone_bnc(void); -static void hyperstone_bse(void); -static void hyperstone_bht(void); -static void hyperstone_bn(void); -static void hyperstone_bnn(void); -static void hyperstone_ble(void); -static void hyperstone_bgt(void); -static void hyperstone_br(void); -static void hyperstone_trap(void); - /* Registers */ enum @@ -417,15 +315,23 @@ typedef struct UINT16 op; // opcode UINT32 trap_entry; // entry point to get trap address - UINT8 n; - INT32 delay_timer; - int timer_clocks; + UINT8 clock_scale_mask; + UINT8 clock_scale; + UINT8 clock_cycles_1; + UINT8 clock_cycles_2; + UINT8 clock_cycles_4; + UINT8 clock_cycles_6; + + UINT64 tr_base_cycles; + UINT32 tr_base_value; + UINT32 tr_clocks_per_tick; + UINT8 timer_int_pending; + emu_timer *timer; struct _delay delay; int (*irq_callback)(int irqline); - INT32 h_clear; INT32 instruction_length; INT32 intblock; @@ -433,7 +339,7 @@ typedef struct static hyperstone_regs hyperstone; -static struct regs_decode +struct regs_decode { UINT8 src, dst; // destination and source register code UINT32 src_value; // current source register value @@ -443,39 +349,39 @@ static struct regs_decode UINT8 sub_type; // sub type opcode (for DD and X_CODE bits) union { - UINT32 u; - INT32 s; + UINT32 u; + INT32 s; } extra; // extra value such as immediate value, const, pcrel, ... - void (*set_src_register)(UINT8 reg, UINT32 data); // set local / global source register - void (*set_dst_register)(UINT8 reg, UINT32 data); // set local / global destination register - UINT8 src_is_pc; - UINT8 dst_is_pc; - UINT8 src_is_sr; - UINT8 dst_is_sr; + UINT8 src_is_local; + UINT8 dst_is_local; UINT8 same_src_dst; UINT8 same_src_dstf; UINT8 same_srcf_dst; -} current_regs; - -#define SREG current_regs.src_value -#define SREGF current_regs.next_src_value -#define DREG current_regs.dst_value -#define DREGF current_regs.next_dst_value -#define EXTRA_U current_regs.extra.u -#define EXTRA_S current_regs.extra.s - -#define SET_SREG( _data_ ) (*current_regs.set_src_register)(current_regs.src, _data_) -#define SET_SREGF( _data_ ) (*current_regs.set_src_register)(current_regs.src + 1, _data_) -#define SET_DREG( _data_ ) (*current_regs.set_dst_register)(current_regs.dst, _data_) -#define SET_DREGF( _data_ ) (*current_regs.set_dst_register)(current_regs.dst + 1, _data_) - -#define SRC_IS_PC current_regs.src_is_pc -#define DST_IS_PC current_regs.dst_is_pc -#define SRC_IS_SR current_regs.src_is_sr -#define DST_IS_SR current_regs.dst_is_sr -#define SAME_SRC_DST current_regs.same_src_dst -#define SAME_SRC_DSTF current_regs.same_src_dstf -#define SAME_SRCF_DST current_regs.same_srcf_dst + UINT16 op; +}; + +static void check_interrupts(void); + +#define SREG (decode)->src_value +#define SREGF (decode)->next_src_value +#define DREG (decode)->dst_value +#define DREGF (decode)->next_dst_value +#define EXTRA_U (decode)->extra.u +#define EXTRA_S (decode)->extra.s +#define OP (decode)->op + +#define SET_SREG( _data_ ) ((decode)->src_is_local ? set_local_register((decode)->src, _data_) : set_global_register((decode)->src, _data_)) +#define SET_SREGF( _data_ ) ((decode)->src_is_local ? set_local_register((decode)->src + 1, _data_) : set_global_register((decode)->src + 1, _data_)) +#define SET_DREG( _data_ ) ((decode)->dst_is_local ? set_local_register((decode)->dst, _data_) : set_global_register((decode)->dst, _data_)) +#define SET_DREGF( _data_ ) ((decode)->dst_is_local ? set_local_register((decode)->dst + 1, _data_) : set_global_register((decode)->dst + 1, _data_)) + +#define SRC_IS_PC (!(decode)->src_is_local && (decode)->src == PC_REGISTER) +#define DST_IS_PC (!(decode)->dst_is_local && (decode)->dst == PC_REGISTER) +#define SRC_IS_SR (!(decode)->src_is_local && (decode)->src == SR_REGISTER) +#define DST_IS_SR (!(decode)->dst_is_local && (decode)->dst == SR_REGISTER) +#define SAME_SRC_DST (decode)->same_src_dst +#define SAME_SRC_DSTF (decode)->same_src_dstf +#define SAME_SRCF_DST (decode)->same_srcf_dst #if (HAS_E116T || HAS_E116XT || HAS_E116XS || HAS_E116XSR || HAS_GMS30C2116 || HAS_GMS30C2216) static UINT32 program_read_dword_16be(offs_t address) @@ -502,74 +408,6 @@ static void io_write_dword_16be(offs_t address, UINT32 data) #endif -/* Opcodes table */ -static void (*hyperstone_op[0x100])(void) = { - hyperstone_chk, hyperstone_chk, hyperstone_chk, hyperstone_chk, /* CHK - CHKZ - NOP */ - hyperstone_movd, hyperstone_movd, hyperstone_movd, hyperstone_movd, /* MOVD - RET */ - hyperstone_divu, hyperstone_divu, hyperstone_divu, hyperstone_divu, /* DIVU */ - hyperstone_divs, hyperstone_divs, hyperstone_divs, hyperstone_divs, /* DIVS */ - hyperstone_xm, hyperstone_xm, hyperstone_xm, hyperstone_xm, /* XMx - XXx */ - hyperstone_mask, hyperstone_mask, hyperstone_mask, hyperstone_mask, /* MASK */ - hyperstone_sum, hyperstone_sum, hyperstone_sum, hyperstone_sum, /* SUM */ - hyperstone_sums, hyperstone_sums, hyperstone_sums, hyperstone_sums, /* SUMS */ - hyperstone_cmp, hyperstone_cmp, hyperstone_cmp, hyperstone_cmp, /* CMP */ - hyperstone_mov, hyperstone_mov, hyperstone_mov, hyperstone_mov, /* MOV */ - hyperstone_add, hyperstone_add, hyperstone_add, hyperstone_add, /* ADD */ - hyperstone_adds, hyperstone_adds, hyperstone_adds, hyperstone_adds, /* ADDS */ - hyperstone_cmpb, hyperstone_cmpb, hyperstone_cmpb, hyperstone_cmpb, /* CMPB */ - hyperstone_andn, hyperstone_andn, hyperstone_andn, hyperstone_andn, /* ANDN */ - hyperstone_or, hyperstone_or, hyperstone_or, hyperstone_or, /* OR */ - hyperstone_xor, hyperstone_xor, hyperstone_xor, hyperstone_xor, /* XOR */ - hyperstone_subc, hyperstone_subc, hyperstone_subc, hyperstone_subc, /* SUBC */ - hyperstone_not, hyperstone_not, hyperstone_not, hyperstone_not, /* NOT */ - hyperstone_sub, hyperstone_sub, hyperstone_sub, hyperstone_sub, /* SUB */ - hyperstone_subs, hyperstone_subs, hyperstone_subs, hyperstone_subs, /* SUBS */ - hyperstone_addc, hyperstone_addc, hyperstone_addc, hyperstone_addc, /* ADDC */ - hyperstone_and, hyperstone_and, hyperstone_and, hyperstone_and, /* AND */ - hyperstone_neg, hyperstone_neg, hyperstone_neg, hyperstone_neg, /* NEG */ - hyperstone_negs, hyperstone_negs, hyperstone_negs, hyperstone_negs, /* NEGS */ - hyperstone_cmpi, hyperstone_cmpi, hyperstone_cmpi, hyperstone_cmpi, /* CMPI */ - hyperstone_movi, hyperstone_movi, hyperstone_movi, hyperstone_movi, /* MOVI */ - hyperstone_addi, hyperstone_addi, hyperstone_addi, hyperstone_addi, /* ADDI */ - hyperstone_addsi,hyperstone_addsi,hyperstone_addsi, hyperstone_addsi, /* ADDSI */ - hyperstone_cmpbi,hyperstone_cmpbi,hyperstone_cmpbi, hyperstone_cmpbi, /* CMPBI */ - hyperstone_andni,hyperstone_andni,hyperstone_andni, hyperstone_andni, /* ANDNI */ - hyperstone_ori, hyperstone_ori, hyperstone_ori, hyperstone_ori, /* ORI */ - hyperstone_xori, hyperstone_xori, hyperstone_xori, hyperstone_xori, /* XORI */ - hyperstone_shrdi,hyperstone_shrdi,hyperstone_shrd, hyperstone_shr, /* SHRDI, SHRD, SHR */ - hyperstone_sardi,hyperstone_sardi,hyperstone_sard, hyperstone_sar, /* SARDI, SARD, SAR */ - hyperstone_shldi,hyperstone_shldi,hyperstone_shld, hyperstone_shl, /* SHLDI, SHLD, SHL */ - reserved, reserved, hyperstone_testlz,hyperstone_rol, /* RESERVED, TESTLZ, ROL */ - hyperstone_ldxx1,hyperstone_ldxx1,hyperstone_ldxx1, hyperstone_ldxx1, /* LDxx.D/A/IOD/IOA */ - hyperstone_ldxx2,hyperstone_ldxx2,hyperstone_ldxx2, hyperstone_ldxx2, /* LDxx.N/S */ - hyperstone_stxx1,hyperstone_stxx1,hyperstone_stxx1, hyperstone_stxx1, /* STxx.D/A/IOD/IOA */ - hyperstone_stxx2,hyperstone_stxx2,hyperstone_stxx2, hyperstone_stxx2, /* STxx.N/S */ - hyperstone_shri, hyperstone_shri, hyperstone_shri, hyperstone_shri, /* SHRI */ - hyperstone_sari, hyperstone_sari, hyperstone_sari, hyperstone_sari, /* SARI */ - hyperstone_shli, hyperstone_shli, hyperstone_shli, hyperstone_shli, /* SHLI */ - reserved, reserved, reserved, reserved, /* RESERVED */ - hyperstone_mulu, hyperstone_mulu, hyperstone_mulu, hyperstone_mulu, /* MULU */ - hyperstone_muls, hyperstone_muls, hyperstone_muls, hyperstone_muls, /* MULS */ - hyperstone_set, hyperstone_set, hyperstone_set, hyperstone_set, /* SETxx - SETADR - FETCH */ - hyperstone_mul, hyperstone_mul, hyperstone_mul, hyperstone_mul, /* MUL */ - hyperstone_fadd, hyperstone_faddd,hyperstone_fsub, hyperstone_fsubd, /* FADD, FADDD, FSUB, FSUBD */ - hyperstone_fmul, hyperstone_fmuld,hyperstone_fdiv, hyperstone_fdivd, /* FMUL, FMULD, FDIV, FDIVD */ - hyperstone_fcmp, hyperstone_fcmpd,hyperstone_fcmpu, hyperstone_fcmpud, /* FCMP, FCMPD, FCMPU, FCMPUD */ - hyperstone_fcvt, hyperstone_fcvtd,hyperstone_extend,hyperstone_do, /* FCVT, FCVTD, EXTEND, DO */ - hyperstone_ldwr, hyperstone_ldwr, hyperstone_lddr, hyperstone_lddr, /* LDW.R, LDD.R */ - hyperstone_ldwp, hyperstone_ldwp, hyperstone_lddp, hyperstone_lddp, /* LDW.P, LDD.P */ - hyperstone_stwr, hyperstone_stwr, hyperstone_stdr, hyperstone_stdr, /* STW.R, STD.R */ - hyperstone_stwp, hyperstone_stwp, hyperstone_stdp, hyperstone_stdp, /* STW.P, STD.P */ - hyperstone_dbv, hyperstone_dbnv, hyperstone_dbe, hyperstone_dbne, /* DBV, DBNV, DBE, DBNE */ - hyperstone_dbc, hyperstone_dbnc, hyperstone_dbse, hyperstone_dbht, /* DBC, DBNC, DBSE, DBHT */ - hyperstone_dbn, hyperstone_dbnn, hyperstone_dble, hyperstone_dbgt, /* DBN, DBNN, DBLE, DBGT */ - hyperstone_dbr, hyperstone_frame,hyperstone_call, hyperstone_call, /* DBR, FRAME, CALL */ - hyperstone_bv, hyperstone_bnv, hyperstone_be, hyperstone_bne, /* BV, BNV, BE, BNE */ - hyperstone_bc, hyperstone_bnc, hyperstone_bse, hyperstone_bht, /* BC, BNC, BSE, BHT */ - hyperstone_bn, hyperstone_bnn, hyperstone_ble, hyperstone_bgt, /* BN, BNN, BLE, BGT */ - hyperstone_br, hyperstone_trap, hyperstone_trap, hyperstone_trap /* BR, TRAPxx - TRAP */ -}; - // 4Kb IRAM (On-Chip Memory) #if (HAS_E116T || HAS_GMS30C2116) @@ -680,13 +518,11 @@ static void hyperstone_set_trap_entry(int which) break; default: - logerror("Set entry point to a reserved value: %d\n", which); + DEBUG_PRINTF(("Set entry point to a reserved value: %d\n", which)); break; } } -#define OP hyperstone.op - #define PPC hyperstone.ppc //previous pc #define PC hyperstone.global_regs[0] //Program Counter #define SR hyperstone.global_regs[1] //Status Register @@ -698,7 +534,7 @@ static void hyperstone_set_trap_entry(int which) #define BCR hyperstone.global_regs[20] //Bus Control Register #define TPR hyperstone.global_regs[21] //Timer Prescaler Register #define TCR hyperstone.global_regs[22] //Timer Compare Register -#define TR hyperstone.global_regs[23] //Timer Register +#define TR compute_tr() //Timer Register #define WCR hyperstone.global_regs[24] //Watchdog Compare Register #define ISR hyperstone.global_regs[25] //Input Status Register #define FCR hyperstone.global_regs[26] //Function Control Register @@ -761,6 +597,96 @@ static void hyperstone_set_trap_entry(int which) //other bits are reversed, in particular 7 - 5 for the operating system. //the user program can only changes the above 2 flags + + + +static UINT32 compute_tr(void) +{ + UINT64 cycles_since_base = activecpu_gettotalcycles64() - hyperstone.tr_base_cycles; + UINT64 clocks_since_base = cycles_since_base >> hyperstone.clock_scale; + return hyperstone.tr_base_value + (clocks_since_base / hyperstone.tr_clocks_per_tick); +} + +static void update_timer_prescale(void) +{ + UINT32 prevtr = compute_tr(); + TPR &= ~0x80000000; + hyperstone.clock_scale = (TPR >> 26) & hyperstone.clock_scale_mask; + hyperstone.clock_cycles_1 = 1 << hyperstone.clock_scale; + hyperstone.clock_cycles_2 = 2 << hyperstone.clock_scale; + hyperstone.clock_cycles_4 = 4 << hyperstone.clock_scale; + hyperstone.clock_cycles_6 = 6 << hyperstone.clock_scale; + hyperstone.tr_clocks_per_tick = ((TPR >> 16) & 0xff) + 2; + hyperstone.tr_base_value = prevtr; + hyperstone.tr_base_cycles = activecpu_gettotalcycles64(); +} + +static void adjust_timer_interrupt(void) +{ + UINT64 cycles_since_base = activecpu_gettotalcycles64() - hyperstone.tr_base_cycles; + UINT64 clocks_since_base = cycles_since_base >> hyperstone.clock_scale; + UINT64 cycles_until_next_clock = cycles_since_base - (clocks_since_base << hyperstone.clock_scale); + int cpunum = cpu_getactivecpu(); + + if (cycles_until_next_clock == 0) + cycles_until_next_clock = (UINT64)(1 << hyperstone.clock_scale); + + /* special case: if we have a change pending, set a timer to fire then */ + if (TPR & 0x80000000) + { + UINT64 clocks_until_int = hyperstone.tr_clocks_per_tick - (clocks_since_base % hyperstone.tr_clocks_per_tick); + UINT64 cycles_until_int = (clocks_until_int << hyperstone.clock_scale) + cycles_until_next_clock; + timer_adjust(hyperstone.timer, ATTOTIME_IN_CYCLES(cycles_until_int + 1, cpunum), cpunum * 2 + 1, attotime_never); + } + + /* else if the timer interrupt is enabled, configure it to fire at the appropriate time */ + else if (!(FCR & 0x00800000)) + { + UINT32 curtr = hyperstone.tr_base_value + (clocks_since_base / hyperstone.tr_clocks_per_tick); + UINT32 delta = TCR - curtr; + if (delta > 0x80000000) + { + if (!hyperstone.timer_int_pending) + timer_adjust(hyperstone.timer, attotime_zero, cpunum * 2 + 0, attotime_never); + } + else + { + UINT64 clocks_until_int = mulu_32x32(delta, hyperstone.tr_clocks_per_tick); + UINT64 cycles_until_int = (clocks_until_int << hyperstone.clock_scale) + cycles_until_next_clock; + timer_adjust(hyperstone.timer, ATTOTIME_IN_CYCLES(cycles_until_int, cpunum), cpunum * 2 + 0, attotime_never); + } + } + + /* otherwise, disable the timer */ + else + timer_adjust(hyperstone.timer, attotime_never, 0, attotime_never); +} + +static TIMER_CALLBACK( timer_callback ) +{ + int update = param & 1; + int cpunum = param >> 1; + + cpuintrf_push_context(cpunum); + + /* update the values if necessary */ + if (update) + update_timer_prescale(); + + /* see if the timer is right for firing */ + if (!((compute_tr() - TCR) & 0x80000000)) + hyperstone.timer_int_pending = 1; + + /* adjust ourselves for the next time */ + else + adjust_timer_interrupt(); + + cpuintrf_pop_context(); +} + + + + static UINT32 get_global_register(UINT8 code) { /* @@ -774,31 +700,38 @@ static UINT32 get_global_register(UINT8 code) case 29: case 30: case 31: - mame_printf_debug("read _Reserved_ Global Register %d @ %08X\n",code,PC); + DEBUG_PRINTF(("read _Reserved_ Global Register %d @ %08X\n",code,PC)); break; case BCR_REGISTER: - mame_printf_debug("read write-only BCR register @ %08X\n",PC); + DEBUG_PRINTF(("read write-only BCR register @ %08X\n",PC)); return 0; case TPR_REGISTER: - mame_printf_debug("read write-only TPR register @ %08X\n",PC); + DEBUG_PRINTF(("read write-only TPR register @ %08X\n",PC)); return 0; case FCR_REGISTER: - mame_printf_debug("read write-only FCR register @ %08X\n",PC); + DEBUG_PRINTF(("read write-only FCR register @ %08X\n",PC)); return 0; case MCR_REGISTER: - mame_printf_debug("read write-only MCR register @ %08X\n",PC); + DEBUG_PRINTF(("read write-only MCR register @ %08X\n",PC)); return 0; } } */ + if (code == TR_REGISTER) + { + /* it is common to poll this in a loop */ + if (hyperstone_ICount > hyperstone.tr_clocks_per_tick / 2) + hyperstone_ICount -= hyperstone.tr_clocks_per_tick / 2; + return compute_tr(); + } return hyperstone.global_regs[code]; } -static void set_global_register(UINT8 code, UINT32 val) +INLINE void set_global_register(UINT8 code, UINT32 val) { //TODO: add correct FER set instruction @@ -810,15 +743,17 @@ static void set_global_register(UINT8 code, UINT32 val) else if( code == SR_REGISTER ) { SET_LOW_SR(val); // only a RET instruction can change the full content of SR - SR &= ~0x40; //reserved bit 6 always zero + if (hyperstone.intblock < 1) + hyperstone.intblock = 1; } else { + UINT32 oldval = hyperstone.global_regs[code]; if( code != ISR_REGISTER ) hyperstone.global_regs[code] = val; else - logerror("Written to ISR register. PC = %08X\n", PC); + DEBUG_PRINTF(("Written to ISR register. PC = %08X\n", PC)); //are these set only when privilege bit is set? if( code >= 16 ) @@ -834,19 +769,19 @@ static void set_global_register(UINT8 code, UINT32 val) break; /* case ISR_REGISTER: - mame_printf_debug("written %08X to read-only ISR register\n",val); + DEBUG_PRINTF(("written %08X to read-only ISR register\n",val)); break; - case 22: -// mame_printf_debug("written %08X to TCR register\n",val); + case TCR_REGISTER: +// DEBUG_PRINTF(("written %08X to TCR register\n",val)); break; case 23: -// mame_printf_debug("written %08X to TR register\n",val); +// DEBUG_PRINTF(("written %08X to TR register\n",val)); break; case 24: -// mame_printf_debug("written %08X to WCR register\n",val); +// DEBUG_PRINTF(("written %08X to WCR register\n",val)); break; case 16: @@ -855,57 +790,50 @@ static void set_global_register(UINT8 code, UINT32 val) case 29: case 30: case 31: - mame_printf_debug("written %08X to _Reserved_ Global Register %d\n",val,code); + DEBUG_PRINTF(("written %08X to _Reserved_ Global Register %d\n",val,code)); break; case BCR_REGISTER: break; */ - case TPR_REGISTER: + case TR_REGISTER: + hyperstone.tr_base_value = val; + hyperstone.tr_base_cycles = activecpu_gettotalcycles64(); + adjust_timer_interrupt(); + break; - hyperstone.n = (val & 0xff0000) >> 16; + case TPR_REGISTER: + if (!(val & 0x80000000)) /* change immediately */ + update_timer_prescale(); + adjust_timer_interrupt(); + break; - if(!(val & 0x80000000)) /* change immediately */ - { - hyperstone.delay_timer = 0; - hyperstone.timer_clocks = hyperstone.n + 2; - } - else - { - hyperstone.delay_timer = 1; + case TCR_REGISTER: + if (oldval != val) + { + adjust_timer_interrupt(); + if (hyperstone.intblock < 1) + hyperstone.intblock = 1; } + break; - break; -/* case FCR_REGISTER: - switch((val & 0x3000)>>12) - { - case 0: - mame_printf_debug("IO3 interrupt mode\n"); - break; - case 1: - mame_printf_debug("IO3 timing mode\n"); - break; - case 2: - mame_printf_debug("watchdog mode\n"); - break; - case 3: - // IO3 standard mode - break; - } + if ((oldval ^ val) & 0x00800000) + adjust_timer_interrupt(); + if (hyperstone.intblock < 1) + hyperstone.intblock = 1; break; -*/ + case MCR_REGISTER: // bits 14..12 EntryTableMap hyperstone_set_trap_entry((val & 0x7000) >> 12); - break; } } } } -static void set_local_register(UINT8 code, UINT32 val) +INLINE void set_local_register(UINT8 code, UINT32 val) { UINT8 new_code = (code + GET_FP) % 64; @@ -928,526 +856,454 @@ static void set_local_register(UINT8 code, UINT32 val) #define LOCAL 1 -static void decode_source(int local, int hflag) -{ - if(local) - { - UINT8 code = current_regs.src; - current_regs.set_src_register = set_local_register; - code = (current_regs.src + GET_FP) % 64; // registers offset by frame pointer - SREG = hyperstone.local_regs[code]; - code = (current_regs.src + 1 + GET_FP) % 64; - SREGF = hyperstone.local_regs[code]; - } - else - { - current_regs.set_src_register = set_global_register; - - if(hflag) - current_regs.src += hflag * 16; - - SREG = hyperstone.global_regs[current_regs.src]; - - /* bound safe */ - if(current_regs.src != 15 && current_regs.src != 31) - SREGF = hyperstone.global_regs[current_regs.src + 1]; - - if(current_regs.src == PC_REGISTER) - SRC_IS_PC = 1; - else if(current_regs.src == SR_REGISTER) - SRC_IS_SR = 1; - else if( current_regs.src == BCR_REGISTER || current_regs.src == TPR_REGISTER || - current_regs.src == FCR_REGISTER || current_regs.src == MCR_REGISTER ) - { - SREG = 0; // write-only registers - } - else if( current_regs.src == ISR_REGISTER ) - mame_printf_debug("read src ISR. PC = %08X\n",PPC); - } -} - -static void decode_dest(int local, int hflag) -{ - if(local) - { - UINT8 code = current_regs.dst; - current_regs.set_dst_register = set_local_register; - code = (current_regs.dst + GET_FP) % 64; // registers offset by frame pointer - DREG = hyperstone.local_regs[code]; - code = (current_regs.dst + 1 + GET_FP) % 64; - DREGF = hyperstone.local_regs[code]; - } - else - { - current_regs.set_dst_register = set_global_register; - - if(hflag) - current_regs.dst += hflag * 16; - - DREG = hyperstone.global_regs[current_regs.dst]; - - /* bound safe */ - if(current_regs.dst != 15 && current_regs.dst != 31) - DREGF = hyperstone.global_regs[current_regs.dst + 1]; - - if(current_regs.dst == PC_REGISTER) - DST_IS_PC = 1; - else if(current_regs.dst == SR_REGISTER) - DST_IS_SR = 1; - else if( current_regs.src == ISR_REGISTER ) - mame_printf_debug("read dst ISR. PC = %08X\n",PPC); - } -} - -INLINE void decode_RR(void) -{ - current_regs.src = SRC_CODE; - current_regs.dst = DST_CODE; - decode_source(S_BIT, 0); - decode_dest(D_BIT, 0); - - if( SRC_CODE == DST_CODE && S_BIT == D_BIT ) - SAME_SRC_DST = 1; - - if( S_BIT == LOCAL && D_BIT == LOCAL ) - { - if( SRC_CODE == ((DST_CODE + 1) % 64) ) - SAME_SRC_DSTF = 1; - - if( ((SRC_CODE + 1) % 64) == DST_CODE ) - SAME_SRCF_DST = 1; - } - else if( S_BIT == 0 && D_BIT == 0 ) - { - if( SRC_CODE == (DST_CODE + 1) ) - SAME_SRC_DSTF = 1; - - if( (SRC_CODE + 1) == DST_CODE ) - SAME_SRCF_DST = 1; - } -} - -INLINE void decode_LL(void) -{ - current_regs.src = SRC_CODE; - current_regs.dst = DST_CODE; - decode_source(LOCAL, 0); - decode_dest(LOCAL, 0); - - if( SRC_CODE == DST_CODE ) - SAME_SRC_DST = 1; - - if( SRC_CODE == ((DST_CODE + 1) % 64) ) - SAME_SRC_DSTF = 1; -} - -INLINE void decode_LR(void) -{ - current_regs.src = SRC_CODE; - current_regs.dst = DST_CODE; - decode_source(S_BIT, 0); - decode_dest(LOCAL, 0); - - if( ((SRC_CODE + 1) % 64) == DST_CODE && S_BIT == LOCAL ) - SAME_SRCF_DST = 1; -} - -INLINE void check_delay_PC(void) -{ - // if PC is used in a delay instruction, the delayed PC should be used - if( hyperstone.delay.delay_cmd == DELAY_EXECUTE ) - { - PC = hyperstone.delay.delay_pc; - hyperstone.delay.delay_cmd = NO_DELAY; - } -} - -INLINE void decode_immediate(void) -{ - switch( N_VALUE ) - { - case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: - case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: - EXTRA_U = N_VALUE; - break; - - case 17: - hyperstone.instruction_length = 3; - EXTRA_U = (READ_OP(PC) << 16) | READ_OP(PC + 2); - PC += 4; - break; - - case 18: - hyperstone.instruction_length = 2; - EXTRA_U = READ_OP(PC); - PC += 2; - break; - - case 19: - hyperstone.instruction_length = 2; - EXTRA_U = 0xffff0000 | READ_OP(PC); - PC += 2; - break; - - case 20: - EXTRA_U = 32; // bit 5 = 1, others = 0 - break; - - case 21: - EXTRA_U = 64; // bit 6 = 1, others = 0 - break; - - case 22: - EXTRA_U = 128; // bit 7 = 1, others = 0 - break; - - case 23: - EXTRA_U = 0x80000000; // bit 31 = 1, others = 0 (2 at the power of 31) - break; - - case 24: - EXTRA_U = -8; - break; - - case 25: - EXTRA_U = -7; - break; - - case 26: - EXTRA_U = -6; - break; - - case 27: - EXTRA_U = -5; - break; - - case 28: - EXTRA_U = -4; - break; - - case 29: - EXTRA_U = -3; - break; - - case 30: - EXTRA_U = -2; - break; - - case 31: - EXTRA_U = -1; - break; - } -} - -INLINE void decode_const(void) -{ - UINT16 imm_1 = READ_OP(PC); - - PC += 2; - hyperstone.instruction_length = 2; - - if( E_BIT(imm_1) ) - { - UINT16 imm_2 = READ_OP(PC); - - PC += 2; - hyperstone.instruction_length = 3; - - EXTRA_S = imm_2; - EXTRA_S |= ((imm_1 & 0x3fff) << 16); - - if( S_BIT_CONST(imm_1) ) - { - EXTRA_S |= 0xc0000000; - } - } - else - { - EXTRA_S = imm_1 & 0x3fff; - - if( S_BIT_CONST(imm_1) ) - { - EXTRA_S |= 0xffffc000; - } - } -} - -INLINE void decode_pcrel(void) -{ - if( OP & 0x80 ) - { - UINT16 next = READ_OP(PC); - - PC += 2; - hyperstone.instruction_length = 2; - - EXTRA_S = (OP & 0x7f) << 16; - EXTRA_S |= (next & 0xfffe); - - if( next & 1 ) - EXTRA_S |= 0xff800000; - } - else - { - EXTRA_S = OP & 0x7e; - - if( OP & 1 ) - EXTRA_S |= 0xffffff80; - } -} - -INLINE void decode_dis(void) -{ - UINT16 next_1 = READ_OP(PC); - - PC += 2; - hyperstone.instruction_length = 2; - - current_regs.sub_type = DD(next_1); - - if( E_BIT(next_1) ) - { - UINT16 next_2 = READ_OP(PC); - - PC += 2; - hyperstone.instruction_length = 3; - - EXTRA_S = next_2; - EXTRA_S |= ((next_1 & 0xfff) << 16); - - if( S_BIT_CONST(next_1) ) - { - EXTRA_S |= 0xf0000000; - } - } - else - { - EXTRA_S = next_1 & 0xfff; - - if( S_BIT_CONST(next_1) ) - { - EXTRA_S |= 0xfffff000; - } - } -} - -INLINE void decode_lim(void) -{ - UINT32 next = READ_OP(PC); - PC += 2; - hyperstone.instruction_length = 2; - - current_regs.sub_type = X_CODE(next); - - if( E_BIT(next) ) - { - EXTRA_U = ((next & 0xfff) << 16) | READ_OP(PC); - PC += 2; - hyperstone.instruction_length = 3; - } - else - { - EXTRA_U = next & 0xfff; - } -} - -/* used in the jumptable */ -INLINE void RRdecode(void) -{ - check_delay_PC(); - decode_RR(); -} - -INLINE void RRlimdecode(void) -{ - decode_lim(); - check_delay_PC(); - decode_RR(); -} - -INLINE void RRconstdecode(void) -{ - decode_const(); - check_delay_PC(); - decode_RR(); -} - -INLINE void RRdisdecode(void) -{ - decode_dis(); - check_delay_PC(); - decode_RR(); -} - -INLINE void RRdecodewithHflag(void) -{ - check_delay_PC(); - current_regs.src = SRC_CODE; - current_regs.dst = DST_CODE; - decode_source(S_BIT, GET_H); - decode_dest(D_BIT, GET_H); - - if(GET_H) - if(S_BIT == 0 && D_BIT == 0) - popmessage("MOV with hflag and 2 GRegs! PC = %08X\n",PPC); -} - -INLINE void Rimmdecode(void) -{ - decode_immediate(); - check_delay_PC(); - current_regs.dst = DST_CODE; - decode_dest(D_BIT, 0); -} - -INLINE void Rndecode(void) -{ - check_delay_PC(); - current_regs.dst = DST_CODE; - decode_dest(D_BIT, 0); -} - -INLINE void RimmdecodewithHflag(void) -{ - decode_immediate(); - check_delay_PC(); - current_regs.dst = DST_CODE; - decode_dest(D_BIT, GET_H); -} - -INLINE void Lndecode(void) -{ - check_delay_PC(); - current_regs.dst = DST_CODE; - decode_dest(LOCAL, 0); -} - -INLINE void LLdecode(void) -{ - check_delay_PC(); - decode_LL(); -} - -INLINE void LLextdecode(void) -{ - hyperstone.instruction_length = 2; - EXTRA_U = READ_OP(PC); - PC += 2; - check_delay_PC(); - decode_LL(); -} - -INLINE void LRdecode(void) -{ - check_delay_PC(); - decode_LR(); -} - -INLINE void LRconstdecode(void) -{ - decode_const(); - check_delay_PC(); - decode_LR(); -} - -INLINE void PCreldecode(void) -{ - decode_pcrel(); - check_delay_PC(); -} - -INLINE void PCadrdecode(void) -{ - check_delay_PC(); -} - -INLINE void no_decode(void) +static const INT32 immediate_values[32] = { - -} - - -/* Decode helper table */ -static void (*hyperstone_decode[0x100])(void) = { -/*00*/ RRdecode, RRdecode, RRdecode, RRdecode, /* CHK - CHKZ - NOP */ -/*04*/ RRdecode, RRdecode, RRdecode, RRdecode, /* MOVD - RET */ -/*08*/ RRdecode, RRdecode, RRdecode, RRdecode, /* DIVU */ -/*0c*/ RRdecode, RRdecode, RRdecode, RRdecode, /* DIVS */ -/*10*/ RRlimdecode, RRlimdecode, RRlimdecode, RRlimdecode, /* XMx - XXx */ -/*14*/ RRconstdecode, RRconstdecode, RRconstdecode, RRconstdecode, /* MASK */ -/*18*/ RRconstdecode, RRconstdecode, RRconstdecode, RRconstdecode, /* SUM */ -/*1c*/ RRconstdecode, RRconstdecode, RRconstdecode, RRconstdecode, /* SUMS */ -/*20*/ RRdecode, RRdecode, RRdecode, RRdecode, /* CMP */ -/*24*/ RRdecodewithHflag, RRdecodewithHflag, RRdecodewithHflag, RRdecodewithHflag, /* MOV */ -/*28*/ RRdecode, RRdecode, RRdecode, RRdecode, /* ADD */ -/*2c*/ RRdecode, RRdecode, RRdecode, RRdecode, /* ADDS */ -/*30*/ RRdecode, RRdecode, RRdecode, RRdecode, /* CMPB */ -/*34*/ RRdecode, RRdecode, RRdecode, RRdecode, /* ANDN */ -/*38*/ RRdecode, RRdecode, RRdecode, RRdecode, /* OR */ -/*3c*/ RRdecode, RRdecode, RRdecode, RRdecode, /* XOR */ -/*40*/ RRdecode, RRdecode, RRdecode, RRdecode, /* SUBC */ -/*44*/ RRdecode, RRdecode, RRdecode, RRdecode, /* NOT */ -/*48*/ RRdecode, RRdecode, RRdecode, RRdecode, /* SUB */ -/*4c*/ RRdecode, RRdecode, RRdecode, RRdecode, /* SUBS */ -/*50*/ RRdecode, RRdecode, RRdecode, RRdecode, /* ADDC */ -/*54*/ RRdecode, RRdecode, RRdecode, RRdecode, /* AND */ -/*58*/ RRdecode, RRdecode, RRdecode, RRdecode, /* NEG */ -/*5c*/ RRdecode, RRdecode, RRdecode, RRdecode, /* NEGS */ -/*60*/ Rimmdecode, Rimmdecode, Rimmdecode, Rimmdecode, /* CMPI */ -/*64*/ RimmdecodewithHflag, RimmdecodewithHflag, RimmdecodewithHflag, RimmdecodewithHflag, /* MOVI */ -/*68*/ Rimmdecode, Rimmdecode, Rimmdecode, Rimmdecode, /* ADDI */ -/*6c*/ Rimmdecode, Rimmdecode, Rimmdecode, Rimmdecode, /* ADDSI */ -/*70*/ Rimmdecode, Rimmdecode, Rimmdecode, Rimmdecode, /* CMPBI */ -/*74*/ Rimmdecode, Rimmdecode, Rimmdecode, Rimmdecode, /* ANDNI */ -/*78*/ Rimmdecode, Rimmdecode, Rimmdecode, Rimmdecode, /* ORI */ -/*7c*/ Rimmdecode, Rimmdecode, Rimmdecode, Rimmdecode, /* XORI */ -/*80*/ Lndecode, Lndecode, LLdecode, LLdecode, /* SHRDI, SHRD, SHR */ -/*84*/ Lndecode, Lndecode, LLdecode, LLdecode, /* SARDI, SARD, SAR */ -/*88*/ Lndecode, Lndecode, LLdecode, LLdecode, /* SHLDI, SHLD, SHL */ -/*8c*/ no_decode, no_decode, LLdecode, LLdecode, /* RESERVED, TESTLZ, ROL */ -/*90*/ RRdisdecode, RRdisdecode, RRdisdecode, RRdisdecode, /* LDxx.D/A/IOD/IOA */ -/*94*/ RRdisdecode, RRdisdecode, RRdisdecode, RRdisdecode, /* LDxx.N/S */ -/*98*/ RRdisdecode, RRdisdecode, RRdisdecode, RRdisdecode, /* STxx.D/A/IOD/IOA */ -/*9c*/ RRdisdecode, RRdisdecode, RRdisdecode, RRdisdecode, /* STxx.N/S */ -/*a0*/ Rndecode, Rndecode, Rndecode, Rndecode, /* SHRI */ -/*a4*/ Rndecode, Rndecode, Rndecode, Rndecode, /* SARI */ -/*a8*/ Rndecode, Rndecode, Rndecode, Rndecode, /* SHLI */ -/*ac*/ no_decode, no_decode, no_decode, no_decode, /* RESERVED */ -/*b0*/ RRdecode, RRdecode, RRdecode, RRdecode, /* MULU */ -/*b4*/ RRdecode, RRdecode, RRdecode, RRdecode, /* MULS */ -/*b8*/ Rndecode, Rndecode, Rndecode, Rndecode, /* SETxx - SETADR - FETCH */ -/*bc*/ RRdecode, RRdecode, RRdecode, RRdecode, /* MUL */ -/*c0*/ LLdecode, LLdecode, LLdecode, LLdecode, /* FADD, FADDD, FSUB, FSUBD */ -/*c4*/ LLdecode, LLdecode, LLdecode, LLdecode, /* FMUL, FMULD, FDIV, FDIVD */ -/*c8*/ LLdecode, LLdecode, LLdecode, LLdecode, /* FCMP, FCMPD, FCMPU, FCMPUD */ -/*cc*/ LLdecode, LLdecode, LLextdecode, LLdecode, /* FCVT, FCVTD, EXTEND, DO */ -/*d0*/ LRdecode, LRdecode, LRdecode, LRdecode, /* LDW.R, LDD.R */ -/*d4*/ LRdecode, LRdecode, LRdecode, LRdecode, /* LDW.P, LDD.P */ -/*d8*/ LRdecode, LRdecode, LRdecode, LRdecode, /* STW.R, STD.R */ -/*dc*/ LRdecode, LRdecode, LRdecode, LRdecode, /* STW.P, STD.P */ -/*e0*/ PCreldecode, PCreldecode, PCreldecode, PCreldecode, /* DBV, DBNV, DBE, DBNE */ -/*e4*/ PCreldecode, PCreldecode, PCreldecode, PCreldecode, /* DBC, DBNC, DBSE, DBHT */ -/*e8*/ PCreldecode, PCreldecode, PCreldecode, PCreldecode, /* DBN, DBNN, DBLE, DBGT */ -/*ec*/ PCreldecode, LLdecode, LRconstdecode, LRconstdecode, /* DBR, FRAME, CALL */ -/*f0*/ PCreldecode, PCreldecode, PCreldecode, PCreldecode, /* BV, BNV, BE, BNE */ -/*f4*/ PCreldecode, PCreldecode, PCreldecode, PCreldecode, /* BC, BNC, BSE, BHT */ -/*f8*/ PCreldecode, PCreldecode, PCreldecode, PCreldecode, /* BN, BNN, BLE, BGT */ -/*fc*/ PCreldecode, PCadrdecode, PCadrdecode, PCadrdecode /* BR, TRAPxx - TRAP */ + 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, + 16, 0, 0, 0, 32, 64, 128, 0x80000000, + -8, -7, -6, -5, -4, -3, -2, -1 }; -INLINE void execute_br(void) +#define WRITE_ONLY_REGMASK ((1 << BCR_REGISTER) | (1 << TPR_REGISTER) | (1 << FCR_REGISTER) | (1 << MCR_REGISTER)) + +#define decode_source(decode, local, hflag) \ +do \ +{ \ + if(local) \ + { \ + UINT8 code = (decode)->src; \ + (decode)->src_is_local = 1; \ + code = ((decode)->src + GET_FP) % 64; /* registers offset by frame pointer */\ + SREG = hyperstone.local_regs[code]; \ + code = ((decode)->src + 1 + GET_FP) % 64; \ + SREGF = hyperstone.local_regs[code]; \ + } \ + else \ + { \ + (decode)->src_is_local = 0; \ + \ + if (!hflag) \ + { \ + SREG = get_global_register((decode)->src); \ + \ + /* bound safe */ \ + if ((decode)->src != 15) \ + SREGF = get_global_register((decode)->src + 1); \ + } \ + else \ + { \ + (decode)->src += 16; \ + \ + SREG = get_global_register((decode)->src); \ + if ((WRITE_ONLY_REGMASK >> (decode)->src) & 1) \ + SREG = 0; /* write-only registers */ \ + else if ((decode)->src == ISR_REGISTER) \ + DEBUG_PRINTF(("read src ISR. PC = %08X\n",PPC)); \ + \ + /* bound safe */ \ + if ((decode)->src != 31) \ + SREGF = get_global_register((decode)->src + 1); \ + } \ + } \ +} while (0) + +#define decode_dest(decode, local, hflag) \ +do \ +{ \ + if(local) \ + { \ + UINT8 code = (decode)->dst; \ + (decode)->dst_is_local = 1; \ + code = ((decode)->dst + GET_FP) % 64; /* registers offset by frame pointer */\ + DREG = hyperstone.local_regs[code]; \ + code = ((decode)->dst + 1 + GET_FP) % 64; \ + DREGF = hyperstone.local_regs[code]; \ + } \ + else \ + { \ + (decode)->dst_is_local = 0; \ + \ + if (!hflag) \ + { \ + DREG = get_global_register((decode)->dst); \ + \ + /* bound safe */ \ + if ((decode)->dst != 15) \ + DREGF = get_global_register((decode)->dst + 1); \ + } \ + else \ + { \ + (decode)->dst += 16; \ + \ + DREG = get_global_register((decode)->dst); \ + if( (decode)->dst == ISR_REGISTER ) \ + DEBUG_PRINTF(("read dst ISR. PC = %08X\n",PPC)); \ + \ + /* bound safe */ \ + if ((decode)->dst != 31) \ + DREGF = get_global_register((decode)->dst + 1); \ + } \ + } \ +} while (0) + +#define decode_RR(decode, dlocal, slocal) \ +do \ +{ \ + (decode)->src = SRC_CODE; \ + (decode)->dst = DST_CODE; \ + decode_source(decode, slocal, 0); \ + decode_dest(decode, dlocal, 0); \ + \ + if( (slocal) == (dlocal) && SRC_CODE == DST_CODE ) \ + SAME_SRC_DST = 1; \ + \ + if( (slocal) == LOCAL && (dlocal) == LOCAL ) \ + { \ + if( SRC_CODE == ((DST_CODE + 1) % 64) ) \ + SAME_SRC_DSTF = 1; \ + \ + if( ((SRC_CODE + 1) % 64) == DST_CODE ) \ + SAME_SRCF_DST = 1; \ + } \ + else if( (slocal) == 0 && (dlocal) == 0 ) \ + { \ + if( SRC_CODE == (DST_CODE + 1) ) \ + SAME_SRC_DSTF = 1; \ + \ + if( (SRC_CODE + 1) == DST_CODE ) \ + SAME_SRCF_DST = 1; \ + } \ +} while (0) + +#define decode_LL(decode) \ +do \ +{ \ + (decode)->src = SRC_CODE; \ + (decode)->dst = DST_CODE; \ + decode_source(decode, LOCAL, 0); \ + decode_dest(decode, LOCAL, 0); \ + \ + if( SRC_CODE == DST_CODE ) \ + SAME_SRC_DST = 1; \ + \ + if( SRC_CODE == ((DST_CODE + 1) % 64) ) \ + SAME_SRC_DSTF = 1; \ +} while (0) + +#define decode_LR(decode, slocal) \ +do \ +{ \ + (decode)->src = SRC_CODE; \ + (decode)->dst = DST_CODE; \ + decode_source(decode, slocal, 0); \ + decode_dest(decode, LOCAL, 0); \ + \ + if( ((SRC_CODE + 1) % 64) == DST_CODE && slocal == LOCAL ) \ + SAME_SRCF_DST = 1; \ +} while (0) + +#define check_delay_PC() \ +do \ +{ \ + /* if PC is used in a delay instruction, the delayed PC should be used */ \ + if( hyperstone.delay.delay_cmd == DELAY_EXECUTE ) \ + { \ + PC = hyperstone.delay.delay_pc; \ + hyperstone.delay.delay_cmd = NO_DELAY; \ + } \ +} while (0) + +#define decode_immediate(decode, nbit) \ +do \ +{ \ + if (!nbit) \ + EXTRA_U = immediate_values[OP & 0x0f]; \ + else \ + switch( OP & 0x0f ) \ + { \ + default: \ + EXTRA_U = immediate_values[0x10 + (OP & 0x0f)]; \ + break; \ + \ + case 1: \ + hyperstone.instruction_length = 3; \ + EXTRA_U = (READ_OP(PC) << 16) | READ_OP(PC + 2); \ + PC += 4; \ + break; \ + \ + case 2: \ + hyperstone.instruction_length = 2; \ + EXTRA_U = READ_OP(PC); \ + PC += 2; \ + break; \ + \ + case 3: \ + hyperstone.instruction_length = 2; \ + EXTRA_U = 0xffff0000 | READ_OP(PC); \ + PC += 2; \ + break; \ + } \ +} while (0) + +#define decode_const(decode) \ +do \ +{ \ + UINT16 imm_1 = READ_OP(PC); \ + \ + PC += 2; \ + hyperstone.instruction_length = 2; \ + \ + if( E_BIT(imm_1) ) \ + { \ + UINT16 imm_2 = READ_OP(PC); \ + \ + PC += 2; \ + hyperstone.instruction_length = 3; \ + \ + EXTRA_S = imm_2; \ + EXTRA_S |= ((imm_1 & 0x3fff) << 16); \ + \ + if( S_BIT_CONST(imm_1) ) \ + { \ + EXTRA_S |= 0xc0000000; \ + } \ + } \ + else \ + { \ + EXTRA_S = imm_1 & 0x3fff; \ + \ + if( S_BIT_CONST(imm_1) ) \ + { \ + EXTRA_S |= 0xffffc000; \ + } \ + } \ +} while (0) + +#define decode_pcrel(decode) \ +do \ +{ \ + if( OP & 0x80 ) \ + { \ + UINT16 next = READ_OP(PC); \ + \ + PC += 2; \ + hyperstone.instruction_length = 2; \ + \ + EXTRA_S = (OP & 0x7f) << 16; \ + EXTRA_S |= (next & 0xfffe); \ + \ + if( next & 1 ) \ + EXTRA_S |= 0xff800000; \ + } \ + else \ + { \ + EXTRA_S = OP & 0x7e; \ + \ + if( OP & 1 ) \ + EXTRA_S |= 0xffffff80; \ + } \ +} while (0) + +#define decode_dis(decode) \ +do \ +{ \ + UINT16 next_1 = READ_OP(PC); \ + \ + PC += 2; \ + hyperstone.instruction_length = 2; \ + \ + (decode)->sub_type = DD(next_1); \ + \ + if( E_BIT(next_1) ) \ + { \ + UINT16 next_2 = READ_OP(PC); \ + \ + PC += 2; \ + hyperstone.instruction_length = 3; \ + \ + EXTRA_S = next_2; \ + EXTRA_S |= ((next_1 & 0xfff) << 16); \ + \ + if( S_BIT_CONST(next_1) ) \ + { \ + EXTRA_S |= 0xf0000000; \ + } \ + } \ + else \ + { \ + EXTRA_S = next_1 & 0xfff; \ + \ + if( S_BIT_CONST(next_1) ) \ + { \ + EXTRA_S |= 0xfffff000; \ + } \ + } \ +} while (0) + +#define decode_lim(decode) \ +do \ +{ \ + UINT32 next = READ_OP(PC); \ + PC += 2; \ + hyperstone.instruction_length = 2; \ + \ + (decode)->sub_type = X_CODE(next); \ + \ + if( E_BIT(next) ) \ + { \ + EXTRA_U = ((next & 0xfff) << 16) | READ_OP(PC); \ + PC += 2; \ + hyperstone.instruction_length = 3; \ + } \ + else \ + { \ + EXTRA_U = next & 0xfff; \ + } \ +} while (0) + +#define RRdecode(decode, dlocal, slocal) \ +do \ +{ \ + check_delay_PC(); \ + decode_RR(decode, dlocal, slocal); \ +} while (0) + +#define RRlimdecode(decode, dlocal, slocal) \ +do \ +{ \ + decode_lim(decode); \ + check_delay_PC(); \ + decode_RR(decode, dlocal, slocal); \ +} while (0) + +#define RRconstdecode(decode, dlocal, slocal) \ +do \ +{ \ + decode_const(decode); \ + check_delay_PC(); \ + decode_RR(decode, dlocal, slocal); \ +} while (0) + +#define RRdisdecode(decode, dlocal, slocal) \ +do \ +{ \ + decode_dis(decode); \ + check_delay_PC(); \ + decode_RR(decode, dlocal, slocal); \ +} while (0) + +#define RRdecodewithHflag(decode, dlocal, slocal) \ +do \ +{ \ + check_delay_PC(); \ + (decode)->src = SRC_CODE; \ + (decode)->dst = DST_CODE; \ + decode_source(decode, slocal, GET_H); \ + decode_dest(decode, dlocal, GET_H); \ + \ + if(GET_H) \ + if(slocal == 0 && dlocal == 0) \ + DEBUG_PRINTF(("MOV with hflag and 2 GRegs! PC = %08X\n",PPC)); \ +} while (0) + +#define Rimmdecode(decode, dlocal, nbit) \ +do \ +{ \ + decode_immediate(decode, nbit); \ + check_delay_PC(); \ + (decode)->dst = DST_CODE; \ + decode_dest(decode, dlocal, 0); \ +} while (0) + +#define Rndecode(decode, dlocal) \ +do \ +{ \ + check_delay_PC(); \ + (decode)->dst = DST_CODE; \ + decode_dest(decode, dlocal, 0); \ +} while (0) + +#define RimmdecodewithHflag(decode, dlocal, nbit) \ +do \ +{ \ + decode_immediate(decode, nbit); \ + check_delay_PC(); \ + (decode)->dst = DST_CODE; \ + decode_dest(decode, dlocal, GET_H); \ +} while (0) + +#define Lndecode(decode) \ +do \ +{ \ + check_delay_PC(); \ + (decode)->dst = DST_CODE; \ + decode_dest(decode, LOCAL, 0); \ +} while (0) + +#define LLdecode(decode) \ +do \ +{ \ + check_delay_PC(); \ + decode_LL(decode); \ +} while (0) + +#define LLextdecode(decode) \ +do \ +{ \ + hyperstone.instruction_length = 2; \ + EXTRA_U = READ_OP(PC); \ + PC += 2; \ + check_delay_PC(); \ + decode_LL(decode); \ +} while (0) + +#define LRdecode(decode, slocal) \ +do \ +{ \ + check_delay_PC(); \ + decode_LR(decode, slocal); \ +} while (0) + +#define LRconstdecode(decode, slocal) \ +do \ +{ \ + decode_const(decode); \ + check_delay_PC(); \ + decode_LR(decode, slocal); \ +} while (0) + +#define PCreldecode(decode) \ +do \ +{ \ + decode_pcrel(decode); \ + check_delay_PC(); \ +} while (0) + +#define PCadrdecode(decode) \ +do \ +{ \ + check_delay_PC(); \ +} while (0) + +#define no_decode(decode) \ +do \ +{ \ +} while (0) + + +INLINE void execute_br(struct regs_decode *decode) { PPC = PC; PC += EXTRA_S; change_pc(PC); SET_M(0); - hyperstone_ICount -= 2; + hyperstone_ICount -= hyperstone.clock_cycles_2; } -INLINE void execute_dbr(void) +INLINE void execute_dbr(struct regs_decode *decode) { - hyperstone.delay.delay_cmd = DELAY_TAKEN; + hyperstone.delay.delay_cmd = DELAY_EXECUTE; hyperstone.delay.delay_pc = PC + EXTRA_S; hyperstone.intblock = 3; @@ -1479,7 +1335,7 @@ static void execute_trap(UINT32 addr) PC = addr; change_pc(PC); - hyperstone_ICount -= 2; + hyperstone_ICount -= hyperstone.clock_cycles_2; } @@ -1509,7 +1365,7 @@ static void execute_int(UINT32 addr) PC = addr; change_pc(PC); - hyperstone_ICount -= 2; + hyperstone_ICount -= hyperstone.clock_cycles_2; } /* TODO: mask Parity Error and Extended Overflow exceptions */ @@ -1538,11 +1394,11 @@ static void execute_exception(UINT32 addr) PC = addr; change_pc(PC); - mame_printf_debug("EXCEPTION! PPC = %08X PC = %08X\n",PPC-2,PC-2); - hyperstone_ICount -= 2; + DEBUG_PRINTF(("EXCEPTION! PPC = %08X PC = %08X\n",PPC-2,PC-2)); + hyperstone_ICount -= hyperstone.clock_cycles_2; } -static void execute_software(void) +static void execute_software(struct regs_decode *decode) { UINT8 reg; UINT32 oldSR; @@ -1557,7 +1413,7 @@ static void execute_software(void) //since it's sure the register is in the register part of the stack, //set the stack address to a value above the highest address //that can be set by a following frame instruction - stack_of_dst = (SP & ~0xff) + 64*4 + (((GET_FP + current_regs.dst) % 64) * 4); //converted to 32bits offset + stack_of_dst = (SP & ~0xff) + 64*4 + (((GET_FP + decode->dst) % 64) * 4); //converted to 32bits offset oldSR = SR; @@ -1591,81 +1447,141 @@ static void execute_software(void) 6 - IO3 (trap 54) 7 - TIMER (trap 55) */ -static void set_irq_line(int irqline, int state) + +#define INT1_LINE_STATE ((ISR >> 0) & 1) +#define INT2_LINE_STATE ((ISR >> 1) & 1) +#define INT3_LINE_STATE ((ISR >> 2) & 1) +#define INT4_LINE_STATE ((ISR >> 3) & 1) +#define IO1_LINE_STATE ((ISR >> 4) & 1) +#define IO2_LINE_STATE ((ISR >> 5) & 1) +#define IO3_LINE_STATE ((ISR >> 6) & 1) + +static void check_interrupts(void) { /* Interrupt-Lock flag isn't set */ + if (GET_L || hyperstone.intblock > 0) + return; - if(hyperstone.intblock) + /* quick exit if nothing */ + if (!hyperstone.timer_int_pending && (ISR & 0x7f) == 0) return; - if( !GET_L && state ) + /* IO3 is priority 5; state is in bit 6 of ISR; FCR bit 10 enables input and FCR bit 8 inhibits interrupt */ + if (IO3_LINE_STATE && (FCR & 0x00000500) == 0x00000400) { - int execint=0; - switch(irqline) - { - case 0: if( (FCR&(1<<6)) && (!(FCR&(1<<4))) ) execint=1; // IO2 - break; - case 1: if( (FCR&(1<<2)) && (!(FCR&(1<<0))) ) execint=1; // IO1 - break; - case 2: if( !(FCR&(1<<31)) ) execint=1; // int 4 - break; - case 3: if( !(FCR&(1<<30)) ) execint=1; // int 3 - break; - case 4: if( !(FCR&(1<<29)) ) execint=1; // int 2 - break; - case 5: if( !(FCR&(1<<28)) ) execint=1; // int 1 - break; - case 6: if( (FCR&(1<<10)) && (!(FCR&(1<<8))) ) execint=1; // IO3 - break; - case 7: if( !(FCR&(1<<23)) ) execint=1; // timer - break; - } -/* - if( (FCR&(1<<6)) && (!(FCR&(1<<4))) ) mame_printf_debug("IO2 en\n"); // IO2 + execute_int(get_trap_addr(IO3)); + (*hyperstone.irq_callback)(IRQ_IO3); + return; + } + + /* timer int might be priority 6 if FCR bits 20-21 == 3; FCR bit 23 inhibits interrupt */ + if (hyperstone.timer_int_pending && (FCR & 0x00b00000) == 0x00300000) + { + hyperstone.timer_int_pending = 0; + execute_int(get_trap_addr(TIMER)); + return; + } + + /* INT1 is priority 7; state is in bit 0 of ISR; FCR bit 28 inhibits interrupt */ + if (INT1_LINE_STATE && (FCR & 0x10000000) == 0x00000000) + { + execute_int(get_trap_addr(INT1)); + (*hyperstone.irq_callback)(IRQ_INT1); + return; + } - if( (FCR&(1<<2)) && (!(FCR&(1<<0))) ) mame_printf_debug("IO1 en\n"); // IO1 + /* timer int might be priority 8 if FCR bits 20-21 == 2; FCR bit 23 inhibits interrupt */ + if (hyperstone.timer_int_pending && (FCR & 0x00b00000) == 0x00200000) + { + hyperstone.timer_int_pending = 0; + execute_int(get_trap_addr(TIMER)); + return; + } - if( !(FCR&(1<<31)) ) mame_printf_debug("int4 en\n"); // int 4 + /* INT2 is priority 9; state is in bit 1 of ISR; FCR bit 29 inhibits interrupt */ + if (INT2_LINE_STATE && (FCR & 0x20000000) == 0x00000000) + { + execute_int(get_trap_addr(INT2)); + (*hyperstone.irq_callback)(IRQ_INT2); + return; + } - if( !(FCR&(1<<30)) ) mame_printf_debug("int3 en\n"); // int 3 + /* timer int might be priority 10 if FCR bits 20-21 == 1; FCR bit 23 inhibits interrupt */ + if (hyperstone.timer_int_pending && (FCR & 0x00b00000) == 0x00100000) + { + hyperstone.timer_int_pending = 0; + execute_int(get_trap_addr(TIMER)); + return; + } - if( !(FCR&(1<<29)) ) mame_printf_debug("int2 en\n"); // int 2 + /* INT3 is priority 11; state is in bit 2 of ISR; FCR bit 30 inhibits interrupt */ + if (INT3_LINE_STATE && (FCR & 0x40000000) == 0x00000000) + { + execute_int(get_trap_addr(INT3)); + (*hyperstone.irq_callback)(IRQ_INT3); + return; + } - if( !(FCR&(1<<28)) ) mame_printf_debug("int1 en\n"); // int 1 + /* timer int might be priority 12 if FCR bits 20-21 == 0; FCR bit 23 inhibits interrupt */ + if (hyperstone.timer_int_pending && (FCR & 0x00b00000) == 0x00000000) + { + hyperstone.timer_int_pending = 0; + execute_int(get_trap_addr(TIMER)); + return; + } - if( (FCR&(1<<10)) && (!(FCR&(1<<8))) ) mame_printf_debug("IO3 en\n"); // IO3 + /* INT4 is priority 13; state is in bit 3 of ISR; FCR bit 31 inhibits interrupt */ + if (INT4_LINE_STATE && (FCR & 0x80000000) == 0x00000000) + { + execute_int(get_trap_addr(INT4)); + (*hyperstone.irq_callback)(IRQ_INT4); + return; + } - // if( !(FCR&(1<<23)) ) mame_printf_debug("timer irq!\n"); // timer -*/ - if(execint) - { - execute_int(get_trap_addr(irqline + 48)); - (*hyperstone.irq_callback)(irqline); - } + /* IO1 is priority 14; state is in bit 4 of ISR; FCR bit 2 enables input and FCR bit 0 inhibits interrupt */ + if (IO1_LINE_STATE && (FCR & 0x00000005) == 0x00000004) + { + execute_int(get_trap_addr(IO1)); + (*hyperstone.irq_callback)(IRQ_IO3); + return; + } + + /* IO2 is priority 15; state is in bit 5 of ISR; FCR bit 6 enables input and FCR bit 4 inhibits interrupt */ + if (IO2_LINE_STATE && (FCR & 0x00000050) == 0x00000040) + { + execute_int(get_trap_addr(IO2)); + (*hyperstone.irq_callback)(IRQ_IO2); + return; } } -static void hyperstone_init(int index, int clock, const void *config, int (*irqcallback)(int)) +static void set_irq_line(int irqline, int state) +{ + if (state) + ISR |= 1 << irqline; + else + ISR &= ~(1 << irqline); +} + +static void hyperstone_init(int index, int clock, const void *config, int (*irqcallback)(int), int scale_mask) { state_save_register_item_array("E132XS", index, hyperstone.global_regs); state_save_register_item_array("E132XS", index, hyperstone.local_regs); state_save_register_item("E132XS", index, hyperstone.ppc); state_save_register_item("E132XS", index, hyperstone.trap_entry); state_save_register_item("E132XS", index, hyperstone.delay.delay_pc); - state_save_register_item("E132XS", index, hyperstone.op); - state_save_register_item("E132XS", index, hyperstone.n); - state_save_register_item("E132XS", index, hyperstone.h_clear); state_save_register_item("E132XS", index, hyperstone.instruction_length); state_save_register_item("E132XS", index, hyperstone.intblock); - state_save_register_item("E132XS", index, hyperstone.delay_timer); state_save_register_item("E132XS", index, hyperstone.delay.delay_cmd); - state_save_register_item("E132XS", index, hyperstone.timer_clocks); + state_save_register_item("E132XS", index, hyperstone.tr_clocks_per_tick); hyperstone.irq_callback = irqcallback; + hyperstone.timer = timer_alloc(timer_callback); + hyperstone.clock_scale_mask = scale_mask; } #if (HAS_E116T || HAS_E116XT || HAS_E116XS || HAS_E116XSR || HAS_GMS30C2116 || HAS_GMS30C2216) -static void e116_init(int index, int clock, const void *config, int (*irqcallback)(int)) +static void e116_init(int index, int clock, const void *config, int (*irqcallback)(int), int scale_mask) { hyp_cpu_read_byte = program_read_byte_16be; hyp_cpu_read_half_word = program_read_word_16be; @@ -1679,12 +1595,42 @@ static void e116_init(int index, int clock, const void *config, int (*irqcallbac hyp_type_16bit = 1; - hyperstone_init(index, clock, config, irqcallback); + hyperstone_init(index, clock, config, irqcallback, scale_mask); +} + +static void e116t_init(int index, int clock, const void *config, int (*irqcallback)(int)) +{ + e116_init(index, clock, config, irqcallback, 0); +} + +static void e116xt_init(int index, int clock, const void *config, int (*irqcallback)(int)) +{ + e116_init(index, clock, config, irqcallback, 3); +} + +static void e116xs_init(int index, int clock, const void *config, int (*irqcallback)(int)) +{ + e116_init(index, clock, config, irqcallback, 7); +} + +static void e116xsr_init(int index, int clock, const void *config, int (*irqcallback)(int)) +{ + e116_init(index, clock, config, irqcallback, 7); +} + +static void gms30c2116_init(int index, int clock, const void *config, int (*irqcallback)(int)) +{ + e116_init(index, clock, config, irqcallback, 0); +} + +static void gms30c2216_init(int index, int clock, const void *config, int (*irqcallback)(int)) +{ + e116_init(index, clock, config, irqcallback, 0); } #endif #if (HAS_E132N || HAS_E132T || HAS_E132XN || HAS_E132XT || HAS_E132XS || HAS_E132XSR || HAS_GMS30C2132 || HAS_GMS30C2232) -static void e132_init(int index, int clock, const void *config, int (*irqcallback)(int)) +static void e132_init(int index, int clock, const void *config, int (*irqcallback)(int), int scale_mask) { hyp_cpu_read_byte = program_read_byte_32be; hyp_cpu_read_half_word = program_read_word_32be; @@ -1698,7 +1644,47 @@ static void e132_init(int index, int clock, const void *config, int (*irqcallbac hyp_type_16bit = 0; - hyperstone_init(index, clock, config, irqcallback); + hyperstone_init(index, clock, config, irqcallback, scale_mask); +} + +static void e132n_init(int index, int clock, const void *config, int (*irqcallback)(int)) +{ + e132_init(index, clock, config, irqcallback, 0); +} + +static void e132t_init(int index, int clock, const void *config, int (*irqcallback)(int)) +{ + e132_init(index, clock, config, irqcallback, 0); +} + +static void e132xn_init(int index, int clock, const void *config, int (*irqcallback)(int)) +{ + e132_init(index, clock, config, irqcallback, 3); +} + +static void e132xt_init(int index, int clock, const void *config, int (*irqcallback)(int)) +{ + e132_init(index, clock, config, irqcallback, 3); +} + +static void e132xs_init(int index, int clock, const void *config, int (*irqcallback)(int)) +{ + e132_init(index, clock, config, irqcallback, 7); +} + +static void e132xsr_init(int index, int clock, const void *config, int (*irqcallback)(int)) +{ + e132_init(index, clock, config, irqcallback, 7); +} + +static void gms30c2132_init(int index, int clock, const void *config, int (*irqcallback)(int)) +{ + e132_init(index, clock, config, irqcallback, 0); +} + +static void gms30c2232_init(int index, int clock, const void *config, int (*irqcallback)(int)) +{ + e132_init(index, clock, config, irqcallback, 0); } #endif @@ -1706,14 +1692,16 @@ static void hyperstone_reset(void) { //TODO: Add different reset initializations for BCR, MCR, FCR, TPR + emu_timer *save_timer; int (*save_irqcallback)(int); + save_timer = hyperstone.timer; save_irqcallback = hyperstone.irq_callback; memset(&hyperstone, 0, sizeof(hyperstone_regs)); hyperstone.irq_callback = save_irqcallback; + hyperstone.timer = save_timer; - hyperstone.h_clear = 0; - hyperstone.instruction_length = 0; + hyperstone.tr_clocks_per_tick = 2; hyperstone_set_trap_entry(E132XS_ENTRY_MEM3); /* default entry point @ MEM3 */ @@ -1736,7 +1724,7 @@ static void hyperstone_reset(void) SET_L_REG(0, (PC & 0xfffffffe) | GET_S); SET_L_REG(1, SR); - hyperstone_ICount -= 2; + hyperstone_ICount -= hyperstone.clock_cycles_2; } static void hyperstone_exit(void) @@ -1744,120 +1732,6 @@ static void hyperstone_exit(void) // nothing to do } -/* Handle the timer, increasing its value after "timer_clocks" clocks and returning the new icount base that needs to be used for the next check */ -static int handle_timers(int current_icount, int previous_icount) -{ - int diff = previous_icount - current_icount; - int new_icount_base; - - if(diff >= hyperstone.timer_clocks) - { - TR++; // wrap around to 0 modulo 32 bits - - if( hyperstone.delay_timer ) - { - hyperstone.delay_timer = 0; - hyperstone.timer_clocks = hyperstone.n + 2; - } - - new_icount_base = current_icount + (diff - hyperstone.timer_clocks); - } - else - { - new_icount_base = previous_icount; - } - - if(!hyperstone.intblock) - { - if( !((TR - TCR) & 0x80000000) ) - { - /* generate a timer interrupt */ - set_irq_line(7, PULSE_LINE); - } - } - - return new_icount_base; -} - -static int hyperstone_execute(int cycles) -{ - int old_icount = cycles; - hyperstone_ICount = cycles; - - do - { - PPC = PC; /* copy PC to previous PC */ - - CALL_MAME_DEBUG; - - OP = READ_OP(PC); - - PC += 2; - - if(GET_H) - { - hyperstone.h_clear = 1; - } - - hyperstone.instruction_length = 1; - - /* clear 'current regs / flags' */ - current_regs.src = 0; - current_regs.dst = 0; - current_regs.src_value = 0; - current_regs.next_src_value = 0; - current_regs.dst_value = 0; - current_regs.next_dst_value = 0; - current_regs.sub_type = 0; - current_regs.extra.u = 0; - current_regs.extra.s = 0; - current_regs.set_src_register = NULL; - current_regs.set_dst_register = NULL; - current_regs.src_is_pc = 0; - current_regs.dst_is_pc = 0; - current_regs.src_is_sr = 0; - current_regs.dst_is_sr = 0; - current_regs.same_src_dst = 0; - current_regs.same_src_dstf = 0; - current_regs.same_srcf_dst = 0; - - /* decode current opcode details into current regs */ - hyperstone_decode[(OP & 0xff00) >> 8](); - - /* execute opcode */ - hyperstone_op[(OP & 0xff00) >> 8](); - - SET_ILC(hyperstone.instruction_length & 3); - - old_icount = handle_timers(hyperstone_ICount, old_icount); - - if(hyperstone.h_clear) - { - SET_H(0); - hyperstone.h_clear = 0; - } - - if( GET_T && GET_P && hyperstone.delay.delay_cmd == NO_DELAY ) /* Not in a Delayed Branch instructions */ - { - UINT32 addr = get_trap_addr(TRACE_EXCEPTION); - execute_exception(addr); - } - - if( hyperstone.delay.delay_cmd == DELAY_TAKEN ) - { - hyperstone.delay.delay_cmd = DELAY_EXECUTE; - } - - if(hyperstone.intblock > 0) - { - hyperstone.intblock--; - } - - } while( hyperstone_ICount > 0 ); - - return cycles - hyperstone_ICount; -} - static void hyperstone_get_context(void *regs) { /* copy the context */ @@ -1881,7 +1755,7 @@ static offs_t hyperstone_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const /* Opcodes */ -static void hyperstone_chk(void) +INLINE void hyperstone_chk(struct regs_decode *decode) { UINT32 addr = get_trap_addr(RANGE_ERROR); @@ -1904,10 +1778,10 @@ static void hyperstone_chk(void) } } - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_movd(void) +INLINE void hyperstone_movd(struct regs_decode *decode) { if( DST_IS_PC ) // Rd denotes PC { @@ -1918,7 +1792,7 @@ static void hyperstone_movd(void) if( SRC_IS_PC || SRC_IS_SR ) { - logerror("Denoted PC or SR in RET instruction. PC = %08X\n", PC); + DEBUG_PRINTF(("Denoted PC or SR in RET instruction. PC = %08X\n", PC)); } else { @@ -1929,6 +1803,8 @@ static void hyperstone_movd(void) PC = SET_PC(SREG); change_pc(PC); SR = (SREGF & 0xffe00000) | ((SREG & 0x01) << 18 ) | (SREGF & 0x3ffff); + if (hyperstone.intblock < 1) + hyperstone.intblock = 1; hyperstone.instruction_length = 0; // undefined @@ -1959,7 +1835,7 @@ static void hyperstone_movd(void) } //TODO: no 1! - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } else if( SRC_IS_SR ) // Rd doesn't denote PC and Rs denotes SR { @@ -1968,7 +1844,7 @@ static void hyperstone_movd(void) SET_Z(1); SET_N(0); - hyperstone_ICount -= 2; + hyperstone_ICount -= hyperstone.clock_cycles_2; } else // Rd doesn't denote PC and Rs doesn't denote SR { @@ -1981,21 +1857,21 @@ static void hyperstone_movd(void) SET_Z( tmp == 0 ? 1 : 0 ); SET_N( SIGN_BIT(SREG) ); - hyperstone_ICount -= 2; + hyperstone_ICount -= hyperstone.clock_cycles_2; } } -static void hyperstone_divu(void) +INLINE void hyperstone_divu(struct regs_decode *decode) { if( SAME_SRC_DST || SAME_SRC_DSTF ) { - logerror("Denoted the same register code in hyperstone_divu instruction. PC = %08X\n", PC); + DEBUG_PRINTF(("Denoted the same register code in hyperstone_divu instruction. PC = %08X\n", PC)); } else { if( SRC_IS_PC || SRC_IS_SR ) { - logerror("Denoted PC or SR as source register in hyperstone_divu instruction. PC = %08X\n", PC); + DEBUG_PRINTF(("Denoted PC or SR as source register in hyperstone_divu instruction. PC = %08X\n", PC)); } else { @@ -2031,20 +1907,20 @@ static void hyperstone_divu(void) } } - hyperstone_ICount -= 36; + hyperstone_ICount -= 36 << hyperstone.clock_scale; } -static void hyperstone_divs(void) +INLINE void hyperstone_divs(struct regs_decode *decode) { if( SAME_SRC_DST || SAME_SRC_DSTF ) { - logerror("Denoted the same register code in hyperstone_divs instruction. PC = %08X\n", PC); + DEBUG_PRINTF(("Denoted the same register code in hyperstone_divs instruction. PC = %08X\n", PC)); } else { if( SRC_IS_PC || SRC_IS_SR ) { - logerror("Denoted PC or SR as source register in hyperstone_divs instruction. PC = %08X\n", PC); + DEBUG_PRINTF(("Denoted PC or SR as source register in hyperstone_divs instruction. PC = %08X\n", PC)); } else { @@ -2080,18 +1956,18 @@ static void hyperstone_divs(void) } } - hyperstone_ICount -= 36; + hyperstone_ICount -= 36 << hyperstone.clock_scale; } -static void hyperstone_xm(void) +INLINE void hyperstone_xm(struct regs_decode *decode) { if( SRC_IS_SR || DST_IS_SR || DST_IS_PC ) { - logerror("Denoted PC or SR in hyperstone_xm. PC = %08X\n", PC); + DEBUG_PRINTF(("Denoted PC or SR in hyperstone_xm. PC = %08X\n", PC)); } else { - switch( current_regs.sub_type ) // x_code + switch( decode->sub_type ) // x_code { case 0: case 1: @@ -2109,7 +1985,7 @@ static void hyperstone_xm(void) } else { - SREG <<= current_regs.sub_type; + SREG <<= decode->sub_type; } break; @@ -2118,8 +1994,8 @@ static void hyperstone_xm(void) case 5: case 6: case 7: - current_regs.sub_type -= 4; - SREG <<= current_regs.sub_type; + decode->sub_type -= 4; + SREG <<= decode->sub_type; break; } @@ -2127,20 +2003,20 @@ static void hyperstone_xm(void) SET_DREG(SREG); } - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_mask(void) +INLINE void hyperstone_mask(struct regs_decode *decode) { DREG = SREG & EXTRA_U; SET_DREG(DREG); SET_Z( DREG == 0 ? 1 : 0 ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_sum(void) +INLINE void hyperstone_sum(struct regs_decode *decode) { UINT64 tmp; @@ -2161,10 +2037,10 @@ static void hyperstone_sum(void) SET_Z( DREG == 0 ? 1 : 0 ); SET_N( SIGN_BIT(DREG) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_sums(void) +INLINE void hyperstone_sums(struct regs_decode *decode) { INT32 res; INT64 tmp; @@ -2186,7 +2062,7 @@ static void hyperstone_sums(void) SET_Z( res == 0 ? 1 : 0 ); SET_N( SIGN_BIT(res) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; if( GET_V && !SRC_IS_SR ) { @@ -2195,7 +2071,7 @@ static void hyperstone_sums(void) } } -static void hyperstone_cmp(void) +INLINE void hyperstone_cmp(struct regs_decode *decode) { UINT64 tmp; @@ -2220,12 +2096,12 @@ static void hyperstone_cmp(void) else SET_C(0); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_mov(void) +INLINE void hyperstone_mov(struct regs_decode *decode) { - if( !GET_S && current_regs.dst >= 16 ) + if( !GET_S && decode->dst >= 16 ) { UINT32 addr = get_trap_addr(PRIVILEGE_ERROR); execute_exception(addr); @@ -2239,11 +2115,11 @@ static void hyperstone_mov(void) SET_Z( SREG == 0 ? 1 : 0 ); SET_N( SIGN_BIT(SREG) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_add(void) +INLINE void hyperstone_add(struct regs_decode *decode) { UINT64 tmp; @@ -2263,10 +2139,10 @@ static void hyperstone_add(void) SET_Z( DREG == 0 ? 1 : 0 ); SET_N( SIGN_BIT(DREG) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_adds(void) +INLINE void hyperstone_adds(struct regs_decode *decode) { INT32 res; INT64 tmp; @@ -2288,7 +2164,7 @@ static void hyperstone_adds(void) SET_Z( res == 0 ? 1 : 0 ); SET_N( SIGN_BIT(res) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; if( GET_V ) { @@ -2297,44 +2173,44 @@ static void hyperstone_adds(void) } } -static void hyperstone_cmpb(void) +INLINE void hyperstone_cmpb(struct regs_decode *decode) { SET_Z( (DREG & SREG) == 0 ? 1 : 0 ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_andn(void) +INLINE void hyperstone_andn(struct regs_decode *decode) { DREG = DREG & ~SREG; SET_DREG(DREG); SET_Z( DREG == 0 ? 1 : 0 ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_or(void) +INLINE void hyperstone_or(struct regs_decode *decode) { DREG = DREG | SREG; SET_DREG(DREG); SET_Z( DREG == 0 ? 1 : 0 ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_xor(void) +INLINE void hyperstone_xor(struct regs_decode *decode) { DREG = DREG ^ SREG; SET_DREG(DREG); SET_Z( DREG == 0 ? 1 : 0 ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_subc(void) +INLINE void hyperstone_subc(struct regs_decode *decode) { UINT64 tmp; @@ -2367,18 +2243,18 @@ static void hyperstone_subc(void) SET_Z( GET_Z & (DREG == 0 ? 1 : 0) ); SET_N( SIGN_BIT(DREG) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_not(void) +INLINE void hyperstone_not(struct regs_decode *decode) { SET_DREG(~SREG); SET_Z( ~SREG == 0 ? 1 : 0 ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_sub(void) +INLINE void hyperstone_sub(struct regs_decode *decode) { UINT64 tmp; @@ -2398,10 +2274,10 @@ static void hyperstone_sub(void) SET_Z( DREG == 0 ? 1 : 0 ); SET_N( SIGN_BIT(DREG) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_subs(void) +INLINE void hyperstone_subs(struct regs_decode *decode) { INT32 res; INT64 tmp; @@ -2424,7 +2300,7 @@ static void hyperstone_subs(void) SET_Z( res == 0 ? 1 : 0 ); SET_N( SIGN_BIT(res) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; if( GET_V ) { @@ -2433,7 +2309,7 @@ static void hyperstone_subs(void) } } -static void hyperstone_addc(void) +INLINE void hyperstone_addc(struct regs_decode *decode) { UINT64 tmp; @@ -2471,20 +2347,20 @@ static void hyperstone_addc(void) SET_Z( GET_Z & (DREG == 0 ? 1 : 0) ); SET_N( SIGN_BIT(DREG) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_and(void) +INLINE void hyperstone_and(struct regs_decode *decode) { DREG = DREG & SREG; SET_DREG(DREG); SET_Z( DREG == 0 ? 1 : 0 ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_neg(void) +INLINE void hyperstone_neg(struct regs_decode *decode) { UINT64 tmp; @@ -2502,10 +2378,10 @@ static void hyperstone_neg(void) SET_Z( DREG == 0 ? 1 : 0 ); SET_N( SIGN_BIT(DREG) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_negs(void) +INLINE void hyperstone_negs(struct regs_decode *decode) { INT32 res; INT64 tmp; @@ -2528,7 +2404,7 @@ static void hyperstone_negs(void) SET_N( SIGN_BIT(res) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; if( GET_V && !SRC_IS_SR ) //trap doesn't occur when source is SR { @@ -2537,7 +2413,7 @@ static void hyperstone_negs(void) } } -static void hyperstone_cmpi(void) +INLINE void hyperstone_cmpi(struct regs_decode *decode) { UINT64 tmp; @@ -2559,12 +2435,12 @@ static void hyperstone_cmpi(void) else SET_C(0); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_movi(void) +INLINE void hyperstone_movi(struct regs_decode *decode) { - if( !GET_S && current_regs.dst >= 16 ) + if( !GET_S && decode->dst >= 16 ) { UINT32 addr = get_trap_addr(PRIVILEGE_ERROR); execute_exception(addr); @@ -2582,10 +2458,10 @@ static void hyperstone_movi(void) SET_V(0); // or V undefined ? #endif - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_addi(void) +INLINE void hyperstone_addi(struct regs_decode *decode) { UINT32 imm; UINT64 tmp; @@ -2609,10 +2485,10 @@ static void hyperstone_addi(void) SET_Z( DREG == 0 ? 1 : 0 ); SET_N( SIGN_BIT(DREG) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_addsi(void) +INLINE void hyperstone_addsi(struct regs_decode *decode) { INT32 imm, res; INT64 tmp; @@ -2636,7 +2512,7 @@ static void hyperstone_addsi(void) SET_Z( res == 0 ? 1 : 0 ); SET_N( SIGN_BIT(res) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; if( GET_V ) { @@ -2645,7 +2521,7 @@ static void hyperstone_addsi(void) } } -static void hyperstone_cmpbi(void) +INLINE void hyperstone_cmpbi(struct regs_decode *decode) { UINT32 imm; @@ -2671,10 +2547,10 @@ static void hyperstone_cmpbi(void) SET_Z(0); } - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_andni(void) +INLINE void hyperstone_andni(struct regs_decode *decode) { UINT32 imm; @@ -2688,30 +2564,30 @@ static void hyperstone_andni(void) SET_DREG(DREG); SET_Z( DREG == 0 ? 1 : 0 ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_ori(void) +INLINE void hyperstone_ori(struct regs_decode *decode) { DREG = DREG | EXTRA_U; SET_DREG(DREG); SET_Z( DREG == 0 ? 1 : 0 ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_xori(void) +INLINE void hyperstone_xori(struct regs_decode *decode) { DREG = DREG ^ EXTRA_U; SET_DREG(DREG); SET_Z( DREG == 0 ? 1 : 0 ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_shrdi(void) +INLINE void hyperstone_shrdi(struct regs_decode *decode) { UINT32 low_order, high_order; UINT64 val; @@ -2736,10 +2612,10 @@ static void hyperstone_shrdi(void) SET_Z( val == 0 ? 1 : 0 ); SET_N( SIGN_BIT(high_order) ); - hyperstone_ICount -= 2; + hyperstone_ICount -= hyperstone.clock_cycles_2; } -static void hyperstone_shrd(void) +INLINE void hyperstone_shrd(struct regs_decode *decode) { UINT32 low_order, high_order; UINT64 val; @@ -2748,7 +2624,7 @@ static void hyperstone_shrd(void) // result undefined if Ls denotes the same register as Ld or Ldf if( SAME_SRC_DST || SAME_SRC_DSTF ) { - logerror("Denoted same registers in hyperstone_shrd. PC = %08X\n", PC); + DEBUG_PRINTF(("Denoted same registers in hyperstone_shrd. PC = %08X\n", PC)); } else { @@ -2774,10 +2650,10 @@ static void hyperstone_shrd(void) SET_N( SIGN_BIT(high_order) ); } - hyperstone_ICount -= 2; + hyperstone_ICount -= hyperstone.clock_cycles_2; } -static void hyperstone_shr(void) +INLINE void hyperstone_shr(struct regs_decode *decode) { UINT32 ret; UINT8 n; @@ -2796,10 +2672,10 @@ static void hyperstone_shr(void) SET_Z( ret == 0 ? 1 : 0 ); SET_N( SIGN_BIT(ret) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_sardi(void) +INLINE void hyperstone_sardi(struct regs_decode *decode) { UINT32 low_order, high_order; UINT64 val; @@ -2836,10 +2712,10 @@ static void hyperstone_sardi(void) SET_Z( val == 0 ? 1 : 0 ); SET_N( SIGN_BIT(high_order) ); - hyperstone_ICount -= 2; + hyperstone_ICount -= hyperstone.clock_cycles_2; } -static void hyperstone_sard(void) +INLINE void hyperstone_sard(struct regs_decode *decode) { UINT32 low_order, high_order; UINT64 val; @@ -2850,7 +2726,7 @@ static void hyperstone_sard(void) // result undefined if Ls denotes the same register as Ld or Ldf if( SAME_SRC_DST || SAME_SRC_DSTF ) { - logerror("Denoted same registers in hyperstone_sard. PC = %08X\n", PC); + DEBUG_PRINTF(("Denoted same registers in hyperstone_sard. PC = %08X\n", PC)); } else { @@ -2886,10 +2762,10 @@ static void hyperstone_sard(void) SET_N( SIGN_BIT(high_order) ); } - hyperstone_ICount -= 2; + hyperstone_ICount -= hyperstone.clock_cycles_2; } -static void hyperstone_sar(void) +INLINE void hyperstone_sar(struct regs_decode *decode) { UINT32 ret; UINT8 n, sign_bit; @@ -2918,10 +2794,10 @@ static void hyperstone_sar(void) SET_Z( ret == 0 ? 1 : 0 ); SET_N( SIGN_BIT(ret) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_shldi(void) +INLINE void hyperstone_shldi(struct regs_decode *decode) { UINT32 low_order, high_order, tmp; UINT64 val, mask; @@ -2951,10 +2827,10 @@ static void hyperstone_shldi(void) SET_Z( val == 0 ? 1 : 0 ); SET_N( SIGN_BIT(high_order) ); - hyperstone_ICount -= 2; + hyperstone_ICount -= hyperstone.clock_cycles_2; } -static void hyperstone_shld(void) +INLINE void hyperstone_shld(struct regs_decode *decode) { UINT32 low_order, high_order, tmp, n; UINT64 val, mask; @@ -2964,7 +2840,7 @@ static void hyperstone_shld(void) // result undefined if Ls denotes the same register as Ld or Ldf if( SAME_SRC_DST || SAME_SRC_DSTF ) { - logerror("Denoted same registers in hyperstone_shld. PC = %08X\n", PC); + DEBUG_PRINTF(("Denoted same registers in hyperstone_shld. PC = %08X\n", PC)); } else { @@ -2995,10 +2871,10 @@ static void hyperstone_shld(void) SET_N( SIGN_BIT(high_order) ); } - hyperstone_ICount -= 2; + hyperstone_ICount -= hyperstone.clock_cycles_2; } -static void hyperstone_shl(void) +INLINE void hyperstone_shl(struct regs_decode *decode) { UINT32 base, ret, n; UINT64 mask; @@ -3019,15 +2895,15 @@ static void hyperstone_shl(void) SET_Z( ret == 0 ? 1 : 0 ); SET_N( SIGN_BIT(ret) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void reserved(void) +static void reserved(struct regs_decode *decode) { - logerror("Executed Reserved opcode. PC = %08X OP = %04X\n", PC, OP); + DEBUG_PRINTF(("Executed Reserved opcode. PC = %08X OP = %04X\n", PC, OP)); } -static void hyperstone_testlz(void) +INLINE void hyperstone_testlz(struct regs_decode *decode) { UINT8 zeros = 0; UINT32 mask; @@ -3045,10 +2921,10 @@ static void hyperstone_testlz(void) SET_DREG(zeros); - hyperstone_ICount -= 2; + hyperstone_ICount -= hyperstone.clock_cycles_2; } -static void hyperstone_rol(void) +INLINE void hyperstone_rol(struct regs_decode *decode) { UINT32 val, base; UINT8 n; @@ -3081,17 +2957,17 @@ static void hyperstone_rol(void) SET_Z( val == 0 ? 1 : 0 ); SET_N( SIGN_BIT(val) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } //TODO: add trap error -static void hyperstone_ldxx1(void) +INLINE void hyperstone_ldxx1(struct regs_decode *decode) { UINT32 load; if( DST_IS_SR ) { - switch( current_regs.sub_type ) + switch( decode->sub_type ) { case 0: // LDBS.A @@ -3137,7 +3013,7 @@ static void hyperstone_ldxx1(void) load = IO_READ_W((EXTRA_S & ~3) + 4); SET_SREGF(load); - hyperstone_ICount -= 1; // extra cycle + hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle } else if( (EXTRA_S & 3) == 2 ) // LDW.IOA { @@ -3152,7 +3028,7 @@ static void hyperstone_ldxx1(void) load = READ_W((EXTRA_S & ~1) + 4); SET_SREGF(load); - hyperstone_ICount -= 1; // extra cycle + hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle } else // LDW.A { @@ -3165,7 +3041,7 @@ static void hyperstone_ldxx1(void) } else { - switch( current_regs.sub_type ) + switch( decode->sub_type ) { case 0: // LDBS.D @@ -3211,7 +3087,7 @@ static void hyperstone_ldxx1(void) load = IO_READ_W(DREG + (EXTRA_S & ~3) + 4); SET_SREGF(load); - hyperstone_ICount -= 1; // extra cycle + hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle } else if( (EXTRA_S & 3) == 2 ) // LDW.IOD { @@ -3226,7 +3102,7 @@ static void hyperstone_ldxx1(void) load = READ_W(DREG + (EXTRA_S & ~1) + 4); SET_SREGF(load); - hyperstone_ICount -= 1; // extra cycle + hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle } else // LDW.D { @@ -3238,25 +3114,25 @@ static void hyperstone_ldxx1(void) } } - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_ldxx2(void) +INLINE void hyperstone_ldxx2(struct regs_decode *decode) { UINT32 load; if( DST_IS_PC || DST_IS_SR ) { - logerror("Denoted PC or SR in hyperstone_ldxx2. PC = %08X\n", PC); + DEBUG_PRINTF(("Denoted PC or SR in hyperstone_ldxx2. PC = %08X\n", PC)); } else { - switch( current_regs.sub_type ) + switch( decode->sub_type ) { case 0: // LDBS.N if(SAME_SRC_DST) - popmessage("LDBS.N denoted same regs @ %08X",PPC); + DEBUG_PRINTF(("LDBS.N denoted same regs @ %08X",PPC)); load = READ_B(DREG); load |= (load & 0x80) ? 0xffffff00 : 0; @@ -3270,7 +3146,7 @@ static void hyperstone_ldxx2(void) case 1: // LDBU.N if(SAME_SRC_DST) - popmessage("LDBU.N denoted same regs @ %08X",PPC); + DEBUG_PRINTF(("LDBU.N denoted same regs @ %08X",PPC)); load = READ_B(DREG); SET_SREG(load); @@ -3289,7 +3165,7 @@ static void hyperstone_ldxx2(void) load |= (load & 0x8000) ? 0xffff0000 : 0; if(SAME_SRC_DST) - popmessage("LDHS.N denoted same regs @ %08X",PPC); + DEBUG_PRINTF(("LDHS.N denoted same regs @ %08X",PPC)); } /* else // LDHU.N @@ -3310,7 +3186,7 @@ static void hyperstone_ldxx2(void) if( (EXTRA_S & 3) == 3 ) // LDW.S { if(SAME_SRC_DST) - popmessage("LDW.S denoted same regs @ %08X",PPC); + DEBUG_PRINTF(("LDW.S denoted same regs @ %08X",PPC)); if(DREG < SP) SET_SREG(READ_W(DREG)); @@ -3320,16 +3196,16 @@ static void hyperstone_ldxx2(void) if(!SAME_SRC_DST) SET_DREG(DREG + (EXTRA_S & ~3)); - hyperstone_ICount -= 2; // extra cycles + hyperstone_ICount -= hyperstone.clock_cycles_2; // extra cycles } else if( (EXTRA_S & 3) == 2 ) // Reserved { - logerror("Executed Reserved instruction in hyperstone_ldxx2. PC = %08X\n", PC); + DEBUG_PRINTF(("Executed Reserved instruction in hyperstone_ldxx2. PC = %08X\n", PC)); } else if( (EXTRA_S & 3) == 1 ) // LDD.N { if(SAME_SRC_DST || SAME_SRCF_DST) - popmessage("LDD.N denoted same regs @ %08X",PPC); + DEBUG_PRINTF(("LDD.N denoted same regs @ %08X",PPC)); load = READ_W(DREG); SET_SREG(load); @@ -3340,12 +3216,12 @@ static void hyperstone_ldxx2(void) if(!SAME_SRC_DST && !SAME_SRCF_DST) SET_DREG(DREG + (EXTRA_S & ~1)); - hyperstone_ICount -= 1; // extra cycle + hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle } else // LDW.N { if(SAME_SRC_DST) - popmessage("LDW.N denoted same regs @ %08X",PPC); + DEBUG_PRINTF(("LDW.N denoted same regs @ %08X",PPC)); load = READ_W(DREG); SET_SREG(load); @@ -3358,18 +3234,18 @@ static void hyperstone_ldxx2(void) } } - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } //TODO: add trap error -static void hyperstone_stxx1(void) +INLINE void hyperstone_stxx1(struct regs_decode *decode) { if( SRC_IS_SR ) SREG = SREGF = 0; if( DST_IS_SR ) { - switch( current_regs.sub_type ) + switch( decode->sub_type ) { case 0: // STBS.A @@ -3408,7 +3284,7 @@ static void hyperstone_stxx1(void) IO_WRITE_W(EXTRA_S & ~3, SREG); IO_WRITE_W((EXTRA_S & ~3) + 4, SREGF); - hyperstone_ICount -= 1; // extra cycle + hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle } else if( (EXTRA_S & 3) == 2 ) // STW.IOA { @@ -3419,7 +3295,7 @@ static void hyperstone_stxx1(void) WRITE_W(EXTRA_S & ~1, SREG); WRITE_W((EXTRA_S & ~1) + 4, SREGF); - hyperstone_ICount -= 1; // extra cycle + hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle } else // STW.A { @@ -3431,7 +3307,7 @@ static void hyperstone_stxx1(void) } else { - switch( current_regs.sub_type ) + switch( decode->sub_type ) { case 0: // STBS.D @@ -3470,7 +3346,7 @@ static void hyperstone_stxx1(void) IO_WRITE_W(DREG + (EXTRA_S & ~3), SREG); IO_WRITE_W(DREG + (EXTRA_S & ~3) + 4, SREGF); - hyperstone_ICount -= 1; // extra cycle + hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle } else if( (EXTRA_S & 3) == 2 ) // STW.IOD { @@ -3481,7 +3357,7 @@ static void hyperstone_stxx1(void) WRITE_W(DREG + (EXTRA_S & ~1), SREG); WRITE_W(DREG + (EXTRA_S & ~1) + 4, SREGF); - hyperstone_ICount -= 1; // extra cycle + hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle } else // STW.D { @@ -3492,21 +3368,21 @@ static void hyperstone_stxx1(void) } } - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_stxx2(void) +INLINE void hyperstone_stxx2(struct regs_decode *decode) { if( SRC_IS_SR ) SREG = SREGF = 0; if( DST_IS_PC || DST_IS_SR ) { - logerror("Denoted PC or SR in hyperstone_stxx2. PC = %08X\n", PC); + DEBUG_PRINTF(("Denoted PC or SR in hyperstone_stxx2. PC = %08X\n", PC)); } else { - switch( current_regs.sub_type ) + switch( decode->sub_type ) { case 0: // STBS.N @@ -3549,20 +3425,20 @@ static void hyperstone_stxx2(void) WRITE_W(DREG, SREG); else { - if(((DREG & 0xfc) >> 2) == ((current_regs.src + GET_FP) % 64) && S_BIT == LOCAL) - popmessage("STW.S denoted the same local register @ %08X\n",PPC); + if(((DREG & 0xfc) >> 2) == ((decode->src + GET_FP) % 64) && S_BIT == LOCAL) + DEBUG_PRINTF(("STW.S denoted the same local register @ %08X\n",PPC)); SET_ABS_L_REG((DREG & 0xfc) >> 2,SREG); } SET_DREG(DREG + (EXTRA_S & ~3)); - hyperstone_ICount -= 2; // extra cycles + hyperstone_ICount -= hyperstone.clock_cycles_2; // extra cycles } else if( (EXTRA_S & 3) == 2 ) // Reserved { - logerror("Executed Reserved instruction in hyperstone_stxx2. PC = %08X\n", PC); + DEBUG_PRINTF(("Executed Reserved instruction in hyperstone_stxx2. PC = %08X\n", PC)); } else if( (EXTRA_S & 3) == 1 ) // STD.N { @@ -3574,7 +3450,7 @@ static void hyperstone_stxx2(void) else WRITE_W(DREG + 4, SREGF); - hyperstone_ICount -= 1; // extra cycle + hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle } else // STW.N { @@ -3586,10 +3462,10 @@ static void hyperstone_stxx2(void) } } - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_shri(void) +INLINE void hyperstone_shri(struct regs_decode *decode) { UINT32 val; @@ -3606,10 +3482,10 @@ static void hyperstone_shri(void) SET_Z( val == 0 ? 1 : 0 ); SET_N( SIGN_BIT(val) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_sari(void) +INLINE void hyperstone_sari(struct regs_decode *decode) { UINT32 val; UINT8 sign_bit; @@ -3637,10 +3513,10 @@ static void hyperstone_sari(void) SET_Z( val == 0 ? 1 : 0 ); SET_N( SIGN_BIT(val) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_shli(void) +INLINE void hyperstone_shli(struct regs_decode *decode) { UINT32 val, val2; UINT64 mask; @@ -3660,10 +3536,10 @@ static void hyperstone_shli(void) SET_Z( val2 == 0 ? 1 : 0 ); SET_N( SIGN_BIT(val2) ); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_mulu(void) +INLINE void hyperstone_mulu(struct regs_decode *decode) { UINT32 low_order, high_order; UINT64 double_word; @@ -3671,7 +3547,7 @@ static void hyperstone_mulu(void) // PC or SR aren't denoted, else result is undefined if( SRC_IS_PC || SRC_IS_SR || DST_IS_PC || DST_IS_SR ) { - logerror("Denoted PC or SR in hyperstone_mulu instruction. PC = %08X\n", PC); + DEBUG_PRINTF(("Denoted PC or SR in hyperstone_mulu instruction. PC = %08X\n", PC)); } else { @@ -3688,12 +3564,12 @@ static void hyperstone_mulu(void) } if(SREG <= 0xffff && DREG <= 0xffff) - hyperstone_ICount -= 4; + hyperstone_ICount -= hyperstone.clock_cycles_4; else - hyperstone_ICount -= 6; + hyperstone_ICount -= hyperstone.clock_cycles_6; } -static void hyperstone_muls(void) +INLINE void hyperstone_muls(struct regs_decode *decode) { UINT32 low_order, high_order; INT64 double_word; @@ -3701,7 +3577,7 @@ static void hyperstone_muls(void) // PC or SR aren't denoted, else result is undefined if( SRC_IS_PC || SRC_IS_SR || DST_IS_PC || DST_IS_SR ) { - logerror("Denoted PC or SR in hyperstone_muls instruction. PC = %08X\n", PC); + DEBUG_PRINTF(("Denoted PC or SR in hyperstone_muls instruction. PC = %08X\n", PC)); } else { @@ -3717,25 +3593,25 @@ static void hyperstone_muls(void) } if((SREG >= 0xffff8000 && SREG <= 0x7fff) && (DREG >= 0xffff8000 && DREG <= 0x7fff)) - hyperstone_ICount -= 4; + hyperstone_ICount -= hyperstone.clock_cycles_4; else - hyperstone_ICount -= 6; + hyperstone_ICount -= hyperstone.clock_cycles_6; } -static void hyperstone_set(void) +INLINE void hyperstone_set(struct regs_decode *decode) { int n = N_VALUE; if( DST_IS_PC ) { - logerror("Denoted PC in hyperstone_set. PC = %08X\n", PC); + DEBUG_PRINTF(("Denoted PC in hyperstone_set. PC = %08X\n", PC)); } else if( DST_IS_SR ) { //TODO: add fetch opcode when there's the pipeline //TODO: no 1! - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } else { @@ -3759,7 +3635,7 @@ static void hyperstone_set(void) case 16: case 17: case 19: - logerror("Used reserved N value (%d) in hyperstone_set. PC = %08X\n", n, PC); + DEBUG_PRINTF(("Used reserved N value (%d) in hyperstone_set. PC = %08X\n", n, PC)); break; // SETxx @@ -4064,18 +3940,18 @@ static void hyperstone_set(void) break; } - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } } -static void hyperstone_mul(void) +INLINE void hyperstone_mul(struct regs_decode *decode) { UINT32 single_word; // PC or SR aren't denoted, else result is undefined if( SRC_IS_PC || SRC_IS_SR || DST_IS_PC || DST_IS_SR ) { - logerror("Denoted PC or SR in hyperstone_mul instruction. PC = %08X\n", PC); + DEBUG_PRINTF(("Denoted PC or SR in hyperstone_mul instruction. PC = %08X\n", PC)); } else { @@ -4088,96 +3964,96 @@ static void hyperstone_mul(void) } if((SREG >= 0xffff8000 && SREG <= 0x7fff) && (DREG >= 0xffff8000 && DREG <= 0x7fff)) - hyperstone_ICount -= 3; + hyperstone_ICount -= 3 << hyperstone.clock_scale; else - hyperstone_ICount -= 5; + hyperstone_ICount -= 5 << hyperstone.clock_scale; } -static void hyperstone_fadd(void) +INLINE void hyperstone_fadd(struct regs_decode *decode) { - execute_software(); - hyperstone_ICount -= 6; + execute_software(decode); + hyperstone_ICount -= hyperstone.clock_cycles_6; } -static void hyperstone_faddd(void) +INLINE void hyperstone_faddd(struct regs_decode *decode) { - execute_software(); - hyperstone_ICount -= 6; + execute_software(decode); + hyperstone_ICount -= hyperstone.clock_cycles_6; } -static void hyperstone_fsub(void) +INLINE void hyperstone_fsub(struct regs_decode *decode) { - execute_software(); - hyperstone_ICount -= 6; + execute_software(decode); + hyperstone_ICount -= hyperstone.clock_cycles_6; } -static void hyperstone_fsubd(void) +INLINE void hyperstone_fsubd(struct regs_decode *decode) { - execute_software(); - hyperstone_ICount -= 6; + execute_software(decode); + hyperstone_ICount -= hyperstone.clock_cycles_6; } -static void hyperstone_fmul(void) +INLINE void hyperstone_fmul(struct regs_decode *decode) { - execute_software(); - hyperstone_ICount -= 6; + execute_software(decode); + hyperstone_ICount -= hyperstone.clock_cycles_6; } -static void hyperstone_fmuld(void) +INLINE void hyperstone_fmuld(struct regs_decode *decode) { - execute_software(); - hyperstone_ICount -= 6; + execute_software(decode); + hyperstone_ICount -= hyperstone.clock_cycles_6; } -static void hyperstone_fdiv(void) +INLINE void hyperstone_fdiv(struct regs_decode *decode) { - execute_software(); - hyperstone_ICount -= 6; + execute_software(decode); + hyperstone_ICount -= hyperstone.clock_cycles_6; } -static void hyperstone_fdivd(void) +INLINE void hyperstone_fdivd(struct regs_decode *decode) { - execute_software(); - hyperstone_ICount -= 6; + execute_software(decode); + hyperstone_ICount -= hyperstone.clock_cycles_6; } -static void hyperstone_fcmp(void) +INLINE void hyperstone_fcmp(struct regs_decode *decode) { - execute_software(); - hyperstone_ICount -= 6; + execute_software(decode); + hyperstone_ICount -= hyperstone.clock_cycles_6; } -static void hyperstone_fcmpd(void) +INLINE void hyperstone_fcmpd(struct regs_decode *decode) { - execute_software(); - hyperstone_ICount -= 6; + execute_software(decode); + hyperstone_ICount -= hyperstone.clock_cycles_6; } -static void hyperstone_fcmpu(void) +INLINE void hyperstone_fcmpu(struct regs_decode *decode) { - execute_software(); - hyperstone_ICount -= 6; + execute_software(decode); + hyperstone_ICount -= hyperstone.clock_cycles_6; } -static void hyperstone_fcmpud(void) +INLINE void hyperstone_fcmpud(struct regs_decode *decode) { - execute_software(); - hyperstone_ICount -= 6; + execute_software(decode); + hyperstone_ICount -= hyperstone.clock_cycles_6; } -static void hyperstone_fcvt(void) +INLINE void hyperstone_fcvt(struct regs_decode *decode) { - execute_software(); - hyperstone_ICount -= 6; + execute_software(decode); + hyperstone_ICount -= hyperstone.clock_cycles_6; } -static void hyperstone_fcvtd(void) +INLINE void hyperstone_fcvtd(struct regs_decode *decode) { - execute_software(); - hyperstone_ICount -= 6; + execute_software(decode); + hyperstone_ICount -= hyperstone.clock_cycles_6; } -static void hyperstone_extend(void) +INLINE void hyperstone_extend(struct regs_decode *decode) { //TODO: add locks, overflow error and other things UINT32 vals, vald; @@ -4371,75 +4247,75 @@ static void hyperstone_extend(void) break; } default: - logerror("Executed Illegal extended opcode (%X). PC = %08X\n", EXTRA_U, PC); + DEBUG_PRINTF(("Executed Illegal extended opcode (%X). PC = %08X\n", EXTRA_U, PC)); break; } - hyperstone_ICount -= 1; //TODO: with the latency it can change + hyperstone_ICount -= hyperstone.clock_cycles_1; //TODO: with the latency it can change } -static void hyperstone_do(void) +INLINE void hyperstone_do(struct regs_decode *decode) { fatalerror("Executed hyperstone_do instruction. PC = %08X", PPC); } -static void hyperstone_ldwr(void) +INLINE void hyperstone_ldwr(struct regs_decode *decode) { SET_SREG(READ_W(DREG)); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_lddr(void) +INLINE void hyperstone_lddr(struct regs_decode *decode) { SET_SREG(READ_W(DREG)); SET_SREGF(READ_W(DREG + 4)); - hyperstone_ICount -= 2; + hyperstone_ICount -= hyperstone.clock_cycles_2; } -static void hyperstone_ldwp(void) +INLINE void hyperstone_ldwp(struct regs_decode *decode) { SET_SREG(READ_W(DREG)); // post increment the destination register if it's different from the source one // (needed by Hidden Catch) - if(!(current_regs.src == current_regs.dst && S_BIT == LOCAL)) + if(!(decode->src == decode->dst && S_BIT == LOCAL)) SET_DREG(DREG + 4); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_lddp(void) +INLINE void hyperstone_lddp(struct regs_decode *decode) { SET_SREG(READ_W(DREG)); SET_SREGF(READ_W(DREG + 4)); // post increment the destination register if it's different from the source one // and from the "next source" one - if(!(current_regs.src == current_regs.dst && S_BIT == LOCAL) && !SAME_SRCF_DST ) + if(!(decode->src == decode->dst && S_BIT == LOCAL) && !SAME_SRCF_DST ) { SET_DREG(DREG + 8); } else { - popmessage("LDD.P denoted same regs @ %08X",PPC); + DEBUG_PRINTF(("LDD.P denoted same regs @ %08X",PPC)); } - hyperstone_ICount -= 2; + hyperstone_ICount -= hyperstone.clock_cycles_2; } -static void hyperstone_stwr(void) +INLINE void hyperstone_stwr(struct regs_decode *decode) { if( SRC_IS_SR ) SREG = 0; WRITE_W(DREG, SREG); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_stdr(void) +INLINE void hyperstone_stdr(struct regs_decode *decode) { if( SRC_IS_SR ) SREG = SREGF = 0; @@ -4447,10 +4323,10 @@ static void hyperstone_stdr(void) WRITE_W(DREG, SREG); WRITE_W(DREG + 4, SREGF); - hyperstone_ICount -= 2; + hyperstone_ICount -= hyperstone.clock_cycles_2; } -static void hyperstone_stwp(void) +INLINE void hyperstone_stwp(struct regs_decode *decode) { if( SRC_IS_SR ) SREG = 0; @@ -4458,10 +4334,10 @@ static void hyperstone_stwp(void) WRITE_W(DREG, SREG); SET_DREG(DREG + 4); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_stdp(void) +INLINE void hyperstone_stdp(struct regs_decode *decode) { if( SRC_IS_SR ) SREG = SREGF = 0; @@ -4474,111 +4350,111 @@ static void hyperstone_stdp(void) else WRITE_W(DREG + 4, SREGF); - hyperstone_ICount -= 2; + hyperstone_ICount -= hyperstone.clock_cycles_2; } -static void hyperstone_dbv(void) +INLINE void hyperstone_dbv(struct regs_decode *decode) { if( GET_V ) - execute_dbr(); + execute_dbr(decode); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_dbnv(void) +INLINE void hyperstone_dbnv(struct regs_decode *decode) { if( !GET_V ) - execute_dbr(); + execute_dbr(decode); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_dbe(void) //or DBZ +INLINE void hyperstone_dbe(struct regs_decode *decode) //or DBZ { if( GET_Z ) - execute_dbr(); + execute_dbr(decode); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_dbne(void) //or DBNZ +INLINE void hyperstone_dbne(struct regs_decode *decode) //or DBNZ { if( !GET_Z ) - execute_dbr(); + execute_dbr(decode); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_dbc(void) //or DBST +INLINE void hyperstone_dbc(struct regs_decode *decode) //or DBST { if( GET_C ) - execute_dbr(); + execute_dbr(decode); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_dbnc(void) //or DBHE +INLINE void hyperstone_dbnc(struct regs_decode *decode) //or DBHE { if( !GET_C ) - execute_dbr(); + execute_dbr(decode); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_dbse(void) +INLINE void hyperstone_dbse(struct regs_decode *decode) { if( GET_C || GET_Z ) - execute_dbr(); + execute_dbr(decode); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_dbht(void) +INLINE void hyperstone_dbht(struct regs_decode *decode) { if( !GET_C && !GET_Z ) - execute_dbr(); + execute_dbr(decode); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_dbn(void) //or DBLT +INLINE void hyperstone_dbn(struct regs_decode *decode) //or DBLT { if( GET_N ) - execute_dbr(); + execute_dbr(decode); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_dbnn(void) //or DBGE +INLINE void hyperstone_dbnn(struct regs_decode *decode) //or DBGE { if( !GET_N ) - execute_dbr(); + execute_dbr(decode); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_dble(void) +INLINE void hyperstone_dble(struct regs_decode *decode) { if( GET_N || GET_Z ) - execute_dbr(); + execute_dbr(decode); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_dbgt(void) +INLINE void hyperstone_dbgt(struct regs_decode *decode) { if( !GET_N && !GET_Z ) - execute_dbr(); + execute_dbr(decode); - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_dbr(void) +INLINE void hyperstone_dbr(struct regs_decode *decode) { - execute_dbr(); + execute_dbr(decode); } -static void hyperstone_frame(void) +INLINE void hyperstone_frame(struct regs_decode *decode) { INT8 difference; // really it's 7 bits UINT8 realfp = GET_FP - SRC_CODE; @@ -4617,16 +4493,16 @@ static void hyperstone_frame(void) } //TODO: no 1! - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_call(void) +INLINE void hyperstone_call(struct regs_decode *decode) { if( SRC_IS_SR ) SREG = 0; if( !DST_CODE ) - current_regs.dst = 16; + decode->dst = 16; EXTRA_S = (EXTRA_S & ~1) + SREG; @@ -4635,7 +4511,7 @@ static void hyperstone_call(void) SET_DREG((PC & 0xfffffffe) | GET_S); SET_DREGF(SR); - SET_FP(GET_FP + current_regs.dst); + SET_FP(GET_FP + decode->dst); SET_FL(6); //default value for call SET_M(0); @@ -4649,111 +4525,111 @@ static void hyperstone_call(void) //TODO: add interrupt locks, errors, .... //TODO: no 1! - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_bv(void) +INLINE void hyperstone_bv(struct regs_decode *decode) { if( GET_V ) - execute_br(); + execute_br(decode); else - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_bnv(void) +INLINE void hyperstone_bnv(struct regs_decode *decode) { if( !GET_V ) - execute_br(); + execute_br(decode); else - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_be(void) //or BZ +INLINE void hyperstone_be(struct regs_decode *decode) //or BZ { if( GET_Z ) - execute_br(); + execute_br(decode); else - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_bne(void) //or BNZ +INLINE void hyperstone_bne(struct regs_decode *decode) //or BNZ { if( !GET_Z ) - execute_br(); + execute_br(decode); else - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_bc(void) //or BST +INLINE void hyperstone_bc(struct regs_decode *decode) //or BST { if( GET_C ) - execute_br(); + execute_br(decode); else - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_bnc(void) //or BHE +INLINE void hyperstone_bnc(struct regs_decode *decode) //or BHE { if( !GET_C ) - execute_br(); + execute_br(decode); else - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_bse(void) +INLINE void hyperstone_bse(struct regs_decode *decode) { if( GET_C || GET_Z ) - execute_br(); + execute_br(decode); else - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_bht(void) +INLINE void hyperstone_bht(struct regs_decode *decode) { if( !GET_C && !GET_Z ) - execute_br(); + execute_br(decode); else - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_bn(void) //or BLT +INLINE void hyperstone_bn(struct regs_decode *decode) //or BLT { if( GET_N ) - execute_br(); + execute_br(decode); else - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_bnn(void) //or BGE +INLINE void hyperstone_bnn(struct regs_decode *decode) //or BGE { if( !GET_N ) - execute_br(); + execute_br(decode); else - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_ble(void) +INLINE void hyperstone_ble(struct regs_decode *decode) { if( GET_N || GET_Z ) - execute_br(); + execute_br(decode); else - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_bgt(void) +INLINE void hyperstone_bgt(struct regs_decode *decode) { if( !GET_N && !GET_Z ) - execute_br(); + execute_br(decode); else - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; } -static void hyperstone_br(void) +INLINE void hyperstone_br(struct regs_decode *decode) { - execute_br(); + execute_br(decode); } -static void hyperstone_trap(void) +INLINE void hyperstone_trap(struct regs_decode *decode) { UINT8 code, trapno; UINT32 addr; @@ -4837,7 +4713,54 @@ static void hyperstone_trap(void) break; } - hyperstone_ICount -= 1; + hyperstone_ICount -= hyperstone.clock_cycles_1; +} + + +#include "e132xsop.c" + + +static int hyperstone_execute(int cycles) +{ + hyperstone_ICount = cycles; + + if (hyperstone.intblock < 0) + hyperstone.intblock = 0; + check_interrupts(); + + do + { + UINT32 oldh = SR & 0x00000020; + UINT16 opcode; + + PPC = PC; /* copy PC to previous PC */ + CALL_MAME_DEBUG; + + opcode = READ_OP(PC); + PC += 2; + + hyperstone.instruction_length = 1; + + /* execute opcode */ + (*hyperstone_op[(opcode & 0xff00) >> 8])(opcode); + + /* clear the H state if it was previously set */ + SR ^= oldh; + + SET_ILC(hyperstone.instruction_length & 3); + + if( GET_T && GET_P && hyperstone.delay.delay_cmd == NO_DELAY ) /* Not in a Delayed Branch instructions */ + { + UINT32 addr = get_trap_addr(TRACE_EXCEPTION); + execute_exception(addr); + } + + if (--hyperstone.intblock == 0) + check_interrupts(); + + } while( hyperstone_ICount > 0 ); + + return cycles - hyperstone_ICount; } @@ -4855,36 +4778,36 @@ static void hyperstone_set_info(UINT32 state, cpuinfo *info) case CPUINFO_INT_REGISTER + E132XS_PC: PC = info->i; change_pc(PC); break; case CPUINFO_INT_REGISTER + E132XS_SR: SR = info->i; break; case CPUINFO_INT_REGISTER + E132XS_FER: FER = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_G3: hyperstone.global_regs[3] = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_G4: hyperstone.global_regs[4] = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_G5: hyperstone.global_regs[5] = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_G6: hyperstone.global_regs[6] = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_G7: hyperstone.global_regs[7] = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_G8: hyperstone.global_regs[8] = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_G9: hyperstone.global_regs[9] = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_G10: hyperstone.global_regs[10] = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_G11: hyperstone.global_regs[11] = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_G12: hyperstone.global_regs[12] = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_G13: hyperstone.global_regs[13] = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_G14: hyperstone.global_regs[14] = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_G15: hyperstone.global_regs[15] = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_G16: hyperstone.global_regs[16] = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_G17: hyperstone.global_regs[17] = info->i; break; + case CPUINFO_INT_REGISTER + E132XS_G3: set_global_register(3, info->i); break; + case CPUINFO_INT_REGISTER + E132XS_G4: set_global_register(4, info->i); break; + case CPUINFO_INT_REGISTER + E132XS_G5: set_global_register(5, info->i); break; + case CPUINFO_INT_REGISTER + E132XS_G6: set_global_register(6, info->i); break; + case CPUINFO_INT_REGISTER + E132XS_G7: set_global_register(7, info->i); break; + case CPUINFO_INT_REGISTER + E132XS_G8: set_global_register(8, info->i); break; + case CPUINFO_INT_REGISTER + E132XS_G9: set_global_register(9, info->i); break; + case CPUINFO_INT_REGISTER + E132XS_G10: set_global_register(10, info->i); break; + case CPUINFO_INT_REGISTER + E132XS_G11: set_global_register(11, info->i); break; + case CPUINFO_INT_REGISTER + E132XS_G12: set_global_register(12, info->i); break; + case CPUINFO_INT_REGISTER + E132XS_G13: set_global_register(13, info->i); break; + case CPUINFO_INT_REGISTER + E132XS_G14: set_global_register(14, info->i); break; + case CPUINFO_INT_REGISTER + E132XS_G15: set_global_register(15, info->i); break; + case CPUINFO_INT_REGISTER + E132XS_G16: set_global_register(16, info->i); break; + case CPUINFO_INT_REGISTER + E132XS_G17: set_global_register(17, info->i); break; case CPUINFO_INT_SP: case CPUINFO_INT_REGISTER + E132XS_SP: SP = info->i; break; case CPUINFO_INT_REGISTER + E132XS_UB: UB = info->i; break; case CPUINFO_INT_REGISTER + E132XS_BCR: BCR = info->i; break; case CPUINFO_INT_REGISTER + E132XS_TPR: TPR = info->i; break; case CPUINFO_INT_REGISTER + E132XS_TCR: TCR = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_TR: TR = info->i; break; + case CPUINFO_INT_REGISTER + E132XS_TR: set_global_register(TR_REGISTER, info->i); break; case CPUINFO_INT_REGISTER + E132XS_WCR: WCR = info->i; break; case CPUINFO_INT_REGISTER + E132XS_ISR: ISR = info->i; break; case CPUINFO_INT_REGISTER + E132XS_FCR: FCR = info->i; break; case CPUINFO_INT_REGISTER + E132XS_MCR: MCR = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_G28: hyperstone.global_regs[28] = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_G29: hyperstone.global_regs[29] = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_G30: hyperstone.global_regs[30] = info->i; break; - case CPUINFO_INT_REGISTER + E132XS_G31: hyperstone.global_regs[31] = info->i; break; + case CPUINFO_INT_REGISTER + E132XS_G28: set_global_register(28, info->i); break; + case CPUINFO_INT_REGISTER + E132XS_G29: set_global_register(29, info->i); break; + case CPUINFO_INT_REGISTER + E132XS_G30: set_global_register(30, info->i); break; + case CPUINFO_INT_REGISTER + E132XS_G31: set_global_register(31, info->i); break; case CPUINFO_INT_REGISTER + E132XS_CL0: hyperstone.local_regs[(0 + GET_FP) % 64] = info->i; break; case CPUINFO_INT_REGISTER + E132XS_CL1: hyperstone.local_regs[(1 + GET_FP) % 64] = info->i; break; case CPUINFO_INT_REGISTER + E132XS_CL2: hyperstone.local_regs[(2 + GET_FP) % 64] = info->i; break; @@ -4981,7 +4904,7 @@ static void hyperstone_set_info(UINT32 state, cpuinfo *info) * Generic get_info **************************************************************************/ -void hyperstone_get_info(UINT32 state, cpuinfo *info) +static void hyperstone_get_info(UINT32 state, cpuinfo *info) { switch (state) { @@ -5012,21 +4935,21 @@ void hyperstone_get_info(UINT32 state, cpuinfo *info) case CPUINFO_INT_REGISTER + E132XS_PC: info->i = PC; break; case CPUINFO_INT_REGISTER + E132XS_SR: info->i = SR; break; case CPUINFO_INT_REGISTER + E132XS_FER: info->i = FER; break; - case CPUINFO_INT_REGISTER + E132XS_G3: info->i = hyperstone.global_regs[3]; break; - case CPUINFO_INT_REGISTER + E132XS_G4: info->i = hyperstone.global_regs[4]; break; - case CPUINFO_INT_REGISTER + E132XS_G5: info->i = hyperstone.global_regs[5]; break; - case CPUINFO_INT_REGISTER + E132XS_G6: info->i = hyperstone.global_regs[6]; break; - case CPUINFO_INT_REGISTER + E132XS_G7: info->i = hyperstone.global_regs[7]; break; - case CPUINFO_INT_REGISTER + E132XS_G8: info->i = hyperstone.global_regs[8]; break; - case CPUINFO_INT_REGISTER + E132XS_G9: info->i = hyperstone.global_regs[9]; break; - case CPUINFO_INT_REGISTER + E132XS_G10: info->i = hyperstone.global_regs[10]; break; - case CPUINFO_INT_REGISTER + E132XS_G11: info->i = hyperstone.global_regs[11]; break; - case CPUINFO_INT_REGISTER + E132XS_G12: info->i = hyperstone.global_regs[12]; break; - case CPUINFO_INT_REGISTER + E132XS_G13: info->i = hyperstone.global_regs[13]; break; - case CPUINFO_INT_REGISTER + E132XS_G14: info->i = hyperstone.global_regs[14]; break; - case CPUINFO_INT_REGISTER + E132XS_G15: info->i = hyperstone.global_regs[15]; break; - case CPUINFO_INT_REGISTER + E132XS_G16: info->i = hyperstone.global_regs[16]; break; - case CPUINFO_INT_REGISTER + E132XS_G17: info->i = hyperstone.global_regs[17]; break; + case CPUINFO_INT_REGISTER + E132XS_G3: info->i = get_global_register(3); break; + case CPUINFO_INT_REGISTER + E132XS_G4: info->i = get_global_register(4); break; + case CPUINFO_INT_REGISTER + E132XS_G5: info->i = get_global_register(5); break; + case CPUINFO_INT_REGISTER + E132XS_G6: info->i = get_global_register(6); break; + case CPUINFO_INT_REGISTER + E132XS_G7: info->i = get_global_register(7); break; + case CPUINFO_INT_REGISTER + E132XS_G8: info->i = get_global_register(8); break; + case CPUINFO_INT_REGISTER + E132XS_G9: info->i = get_global_register(9); break; + case CPUINFO_INT_REGISTER + E132XS_G10: info->i = get_global_register(10); break; + case CPUINFO_INT_REGISTER + E132XS_G11: info->i = get_global_register(11); break; + case CPUINFO_INT_REGISTER + E132XS_G12: info->i = get_global_register(12); break; + case CPUINFO_INT_REGISTER + E132XS_G13: info->i = get_global_register(13); break; + case CPUINFO_INT_REGISTER + E132XS_G14: info->i = get_global_register(14); break; + case CPUINFO_INT_REGISTER + E132XS_G15: info->i = get_global_register(15); break; + case CPUINFO_INT_REGISTER + E132XS_G16: info->i = get_global_register(16); break; + case CPUINFO_INT_REGISTER + E132XS_G17: info->i = get_global_register(17); break; case CPUINFO_INT_SP: case CPUINFO_INT_REGISTER + E132XS_SP: info->i = SP; break; case CPUINFO_INT_REGISTER + E132XS_UB: info->i = UB; break; @@ -5038,10 +4961,10 @@ void hyperstone_get_info(UINT32 state, cpuinfo *info) case CPUINFO_INT_REGISTER + E132XS_ISR: info->i = ISR; break; case CPUINFO_INT_REGISTER + E132XS_FCR: info->i = FCR; break; case CPUINFO_INT_REGISTER + E132XS_MCR: info->i = MCR; break; - case CPUINFO_INT_REGISTER + E132XS_G28: info->i = hyperstone.global_regs[28]; break; - case CPUINFO_INT_REGISTER + E132XS_G29: info->i = hyperstone.global_regs[29]; break; - case CPUINFO_INT_REGISTER + E132XS_G30: info->i = hyperstone.global_regs[30]; break; - case CPUINFO_INT_REGISTER + E132XS_G31: info->i = hyperstone.global_regs[31]; break; + case CPUINFO_INT_REGISTER + E132XS_G28: info->i = get_global_register(28); break; + case CPUINFO_INT_REGISTER + E132XS_G29: info->i = get_global_register(29); break; + case CPUINFO_INT_REGISTER + E132XS_G30: info->i = get_global_register(30); break; + case CPUINFO_INT_REGISTER + E132XS_G31: info->i = get_global_register(31); break; case CPUINFO_INT_REGISTER + E132XS_CL0: info->i = hyperstone.local_regs[(0 + GET_FP) % 64]; break; case CPUINFO_INT_REGISTER + E132XS_CL1: info->i = hyperstone.local_regs[(1 + GET_FP) % 64]; break; case CPUINFO_INT_REGISTER + E132XS_CL2: info->i = hyperstone.local_regs[(2 + GET_FP) % 64]; break; @@ -5127,7 +5050,7 @@ void hyperstone_get_info(UINT32 state, cpuinfo *info) case CPUINFO_PTR_SET_INFO: info->setinfo = hyperstone_set_info; break; case CPUINFO_PTR_GET_CONTEXT: info->getcontext = hyperstone_get_context; break; case CPUINFO_PTR_SET_CONTEXT: info->setcontext = hyperstone_set_context; break; - case CPUINFO_PTR_INIT: info->init = hyperstone_init; break; + case CPUINFO_PTR_INIT: info->init = NULL; break; case CPUINFO_PTR_RESET: info->reset = hyperstone_reset; break; case CPUINFO_PTR_EXIT: info->exit = hyperstone_exit; break; case CPUINFO_PTR_EXECUTE: info->execute = hyperstone_execute; break; @@ -5295,7 +5218,7 @@ void e116t_get_info(UINT32 state, cpuinfo *info) case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_4k_iram_map; break; /* --- the following bits of info are returned as pointers to data or functions --- */ - case CPUINFO_PTR_INIT: info->init = e116_init; break; + case CPUINFO_PTR_INIT: info->init = e116t_init; break; /* --- the following bits of info are returned as NULL-terminated strings --- */ case CPUINFO_STR_NAME: strcpy(info->s, "E1-16T"); break; @@ -5318,7 +5241,7 @@ void e116xt_get_info(UINT32 state, cpuinfo *info) case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_8k_iram_map; break; /* --- the following bits of info are returned as pointers to data or functions --- */ - case CPUINFO_PTR_INIT: info->init = e116_init; break; + case CPUINFO_PTR_INIT: info->init = e116xt_init; break; /* --- the following bits of info are returned as NULL-terminated strings --- */ case CPUINFO_STR_NAME: strcpy(info->s, "E1-16XT"); break; @@ -5341,7 +5264,7 @@ void e116xs_get_info(UINT32 state, cpuinfo *info) case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_16k_iram_map; break; /* --- the following bits of info are returned as pointers to data or functions --- */ - case CPUINFO_PTR_INIT: info->init = e116_init; break; + case CPUINFO_PTR_INIT: info->init = e116xs_init; break; /* --- the following bits of info are returned as NULL-terminated strings --- */ case CPUINFO_STR_NAME: strcpy(info->s, "E1-16XS"); break; @@ -5364,7 +5287,7 @@ void e116xsr_get_info(UINT32 state, cpuinfo *info) case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_16k_iram_map; break; /* --- the following bits of info are returned as pointers to data or functions --- */ - case CPUINFO_PTR_INIT: info->init = e116_init; break; + case CPUINFO_PTR_INIT: info->init = e116xsr_init; break; /* --- the following bits of info are returned as NULL-terminated strings --- */ case CPUINFO_STR_NAME: strcpy(info->s, "E1-16XSR"); break; @@ -5387,7 +5310,7 @@ void e132n_get_info(UINT32 state, cpuinfo *info) case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_4k_iram_map; break; /* --- the following bits of info are returned as pointers to data or functions --- */ - case CPUINFO_PTR_INIT: info->init = e132_init; break; + case CPUINFO_PTR_INIT: info->init = e132n_init; break; /* --- the following bits of info are returned as NULL-terminated strings --- */ case CPUINFO_STR_NAME: strcpy(info->s, "E1-32N"); break; @@ -5410,7 +5333,7 @@ void e132t_get_info(UINT32 state, cpuinfo *info) case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_4k_iram_map; break; /* --- the following bits of info are returned as pointers to data or functions --- */ - case CPUINFO_PTR_INIT: info->init = e132_init; break; + case CPUINFO_PTR_INIT: info->init = e132t_init; break; /* --- the following bits of info are returned as NULL-terminated strings --- */ case CPUINFO_STR_NAME: strcpy(info->s, "E1-32T"); break; @@ -5433,7 +5356,7 @@ void e132xn_get_info(UINT32 state, cpuinfo *info) case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_8k_iram_map; break; /* --- the following bits of info are returned as pointers to data or functions --- */ - case CPUINFO_PTR_INIT: info->init = e132_init; break; + case CPUINFO_PTR_INIT: info->init = e132xn_init; break; /* --- the following bits of info are returned as NULL-terminated strings --- */ case CPUINFO_STR_NAME: strcpy(info->s, "E1-32XN"); break; @@ -5456,7 +5379,7 @@ void e132xt_get_info(UINT32 state, cpuinfo *info) case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_8k_iram_map; break; /* --- the following bits of info are returned as pointers to data or functions --- */ - case CPUINFO_PTR_INIT: info->init = e132_init; break; + case CPUINFO_PTR_INIT: info->init = e132xt_init; break; /* --- the following bits of info are returned as NULL-terminated strings --- */ case CPUINFO_STR_NAME: strcpy(info->s, "E1-32XT"); break; @@ -5479,7 +5402,7 @@ void e132xs_get_info(UINT32 state, cpuinfo *info) case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_16k_iram_map; break; /* --- the following bits of info are returned as pointers to data or functions --- */ - case CPUINFO_PTR_INIT: info->init = e132_init; break; + case CPUINFO_PTR_INIT: info->init = e132xs_init; break; /* --- the following bits of info are returned as NULL-terminated strings --- */ case CPUINFO_STR_NAME: strcpy(info->s, "E1-32XS"); break; @@ -5502,7 +5425,7 @@ void e132xsr_get_info(UINT32 state, cpuinfo *info) case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_16k_iram_map; break; /* --- the following bits of info are returned as pointers to data or functions --- */ - case CPUINFO_PTR_INIT: info->init = e132_init; break; + case CPUINFO_PTR_INIT: info->init = e132xsr_init; break; /* --- the following bits of info are returned as NULL-terminated strings --- */ case CPUINFO_STR_NAME: strcpy(info->s, "E1-32XSR"); break; @@ -5525,7 +5448,7 @@ void gms30c2116_get_info(UINT32 state, cpuinfo *info) case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_4k_iram_map; break; /* --- the following bits of info are returned as pointers to data or functions --- */ - case CPUINFO_PTR_INIT: info->init = e116_init; break; + case CPUINFO_PTR_INIT: info->init = gms30c2116_init; break; /* --- the following bits of info are returned as NULL-terminated strings --- */ case CPUINFO_STR_NAME: strcpy(info->s, "GMS30C2116"); break; @@ -5548,7 +5471,7 @@ void gms30c2132_get_info(UINT32 state, cpuinfo *info) case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_4k_iram_map; break; /* --- the following bits of info are returned as pointers to data or functions --- */ - case CPUINFO_PTR_INIT: info->init = e132_init; break; + case CPUINFO_PTR_INIT: info->init = gms30c2132_init; break; /* --- the following bits of info are returned as NULL-terminated strings --- */ case CPUINFO_STR_NAME: strcpy(info->s, "GMS30C2132"); break; @@ -5571,7 +5494,7 @@ void gms30c2216_get_info(UINT32 state, cpuinfo *info) case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_8k_iram_map; break; /* --- the following bits of info are returned as pointers to data or functions --- */ - case CPUINFO_PTR_INIT: info->init = e116_init; break; + case CPUINFO_PTR_INIT: info->init = gms30c2216_init; break; /* --- the following bits of info are returned as NULL-terminated strings --- */ case CPUINFO_STR_NAME: strcpy(info->s, "GMS30C2216"); break; @@ -5594,7 +5517,7 @@ void gms30c2232_get_info(UINT32 state, cpuinfo *info) case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_8k_iram_map; break; /* --- the following bits of info are returned as pointers to data or functions --- */ - case CPUINFO_PTR_INIT: info->init = e132_init; break; + case CPUINFO_PTR_INIT: info->init = gms30c2232_init; break; /* --- the following bits of info are returned as NULL-terminated strings --- */ case CPUINFO_STR_NAME: strcpy(info->s, "GMS30C2232"); break; diff --git a/src/emu/cpu/e132xs/e132xs.h b/src/emu/cpu/e132xs/e132xs.h index ed9a899a504..6494bcbed68 100644 --- a/src/emu/cpu/e132xs/e132xs.h +++ b/src/emu/cpu/e132xs/e132xs.h @@ -3,6 +3,22 @@ #include "cpuintrf.h" +/* + A note about clock multipliers and dividers: + + E1-16[T] and E1-32[T] accept a straight clock + + E1-16X[T|N] and E1-32X[T|N] accept a clock and multiply it + internally by 4; in the emulator, you MUST specify 4 * XTAL + to achieve the correct speed + + E1-16XS[R] and E1-32XS[R] accept a clock and multiply it + internally by 8; in the emulator, you MUST specify 8 * XTAL + to achieve the correct speed +*/ + + + /* Functions */ #if (HAS_E116T) @@ -98,6 +114,8 @@ extern int hyp_type_16bit; #define SR_REGISTER 1 #define BCR_REGISTER 20 #define TPR_REGISTER 21 +#define TCR_REGISTER 22 +#define TR_REGISTER 23 #define ISR_REGISTER 25 #define FCR_REGISTER 26 #define MCR_REGISTER 27 @@ -127,7 +145,15 @@ extern int hyp_type_16bit; /* Delay values */ #define NO_DELAY 0 #define DELAY_EXECUTE 1 -#define DELAY_TAKEN 2 + +/* IRQ numbers */ +#define IRQ_INT1 0 +#define IRQ_INT2 1 +#define IRQ_INT3 2 +#define IRQ_INT4 3 +#define IRQ_IO1 4 +#define IRQ_IO2 5 +#define IRQ_IO3 6 /* Trap numbers */ #define IO2 48 diff --git a/src/emu/cpu/e132xs/e132xsop.c b/src/emu/cpu/e132xs/e132xsop.c new file mode 100644 index 00000000000..5c610189632 --- /dev/null +++ b/src/emu/cpu/e132xs/e132xsop.c @@ -0,0 +1,1926 @@ +#define LOCAL_DECODE_INIT \ + struct regs_decode decode_state; \ + struct regs_decode *decode = &decode_state; \ +\ + /* clear 'current regs / flags' */ \ + decode->src = 0; \ + decode->dst = 0; \ + decode->src_value = 0; \ + decode->next_src_value = 0; \ + decode->dst_value = 0; \ + decode->next_dst_value = 0; \ + decode->sub_type = 0; \ + decode->extra.u = 0; \ + decode->src_is_local = 0; \ + decode->dst_is_local = 0; \ + decode->same_src_dst = 0; \ + decode->same_src_dstf = 0; \ + decode->same_srcf_dst = 0; \ + decode->op = opcode; \ + + +static void hyperstone_op00(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_chk(decode); +} + +static void hyperstone_op01(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_chk(decode); +} + +static void hyperstone_op02(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_chk(decode); +} + +static void hyperstone_op03(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_chk(decode); +} + +static void hyperstone_op04(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_movd(decode); +} + +static void hyperstone_op05(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_movd(decode); +} + +static void hyperstone_op06(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_movd(decode); +} + +static void hyperstone_op07(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_movd(decode); +} + +static void hyperstone_op08(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_divu(decode); +} + +static void hyperstone_op09(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_divu(decode); +} + +static void hyperstone_op0a(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_divu(decode); +} + +static void hyperstone_op0b(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_divu(decode); +} + +static void hyperstone_op0c(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_divs(decode); +} + +static void hyperstone_op0d(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_divs(decode); +} + +static void hyperstone_op0e(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_divs(decode); +} + +static void hyperstone_op0f(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_divs(decode); +} + + + +static void hyperstone_op10(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRlimdecode(decode, 0, 0); + hyperstone_xm(decode); +} + +static void hyperstone_op11(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRlimdecode(decode, 0, 1); + hyperstone_xm(decode); +} + +static void hyperstone_op12(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRlimdecode(decode, 1, 0); + hyperstone_xm(decode); +} + +static void hyperstone_op13(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRlimdecode(decode, 1, 1); + hyperstone_xm(decode); +} + +static void hyperstone_op14(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRconstdecode(decode, 0, 0); + hyperstone_mask(decode); +} + +static void hyperstone_op15(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRconstdecode(decode, 0, 1); + hyperstone_mask(decode); +} + +static void hyperstone_op16(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRconstdecode(decode, 1, 0); + hyperstone_mask(decode); +} + +static void hyperstone_op17(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRconstdecode(decode, 1, 1); + hyperstone_mask(decode); +} + +static void hyperstone_op18(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRconstdecode(decode, 0, 0); + hyperstone_sum(decode); +} + +static void hyperstone_op19(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRconstdecode(decode, 0, 1); + hyperstone_sum(decode); +} + +static void hyperstone_op1a(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRconstdecode(decode, 1, 0); + hyperstone_sum(decode); +} + +static void hyperstone_op1b(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRconstdecode(decode, 1, 1); + hyperstone_sum(decode); +} + +static void hyperstone_op1c(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRconstdecode(decode, 0, 0); + hyperstone_sums(decode); +} + +static void hyperstone_op1d(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRconstdecode(decode, 0, 1); + hyperstone_sums(decode); +} + +static void hyperstone_op1e(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRconstdecode(decode, 1, 0); + hyperstone_sums(decode); +} + +static void hyperstone_op1f(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRconstdecode(decode, 1, 1); + hyperstone_sums(decode); +} + + + +static void hyperstone_op20(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_cmp(decode); +} + +static void hyperstone_op21(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_cmp(decode); +} + +static void hyperstone_op22(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_cmp(decode); +} + +static void hyperstone_op23(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_cmp(decode); +} + +static void hyperstone_op24(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecodewithHflag(decode, 0, 0); + hyperstone_mov(decode); +} + +static void hyperstone_op25(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecodewithHflag(decode, 0, 1); + hyperstone_mov(decode); +} + +static void hyperstone_op26(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecodewithHflag(decode, 1, 0); + hyperstone_mov(decode); +} + +static void hyperstone_op27(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecodewithHflag(decode, 1, 1); + hyperstone_mov(decode); +} + +static void hyperstone_op28(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_add(decode); +} + +static void hyperstone_op29(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_add(decode); +} + +static void hyperstone_op2a(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_add(decode); +} + +static void hyperstone_op2b(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_add(decode); +} + +static void hyperstone_op2c(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_adds(decode); +} + +static void hyperstone_op2d(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_adds(decode); +} + +static void hyperstone_op2e(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_adds(decode); +} + +static void hyperstone_op2f(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_adds(decode); +} + + + +static void hyperstone_op30(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_cmpb(decode); +} + +static void hyperstone_op31(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_cmpb(decode); +} + +static void hyperstone_op32(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_cmpb(decode); +} + +static void hyperstone_op33(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_cmpb(decode); +} + +static void hyperstone_op34(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_andn(decode); +} + +static void hyperstone_op35(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_andn(decode); +} + +static void hyperstone_op36(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_andn(decode); +} + +static void hyperstone_op37(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_andn(decode); +} + +static void hyperstone_op38(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_or(decode); +} + +static void hyperstone_op39(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_or(decode); +} + +static void hyperstone_op3a(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_or(decode); +} + +static void hyperstone_op3b(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_or(decode); +} + +static void hyperstone_op3c(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_xor(decode); +} + +static void hyperstone_op3d(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_xor(decode); +} + +static void hyperstone_op3e(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_xor(decode); +} + +static void hyperstone_op3f(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_xor(decode); +} + + + +static void hyperstone_op40(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_subc(decode); +} + +static void hyperstone_op41(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_subc(decode); +} + +static void hyperstone_op42(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_subc(decode); +} + +static void hyperstone_op43(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_subc(decode); +} + +static void hyperstone_op44(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_not(decode); +} + +static void hyperstone_op45(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_not(decode); +} + +static void hyperstone_op46(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_not(decode); +} + +static void hyperstone_op47(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_not(decode); +} + +static void hyperstone_op48(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_sub(decode); +} + +static void hyperstone_op49(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_sub(decode); +} + +static void hyperstone_op4a(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_sub(decode); +} + +static void hyperstone_op4b(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_sub(decode); +} + +static void hyperstone_op4c(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_subs(decode); +} + +static void hyperstone_op4d(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_subs(decode); +} + +static void hyperstone_op4e(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_subs(decode); +} + +static void hyperstone_op4f(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_subs(decode); +} + + + +static void hyperstone_op50(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_addc(decode); +} + +static void hyperstone_op51(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_addc(decode); +} + +static void hyperstone_op52(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_addc(decode); +} + +static void hyperstone_op53(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_addc(decode); +} + +static void hyperstone_op54(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_and(decode); +} + +static void hyperstone_op55(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_and(decode); +} + +static void hyperstone_op56(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_and(decode); +} + +static void hyperstone_op57(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_and(decode); +} + +static void hyperstone_op58(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_neg(decode); +} + +static void hyperstone_op59(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_neg(decode); +} + +static void hyperstone_op5a(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_neg(decode); +} + +static void hyperstone_op5b(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_neg(decode); +} + +static void hyperstone_op5c(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_negs(decode); +} + +static void hyperstone_op5d(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_negs(decode); +} + +static void hyperstone_op5e(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_negs(decode); +} + +static void hyperstone_op5f(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_negs(decode); +} + + + +static void hyperstone_op60(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 0, 0); + hyperstone_cmpi(decode); +} + +static void hyperstone_op61(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 0, 1); + hyperstone_cmpi(decode); +} + +static void hyperstone_op62(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 1, 0); + hyperstone_cmpi(decode); +} + +static void hyperstone_op63(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 1, 1); + hyperstone_cmpi(decode); +} + +static void hyperstone_op64(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RimmdecodewithHflag(decode, 0, 0); + hyperstone_movi(decode); +} + +static void hyperstone_op65(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RimmdecodewithHflag(decode, 0, 1); + hyperstone_movi(decode); +} + +static void hyperstone_op66(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RimmdecodewithHflag(decode, 1, 0); + hyperstone_movi(decode); +} + +static void hyperstone_op67(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RimmdecodewithHflag(decode, 1, 1); + hyperstone_movi(decode); +} + +static void hyperstone_op68(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 0, 0); + hyperstone_addi(decode); +} + +static void hyperstone_op69(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 0, 1); + hyperstone_addi(decode); +} + +static void hyperstone_op6a(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 1, 0); + hyperstone_addi(decode); +} + +static void hyperstone_op6b(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 1, 1); + hyperstone_addi(decode); +} + +static void hyperstone_op6c(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 0, 0); + hyperstone_addsi(decode); +} + +static void hyperstone_op6d(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 0, 1); + hyperstone_addsi(decode); +} + +static void hyperstone_op6e(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 1, 0); + hyperstone_addsi(decode); +} + +static void hyperstone_op6f(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 1, 1); + hyperstone_addsi(decode); +} + + + +static void hyperstone_op70(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 0, 0); + hyperstone_cmpbi(decode); +} + +static void hyperstone_op71(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 0, 1); + hyperstone_cmpbi(decode); +} + +static void hyperstone_op72(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 1, 0); + hyperstone_cmpbi(decode); +} + +static void hyperstone_op73(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 1, 1); + hyperstone_cmpbi(decode); +} + +static void hyperstone_op74(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 0, 0); + hyperstone_andni(decode); +} + +static void hyperstone_op75(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 0, 1); + hyperstone_andni(decode); +} + +static void hyperstone_op76(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 1, 0); + hyperstone_andni(decode); +} + +static void hyperstone_op77(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 1, 1); + hyperstone_andni(decode); +} + +static void hyperstone_op78(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 0, 0); + hyperstone_ori(decode); +} + +static void hyperstone_op79(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 0, 1); + hyperstone_ori(decode); +} + +static void hyperstone_op7a(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 1, 0); + hyperstone_ori(decode); +} + +static void hyperstone_op7b(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 1, 1); + hyperstone_ori(decode); +} + +static void hyperstone_op7c(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 0, 0); + hyperstone_xori(decode); +} + +static void hyperstone_op7d(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 0, 1); + hyperstone_xori(decode); +} + +static void hyperstone_op7e(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 1, 0); + hyperstone_xori(decode); +} + +static void hyperstone_op7f(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rimmdecode(decode, 1, 1); + hyperstone_xori(decode); +} + + + +static void hyperstone_op80(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Lndecode(decode); + hyperstone_shrdi(decode); +} + +static void hyperstone_op81(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Lndecode(decode); + hyperstone_shrdi(decode); +} + +static void hyperstone_op82(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_shrd(decode); +} + +static void hyperstone_op83(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_shr(decode); +} + +static void hyperstone_op84(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Lndecode(decode); + hyperstone_sardi(decode); +} + +static void hyperstone_op85(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Lndecode(decode); + hyperstone_sardi(decode); +} + +static void hyperstone_op86(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_sard(decode); +} + +static void hyperstone_op87(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_sar(decode); +} + +static void hyperstone_op88(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Lndecode(decode); + hyperstone_shldi(decode); +} + +static void hyperstone_op89(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Lndecode(decode); + hyperstone_shldi(decode); +} + +static void hyperstone_op8a(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_shld(decode); +} + +static void hyperstone_op8b(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_shl(decode); +} + +static void hyperstone_op8c(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + no_decode(decode); + reserved(decode); +} + +static void hyperstone_op8d(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + no_decode(decode); + reserved(decode); +} + +static void hyperstone_op8e(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_testlz(decode); +} + +static void hyperstone_op8f(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_rol(decode); +} + + + +static void hyperstone_op90(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdisdecode(decode, 0, 0); + hyperstone_ldxx1(decode); +} + +static void hyperstone_op91(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdisdecode(decode, 0, 1); + hyperstone_ldxx1(decode); +} + +static void hyperstone_op92(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdisdecode(decode, 1, 0); + hyperstone_ldxx1(decode); +} + +static void hyperstone_op93(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdisdecode(decode, 1, 1); + hyperstone_ldxx1(decode); +} + +static void hyperstone_op94(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdisdecode(decode, 0, 0); + hyperstone_ldxx2(decode); +} + +static void hyperstone_op95(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdisdecode(decode, 0, 1); + hyperstone_ldxx2(decode); +} + +static void hyperstone_op96(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdisdecode(decode, 1, 0); + hyperstone_ldxx2(decode); +} + +static void hyperstone_op97(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdisdecode(decode, 1, 1); + hyperstone_ldxx2(decode); +} + +static void hyperstone_op98(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdisdecode(decode, 0, 0); + hyperstone_stxx1(decode); +} + +static void hyperstone_op99(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdisdecode(decode, 0, 1); + hyperstone_stxx1(decode); +} + +static void hyperstone_op9a(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdisdecode(decode, 1, 0); + hyperstone_stxx1(decode); +} + +static void hyperstone_op9b(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdisdecode(decode, 1, 1); + hyperstone_stxx1(decode); +} + +static void hyperstone_op9c(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdisdecode(decode, 0, 0); + hyperstone_stxx2(decode); +} + +static void hyperstone_op9d(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdisdecode(decode, 0, 1); + hyperstone_stxx2(decode); +} + +static void hyperstone_op9e(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdisdecode(decode, 1, 0); + hyperstone_stxx2(decode); +} + +static void hyperstone_op9f(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdisdecode(decode, 1, 1); + hyperstone_stxx2(decode); +} + + + +static void hyperstone_opa0(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rndecode(decode, 0); + hyperstone_shri(decode); +} + +static void hyperstone_opa1(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rndecode(decode, 0); + hyperstone_shri(decode); +} + +static void hyperstone_opa2(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rndecode(decode, 1); + hyperstone_shri(decode); +} + +static void hyperstone_opa3(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rndecode(decode, 1); + hyperstone_shri(decode); +} + +static void hyperstone_opa4(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rndecode(decode, 0); + hyperstone_sari(decode); +} + +static void hyperstone_opa5(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rndecode(decode, 0); + hyperstone_sari(decode); +} + +static void hyperstone_opa6(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rndecode(decode, 1); + hyperstone_sari(decode); +} + +static void hyperstone_opa7(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rndecode(decode, 1); + hyperstone_sari(decode); +} + +static void hyperstone_opa8(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rndecode(decode, 0); + hyperstone_shli(decode); +} + +static void hyperstone_opa9(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rndecode(decode, 0); + hyperstone_shli(decode); +} + +static void hyperstone_opaa(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rndecode(decode, 1); + hyperstone_shli(decode); +} + +static void hyperstone_opab(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rndecode(decode, 1); + hyperstone_shli(decode); +} + +static void hyperstone_opac(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + no_decode(decode); + reserved(decode); +} + +static void hyperstone_opad(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + no_decode(decode); + reserved(decode); +} + +static void hyperstone_opae(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + no_decode(decode); + reserved(decode); +} + +static void hyperstone_opaf(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + no_decode(decode); + reserved(decode); +} + + + +static void hyperstone_opb0(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_mulu(decode); +} + +static void hyperstone_opb1(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_mulu(decode); +} + +static void hyperstone_opb2(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_mulu(decode); +} + +static void hyperstone_opb3(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_mulu(decode); +} + +static void hyperstone_opb4(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_muls(decode); +} + +static void hyperstone_opb5(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_muls(decode); +} + +static void hyperstone_opb6(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_muls(decode); +} + +static void hyperstone_opb7(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_muls(decode); +} + +static void hyperstone_opb8(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rndecode(decode, 0); + hyperstone_set(decode); +} + +static void hyperstone_opb9(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rndecode(decode, 0); + hyperstone_set(decode); +} + +static void hyperstone_opba(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rndecode(decode, 1); + hyperstone_set(decode); +} + +static void hyperstone_opbb(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + Rndecode(decode, 1); + hyperstone_set(decode); +} + +static void hyperstone_opbc(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 0); + hyperstone_mul(decode); +} + +static void hyperstone_opbd(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 0, 1); + hyperstone_mul(decode); +} + +static void hyperstone_opbe(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 0); + hyperstone_mul(decode); +} + +static void hyperstone_opbf(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + RRdecode(decode, 1, 1); + hyperstone_mul(decode); +} + + + +static void hyperstone_opc0(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_fadd(decode); +} + +static void hyperstone_opc1(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_faddd(decode); +} + +static void hyperstone_opc2(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_fsub(decode); +} + +static void hyperstone_opc3(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_fsubd(decode); +} + +static void hyperstone_opc4(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_fmul(decode); +} + +static void hyperstone_opc5(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_fmuld(decode); +} + +static void hyperstone_opc6(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_fdiv(decode); +} + +static void hyperstone_opc7(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_fdivd(decode); +} + +static void hyperstone_opc8(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_fcmp(decode); +} + +static void hyperstone_opc9(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_fcmpd(decode); +} + +static void hyperstone_opca(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_fcmpu(decode); +} + +static void hyperstone_opcb(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_fcmpud(decode); +} + +static void hyperstone_opcc(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_fcvt(decode); +} + +static void hyperstone_opcd(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_fcvtd(decode); +} + +static void hyperstone_opce(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLextdecode(decode); + hyperstone_extend(decode); +} + +static void hyperstone_opcf(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_do(decode); +} + + + +static void hyperstone_opd0(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LRdecode(decode, 0); + hyperstone_ldwr(decode); +} + +static void hyperstone_opd1(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LRdecode(decode, 1); + hyperstone_ldwr(decode); +} + +static void hyperstone_opd2(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LRdecode(decode, 0); + hyperstone_lddr(decode); +} + +static void hyperstone_opd3(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LRdecode(decode, 1); + hyperstone_lddr(decode); +} + +static void hyperstone_opd4(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LRdecode(decode, 0); + hyperstone_ldwp(decode); +} + +static void hyperstone_opd5(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LRdecode(decode, 1); + hyperstone_ldwp(decode); +} + +static void hyperstone_opd6(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LRdecode(decode, 0); + hyperstone_lddp(decode); +} + +static void hyperstone_opd7(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LRdecode(decode, 1); + hyperstone_lddp(decode); +} + +static void hyperstone_opd8(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LRdecode(decode, 0); + hyperstone_stwr(decode); +} + +static void hyperstone_opd9(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LRdecode(decode, 1); + hyperstone_stwr(decode); +} + +static void hyperstone_opda(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LRdecode(decode, 0); + hyperstone_stdr(decode); +} + +static void hyperstone_opdb(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LRdecode(decode, 1); + hyperstone_stdr(decode); +} + +static void hyperstone_opdc(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LRdecode(decode, 0); + hyperstone_stwp(decode); +} + +static void hyperstone_opdd(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LRdecode(decode, 1); + hyperstone_stwp(decode); +} + +static void hyperstone_opde(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LRdecode(decode, 0); + hyperstone_stdp(decode); +} + +static void hyperstone_opdf(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LRdecode(decode, 1); + hyperstone_stdp(decode); +} + + + +static void hyperstone_ope0(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_dbv(decode); +} + +static void hyperstone_ope1(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_dbnv(decode); +} + +static void hyperstone_ope2(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_dbe(decode); +} + +static void hyperstone_ope3(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_dbne(decode); +} + +static void hyperstone_ope4(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_dbc(decode); +} + +static void hyperstone_ope5(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_dbnc(decode); +} + +static void hyperstone_ope6(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_dbse(decode); +} + +static void hyperstone_ope7(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_dbht(decode); +} + +static void hyperstone_ope8(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_dbn(decode); +} + +static void hyperstone_ope9(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_dbnn(decode); +} + +static void hyperstone_opea(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_dble(decode); +} + +static void hyperstone_opeb(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_dbgt(decode); +} + +static void hyperstone_opec(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_dbr(decode); +} + +static void hyperstone_oped(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LLdecode(decode); + hyperstone_frame(decode); +} + +static void hyperstone_opee(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LRconstdecode(decode, 0); + hyperstone_call(decode); +} + +static void hyperstone_opef(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + LRconstdecode(decode, 1); + hyperstone_call(decode); +} + + + +static void hyperstone_opf0(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_bv(decode); +} + +static void hyperstone_opf1(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_bnv(decode); +} + +static void hyperstone_opf2(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_be(decode); +} + +static void hyperstone_opf3(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_bne(decode); +} + +static void hyperstone_opf4(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_bc(decode); +} + +static void hyperstone_opf5(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_bnc(decode); +} + +static void hyperstone_opf6(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_bse(decode); +} + +static void hyperstone_opf7(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_bht(decode); +} + +static void hyperstone_opf8(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_bn(decode); +} + +static void hyperstone_opf9(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_bnn(decode); +} + +static void hyperstone_opfa(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_ble(decode); +} + +static void hyperstone_opfb(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_bgt(decode); +} + +static void hyperstone_opfc(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCreldecode(decode); + hyperstone_br(decode); +} + +static void hyperstone_opfd(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCadrdecode(decode); + hyperstone_trap(decode); +} + +static void hyperstone_opfe(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCadrdecode(decode); + hyperstone_trap(decode); +} + +static void hyperstone_opff(UINT16 opcode) +{ + LOCAL_DECODE_INIT; + PCadrdecode(decode); + hyperstone_trap(decode); +} + + +static void (*hyperstone_op[0x100])(UINT16 opcode) = +{ + hyperstone_op00, hyperstone_op01, hyperstone_op02, hyperstone_op03, + hyperstone_op04, hyperstone_op05, hyperstone_op06, hyperstone_op07, + hyperstone_op08, hyperstone_op09, hyperstone_op0a, hyperstone_op0b, + hyperstone_op0c, hyperstone_op0d, hyperstone_op0e, hyperstone_op0f, + + hyperstone_op10, hyperstone_op11, hyperstone_op12, hyperstone_op13, + hyperstone_op14, hyperstone_op15, hyperstone_op16, hyperstone_op17, + hyperstone_op18, hyperstone_op19, hyperstone_op1a, hyperstone_op1b, + hyperstone_op1c, hyperstone_op1d, hyperstone_op1e, hyperstone_op1f, + + hyperstone_op20, hyperstone_op21, hyperstone_op22, hyperstone_op23, + hyperstone_op24, hyperstone_op25, hyperstone_op26, hyperstone_op27, + hyperstone_op28, hyperstone_op29, hyperstone_op2a, hyperstone_op2b, + hyperstone_op2c, hyperstone_op2d, hyperstone_op2e, hyperstone_op2f, + + hyperstone_op30, hyperstone_op31, hyperstone_op32, hyperstone_op33, + hyperstone_op34, hyperstone_op35, hyperstone_op36, hyperstone_op37, + hyperstone_op38, hyperstone_op39, hyperstone_op3a, hyperstone_op3b, + hyperstone_op3c, hyperstone_op3d, hyperstone_op3e, hyperstone_op3f, + + hyperstone_op40, hyperstone_op41, hyperstone_op42, hyperstone_op43, + hyperstone_op44, hyperstone_op45, hyperstone_op46, hyperstone_op47, + hyperstone_op48, hyperstone_op49, hyperstone_op4a, hyperstone_op4b, + hyperstone_op4c, hyperstone_op4d, hyperstone_op4e, hyperstone_op4f, + + hyperstone_op50, hyperstone_op51, hyperstone_op52, hyperstone_op53, + hyperstone_op54, hyperstone_op55, hyperstone_op56, hyperstone_op57, + hyperstone_op58, hyperstone_op59, hyperstone_op5a, hyperstone_op5b, + hyperstone_op5c, hyperstone_op5d, hyperstone_op5e, hyperstone_op5f, + + hyperstone_op60, hyperstone_op61, hyperstone_op62, hyperstone_op63, + hyperstone_op64, hyperstone_op65, hyperstone_op66, hyperstone_op67, + hyperstone_op68, hyperstone_op69, hyperstone_op6a, hyperstone_op6b, + hyperstone_op6c, hyperstone_op6d, hyperstone_op6e, hyperstone_op6f, + + hyperstone_op70, hyperstone_op71, hyperstone_op72, hyperstone_op73, + hyperstone_op74, hyperstone_op75, hyperstone_op76, hyperstone_op77, + hyperstone_op78, hyperstone_op79, hyperstone_op7a, hyperstone_op7b, + hyperstone_op7c, hyperstone_op7d, hyperstone_op7e, hyperstone_op7f, + + hyperstone_op80, hyperstone_op81, hyperstone_op82, hyperstone_op83, + hyperstone_op84, hyperstone_op85, hyperstone_op86, hyperstone_op87, + hyperstone_op88, hyperstone_op89, hyperstone_op8a, hyperstone_op8b, + hyperstone_op8c, hyperstone_op8d, hyperstone_op8e, hyperstone_op8f, + + hyperstone_op90, hyperstone_op91, hyperstone_op92, hyperstone_op93, + hyperstone_op94, hyperstone_op95, hyperstone_op96, hyperstone_op97, + hyperstone_op98, hyperstone_op99, hyperstone_op9a, hyperstone_op9b, + hyperstone_op9c, hyperstone_op9d, hyperstone_op9e, hyperstone_op9f, + + hyperstone_opa0, hyperstone_opa1, hyperstone_opa2, hyperstone_opa3, + hyperstone_opa4, hyperstone_opa5, hyperstone_opa6, hyperstone_opa7, + hyperstone_opa8, hyperstone_opa9, hyperstone_opaa, hyperstone_opab, + hyperstone_opac, hyperstone_opad, hyperstone_opae, hyperstone_opaf, + + hyperstone_opb0, hyperstone_opb1, hyperstone_opb2, hyperstone_opb3, + hyperstone_opb4, hyperstone_opb5, hyperstone_opb6, hyperstone_opb7, + hyperstone_opb8, hyperstone_opb9, hyperstone_opba, hyperstone_opbb, + hyperstone_opbc, hyperstone_opbd, hyperstone_opbe, hyperstone_opbf, + + hyperstone_opc0, hyperstone_opc1, hyperstone_opc2, hyperstone_opc3, + hyperstone_opc4, hyperstone_opc5, hyperstone_opc6, hyperstone_opc7, + hyperstone_opc8, hyperstone_opc9, hyperstone_opca, hyperstone_opcb, + hyperstone_opcc, hyperstone_opcd, hyperstone_opce, hyperstone_opcf, + + hyperstone_opd0, hyperstone_opd1, hyperstone_opd2, hyperstone_opd3, + hyperstone_opd4, hyperstone_opd5, hyperstone_opd6, hyperstone_opd7, + hyperstone_opd8, hyperstone_opd9, hyperstone_opda, hyperstone_opdb, + hyperstone_opdc, hyperstone_opdd, hyperstone_opde, hyperstone_opdf, + + hyperstone_ope0, hyperstone_ope1, hyperstone_ope2, hyperstone_ope3, + hyperstone_ope4, hyperstone_ope5, hyperstone_ope6, hyperstone_ope7, + hyperstone_ope8, hyperstone_ope9, hyperstone_opea, hyperstone_opeb, + hyperstone_opec, hyperstone_oped, hyperstone_opee, hyperstone_opef, + + hyperstone_opf0, hyperstone_opf1, hyperstone_opf2, hyperstone_opf3, + hyperstone_opf4, hyperstone_opf5, hyperstone_opf6, hyperstone_opf7, + hyperstone_opf8, hyperstone_opf9, hyperstone_opfa, hyperstone_opfb, + hyperstone_opfc, hyperstone_opfd, hyperstone_opfe, hyperstone_opff +}; diff --git a/src/emu/cpu/f8/f8.c b/src/emu/cpu/f8/f8.c index 6e3ea1ec9ef..11041805639 100644 --- a/src/emu/cpu/f8/f8.c +++ b/src/emu/cpu/f8/f8.c @@ -56,7 +56,7 @@ typedef struct { int irq_request; } f8_Regs; -int f8_icount; +static int f8_icount; static f8_Regs f8; @@ -1531,7 +1531,7 @@ static void f8_ns_isar_d(void) f8.is = (f8.is & 0x38) | ((f8.is - 1) & 0x07); } -void f8_reset(void) +static void f8_reset(void) { UINT8 data; int i; @@ -1570,7 +1570,7 @@ void f8_reset(void) } /* Execute cycles - returns number of cycles actually run */ -int f8_execute(int cycles) +static int f8_execute(int cycles) { f8_icount = cycles; diff --git a/src/emu/cpu/h83002/h8periph.c b/src/emu/cpu/h83002/h8periph.c index d410759830a..603434a0ba0 100644 --- a/src/emu/cpu/h83002/h8periph.c +++ b/src/emu/cpu/h83002/h8periph.c @@ -339,12 +339,14 @@ void h8_itu_write8(UINT8 reg, UINT8 val) } } +#ifdef UNUSED_FUNCTION UINT8 h8_debugger_itu_read8(UINT8 reg) { UINT8 val; val = 0; return val; } +#endif UINT8 h8_register_read8(UINT32 address) diff --git a/src/emu/cpu/hd6309/hd6309.c b/src/emu/cpu/hd6309/hd6309.c index 97bc972fbf2..c6c98a95f15 100644 --- a/src/emu/cpu/hd6309/hd6309.c +++ b/src/emu/cpu/hd6309/hd6309.c @@ -556,7 +556,7 @@ static void hd6309_reset(void) UpdateState(); } -void hd6309_exit(void) +static void hd6309_exit(void) { /* nothing to do ? */ } diff --git a/src/emu/cpu/i386/i386.c b/src/emu/cpu/i386/i386.c index e1cc92645fa..1a54df77947 100644 --- a/src/emu/cpu/i386/i386.c +++ b/src/emu/cpu/i386/i386.c @@ -55,7 +55,7 @@ static void i386_load_protected_mode_segment( I386_SREG *seg ) seg->d = (seg->flags & 0x4000) ? 1 : 0; } -void i386_load_segment_descriptor( int segment ) +static void i386_load_segment_descriptor( int segment ) { if (PROTECTED_MODE) { @@ -496,7 +496,7 @@ static void i386_postload(void) CHANGE_PC(I.eip); } -void i386_init(int index, int clock, const void *config, int (*irqcallback)(int)) +static void i386_init(int index, int clock, const void *config, int (*irqcallback)(int)) { int i, j; static const int regs8[8] = {AL,CL,DL,BL,AH,CH,DH,BH}; @@ -614,7 +614,7 @@ static void build_opcode_table(UINT32 features) } } -void i386_reset(void) +static void i386_reset(void) { int (*save_irqcallback)(int); @@ -696,7 +696,7 @@ static void i386_set_a20_line(int state) } } -int i386_execute(int num_cycles) +static int i386_execute(int num_cycles) { I.cycles = num_cycles; I.base_cycles = num_cycles; @@ -1067,7 +1067,7 @@ void i386_get_info(UINT32 state, cpuinfo *info) #if (HAS_I486) -void i486_init(int index, int clock, const void *config, int (*irqcallback)(int)) +static void i486_init(int index, int clock, const void *config, int (*irqcallback)(int)) { i386_init(index, clock, config, irqcallback); } @@ -1173,7 +1173,7 @@ void i486_get_info(UINT32 state, cpuinfo *info) #if (HAS_PENTIUM) -void pentium_init(int index, int clock, const void *config, int (*irqcallback)(int)) +static void pentium_init(int index, int clock, const void *config, int (*irqcallback)(int)) { i386_init(index, clock, config, irqcallback); } @@ -1299,7 +1299,7 @@ void pentium_get_info(UINT32 state, cpuinfo *info) #if (HAS_MEDIAGX) -void mediagx_init(int index, int clock, const void *config, int (*irqcallback)(int)) +static void mediagx_init(int index, int clock, const void *config, int (*irqcallback)(int)) { i386_init(index, clock, config, irqcallback); } diff --git a/src/emu/cpu/i8039/i8039.c b/src/emu/cpu/i8039/i8039.c index 3c1f8df449c..05c7be91ac7 100644 --- a/src/emu/cpu/i8039/i8039.c +++ b/src/emu/cpu/i8039/i8039.c @@ -96,7 +96,7 @@ typedef struct } I8039_Regs; static I8039_Regs R; -int i8039_ICount; +static int i8039_ICount; static int inst_cycles; static UINT8 Old_T1; diff --git a/src/emu/cpu/i8085/i8085.c b/src/emu/cpu/i8085/i8085.c index 11ea984e54d..c3983cbefc8 100644 --- a/src/emu/cpu/i8085/i8085.c +++ b/src/emu/cpu/i8085/i8085.c @@ -1261,7 +1261,7 @@ static void Interrupt(void) } } -int i8085_execute(int cycles) +static int i8085_execute(int cycles) { i8085_ICount = cycles; @@ -1536,7 +1536,7 @@ static void i8085_set_irq_line(int irqline, int state) **************************************************************************/ #if (HAS_8080) -void i8080_init(int index, int clock, const void *config, int (*irqcallback)(int)) +static void i8080_init(int index, int clock, const void *config, int (*irqcallback)(int)) { init_tables(); I.cputype = 0; @@ -1558,7 +1558,7 @@ void i8080_init(int index, int clock, const void *config, int (*irqcallback)(int state_save_register_item_array("i8080", index, I.irq_state); } -void i8080_set_irq_line(int irqline, int state) +static void i8080_set_irq_line(int irqline, int state) { if (irqline == INPUT_LINE_NMI) { diff --git a/src/emu/cpu/i86/i286.c b/src/emu/cpu/i86/i286.c index f4baf825069..f24daa0163b 100644 --- a/src/emu/cpu/i86/i286.c +++ b/src/emu/cpu/i86/i286.c @@ -65,7 +65,7 @@ typedef struct memory_interface mem; } i80286_Regs; -int i80286_ICount; +static int i80286_ICount; static i80286_Regs I; static unsigned prefix_base; /* base address of the latest prefix segment */ diff --git a/src/emu/cpu/i86/i86.c b/src/emu/cpu/i86/i86.c index 840e5b6d89e..0c3918a3015 100644 --- a/src/emu/cpu/i86/i86.c +++ b/src/emu/cpu/i86/i86.c @@ -57,7 +57,7 @@ i8086_Regs; /* cpu state */ /***************************************************************************/ -int i8086_ICount; +static int i8086_ICount; static i8086_Regs I; static unsigned prefix_base; /* base address of the latest prefix segment */ diff --git a/src/emu/cpu/i8x41/i8x41.c b/src/emu/cpu/i8x41/i8x41.c index e5642bbabca..dbdb5e739c6 100644 --- a/src/emu/cpu/i8x41/i8x41.c +++ b/src/emu/cpu/i8x41/i8x41.c @@ -111,7 +111,7 @@ typedef struct { int (*irq_callback)(int irqline); } I8X41; -int i8x41_ICount; +static int i8x41_ICount; static I8X41 i8x41; diff --git a/src/emu/cpu/konami/konami.c b/src/emu/cpu/konami/konami.c index d02753ac695..b9568c4dea4 100644 --- a/src/emu/cpu/konami/konami.c +++ b/src/emu/cpu/konami/konami.c @@ -167,8 +167,8 @@ static PAIR ea; /* effective address */ } /* public globals */ -int konami_ICount=50000; -int konami_Flags; /* flags for speed optimization (obsolete!!) */ +static int konami_ICount=50000; +//int konami_Flags; /* flags for speed optimization (obsolete!!) */ /* these are re-defined in konami.h TO RAM, ROM or functions in memory.c */ #define RM(Addr) KONAMI_RDMEM(Addr) diff --git a/src/emu/cpu/m37710/m37710.c b/src/emu/cpu/m37710/m37710.c index 5ce1a75b2c7..1ddad9434c2 100644 --- a/src/emu/cpu/m37710/m37710.c +++ b/src/emu/cpu/m37710/m37710.c @@ -56,12 +56,13 @@ #define M37710_DEBUG (0) // enables verbose logging for peripherals, etc. -extern void m37710_set_irq_line(int line, int state); +static void m37710_set_irq_line(int line, int state); /* Our CPU structure */ m37710i_cpu_struct m37710i_cpu = {0}; -int m37710_ICount = 0, m37710_fullCount = 0; +int m37710_ICount = 0; +static int m37710_fullCount = 0; /* Temporary Variables */ uint m37710i_source; @@ -882,7 +883,7 @@ void m37710i_update_irqs(void) /* external functions */ -void m37710_reset(void) +static void m37710_reset(void) { /* Start the CPU */ CPU_STOPPED = 0; @@ -927,6 +928,7 @@ void m37710_exit(void) /* nothing to do yet */ } +#ifdef UNUSED_FUNCTION /* return elapsed cycles in the current slice */ int m37710_getcycles(void) { @@ -940,9 +942,10 @@ void m37710_yield(void) m37710_ICount = 0; } +#endif /* Execute some instructions */ -int m37710_execute(int cycles) +static int m37710_execute(int cycles) { m37710_fullCount = cycles; @@ -959,45 +962,47 @@ static void m37710_get_context(void *dst_context) } /* Set the current CPU context */ -void m37710_set_context(void *src_context) +static void m37710_set_context(void *src_context) { m37710i_cpu = *(m37710i_cpu_struct*)src_context; m37710i_jumping(REG_PB | REG_PC); } /* Get the current Program Counter */ +#ifdef UNUSED_FUNCTION unsigned m37710_get_pc(void) { return REG_PC; } +#endif /* Set the Program Counter */ -void m37710_set_pc(unsigned val) +static void m37710_set_pc(unsigned val) { REG_PC = MAKE_UINT_16(val); m37710_jumping(REG_PB | REG_PC); } /* Get the current Stack Pointer */ -unsigned m37710_get_sp(void) +static unsigned m37710_get_sp(void) { return REG_S; } /* Set the Stack Pointer */ -void m37710_set_sp(unsigned val) +static void m37710_set_sp(unsigned val) { REG_S = MAKE_UINT_16(val); } /* Get a register */ -unsigned m37710_get_reg(int regnum) +static unsigned m37710_get_reg(int regnum) { return FTABLE_GET_REG(regnum); } /* Set a register */ -void m37710_set_reg(int regnum, unsigned value) +static void m37710_set_reg(int regnum, unsigned value) { FTABLE_SET_REG(regnum, value); } @@ -1013,16 +1018,18 @@ void m37710_state_save(void *file) } /* Set an interrupt line */ -void m37710_set_irq_line(int line, int state) +static void m37710_set_irq_line(int line, int state) { FTABLE_SET_LINE(line, state); } /* Set the callback that is called when servicing an interrupt */ +#ifdef UNUSED_FUNCTION void m37710_set_irq_callback(int (*callback)(int)) { INT_ACK = callback; } +#endif /* Disassemble an instruction */ #ifdef MAME_DEBUG @@ -1043,7 +1050,7 @@ static void m37710_restore_state(void) m37710i_jumping(REG_PB | REG_PC); } -void m37710_init(int index, int clock, const void *config, int (*irqcallback)(int)) +static void m37710_init(int index, int clock, const void *config, int (*irqcallback)(int)) { INT_ACK = irqcallback; diff --git a/src/emu/cpu/m6800/m6800.c b/src/emu/cpu/m6800/m6800.c index 5964e86212f..3adbc951a5b 100644 --- a/src/emu/cpu/m6800/m6800.c +++ b/src/emu/cpu/m6800/m6800.c @@ -1299,7 +1299,7 @@ static void m6802_init(int index, int clock, const void *config, int (*irqcallba * M6803 almost (fully?) equal to the M6801 ****************************************************************************/ #if (HAS_M6803) -void m6803_init(int index, int clock, const void *config, int (*irqcallback)(int)) +static void m6803_init(int index, int clock, const void *config, int (*irqcallback)(int)) { // m6800.subtype = SUBTYPE_M6803; m6800.insn = m6803_insn; diff --git a/src/emu/cpu/mips/mips3drc.c b/src/emu/cpu/mips/mips3drc.c index d10378f3e95..08c48034c33 100644 --- a/src/emu/cpu/mips/mips3drc.c +++ b/src/emu/cpu/mips/mips3drc.c @@ -550,7 +550,7 @@ static void mips3_set_info(UINT32 state, cpuinfo *info) } -void mips3_get_info(UINT32 state, cpuinfo *info) +static void mips3_get_info(UINT32 state, cpuinfo *info) { switch (state) { diff --git a/src/emu/cpu/nec/nec.c b/src/emu/cpu/nec/nec.c index 3dfc82a160e..cecab37285f 100644 --- a/src/emu/cpu/nec/nec.c +++ b/src/emu/cpu/nec/nec.c @@ -1145,12 +1145,12 @@ static void configure_memory_16bit(void) /* Wrappers for the different CPU types */ #if (HAS_V20||HAS_V25) -void v20_init(int index, int clock, const void *config, int (*irqcallback)(int)) +static void v20_init(int index, int clock, const void *config, int (*irqcallback)(int)) { nec_init(index, clock, config, irqcallback, 0); configure_memory_8bit(); } -int v20_execute(int cycles) +static int v20_execute(int cycles) { nec_ICount=cycles; chip_type=V20; @@ -1177,12 +1177,12 @@ int v20_execute(int cycles) #endif #if (HAS_V30||HAS_V35) -void v30_init(int index, int clock, const void *config, int (*irqcallback)(int)) +static void v30_init(int index, int clock, const void *config, int (*irqcallback)(int)) { nec_init(index, clock, config, irqcallback, 1); configure_memory_16bit(); } -int v30_execute(int cycles) { +static int v30_execute(int cycles) { nec_ICount=cycles; chip_type=V30; @@ -1208,12 +1208,12 @@ int v30_execute(int cycles) { #endif #if (HAS_V33) -void v33_init(int index, int clock, const void *config, int (*irqcallback)(int)) +static void v33_init(int index, int clock, const void *config, int (*irqcallback)(int)) { nec_init(index, clock, config, irqcallback, 2); configure_memory_16bit(); } -int v33_execute(int cycles) +static int v33_execute(int cycles) { nec_ICount=cycles; chip_type=V33; @@ -1301,7 +1301,7 @@ static void nec_set_info(UINT32 state, cpuinfo *info) * Generic get_info **************************************************************************/ -void nec_get_info(UINT32 state, cpuinfo *info) +static void nec_get_info(UINT32 state, cpuinfo *info) { int flags; diff --git a/src/emu/cpu/pic16c5x/pic16c5x.c b/src/emu/cpu/pic16c5x/pic16c5x.c index 7daee53b009..f8ee36e9967 100644 --- a/src/emu/cpu/pic16c5x/pic16c5x.c +++ b/src/emu/cpu/pic16c5x/pic16c5x.c @@ -1078,7 +1078,7 @@ ADDRESS_MAP_END * PIC16C54 Reset ****************************************************************************/ -void pic16C54_reset(void) +static void pic16C54_reset(void) { picmodel = 0x16C54; picRAMmask = 0x1f; @@ -1130,7 +1130,7 @@ ADDRESS_MAP_END * PIC16C55 Reset ****************************************************************************/ -void pic16C55_reset(void) +static void pic16C55_reset(void) { picmodel = 0x16C55; picRAMmask = 0x1f; @@ -1182,7 +1182,7 @@ ADDRESS_MAP_END * PIC16C56 Reset ****************************************************************************/ -void pic16C56_reset(void) +static void pic16C56_reset(void) { picmodel = 0x16C56; picRAMmask = 0x1f; @@ -1239,7 +1239,7 @@ ADDRESS_MAP_END * PIC16C57 Reset ****************************************************************************/ -void pic16C57_reset(void) +static void pic16C57_reset(void) { picmodel = 0x16C57; picRAMmask = 0x7f; @@ -1297,7 +1297,7 @@ ADDRESS_MAP_END * PIC16C58 Reset ****************************************************************************/ -void pic16C58_reset(void) +static void pic16C58_reset(void) { picmodel = 0x16C58; picRAMmask = 0x7f; diff --git a/src/emu/cpu/powerpc/ppc403.c b/src/emu/cpu/powerpc/ppc403.c index d4370e9fdeb..9d1988de86d 100644 --- a/src/emu/cpu/powerpc/ppc403.c +++ b/src/emu/cpu/powerpc/ppc403.c @@ -566,7 +566,7 @@ static void ppc_wrteei(UINT32 op) /**************************************************************************/ /* PPC403 Serial Port */ -UINT8 ppc403_spu_r(UINT32 a) +static UINT8 ppc403_spu_r(UINT32 a) { switch(a & 0xf) { @@ -582,7 +582,7 @@ UINT8 ppc403_spu_r(UINT32 a) } } -void ppc403_spu_w(UINT32 a, UINT8 d) +static void ppc403_spu_w(UINT32 a, UINT8 d) { switch(a & 0xf) { diff --git a/src/emu/cpu/powerpc/ppcdrc.c b/src/emu/cpu/powerpc/ppcdrc.c index 4a44b7a7e9d..56780178758 100644 --- a/src/emu/cpu/powerpc/ppcdrc.c +++ b/src/emu/cpu/powerpc/ppcdrc.c @@ -33,8 +33,8 @@ static int ppcdrc602_execute(int cycles); static void ppcdrc602_set_irq_line(int irqline, int state); #endif #if (HAS_PPC403) -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); static void ppcdrc403_init(int index, int clock, const void *_config, int (*irqcallback)(int)); static void ppcdrc403_exit(void); static void ppcdrc403_reset(void); @@ -1002,7 +1002,7 @@ static void code_log(const char *label, x86code *start, x86code *stop) /* Initialization and shutdown */ -void ppc_init(void) +static void ppc_init(void) { int i,j; @@ -1939,7 +1939,7 @@ static void ppc_set_info(UINT32 state, cpuinfo *info) } } -void ppc_get_info(UINT32 state, cpuinfo *info) +static void ppc_get_info(UINT32 state, cpuinfo *info) { switch(state) { @@ -2077,7 +2077,7 @@ void ppc_get_info(UINT32 state, cpuinfo *info) /* PowerPC 403 */ #if (HAS_PPC403) -void ppc403_set_info(UINT32 state, cpuinfo *info) +static void ppc403_set_info(UINT32 state, cpuinfo *info) { if (state >= CPUINFO_INT_INPUT_STATE && state <= CPUINFO_INT_INPUT_STATE + 5) { @@ -2115,7 +2115,7 @@ void ppc403_get_info(UINT32 state, cpuinfo *info) /* PowerPC 603 */ #if (HAS_PPC603) -void ppc603_set_info(UINT32 state, cpuinfo *info) +static void ppc603_set_info(UINT32 state, cpuinfo *info) { if (state >= CPUINFO_INT_INPUT_STATE && state <= CPUINFO_INT_INPUT_STATE + 5) { @@ -2165,7 +2165,7 @@ void ppc603_get_info(UINT32 state, cpuinfo *info) /* PowerPC 602 */ #if (HAS_PPC602) -void ppc602_set_info(UINT32 state, cpuinfo *info) +static void ppc602_set_info(UINT32 state, cpuinfo *info) { if (state >= CPUINFO_INT_INPUT_STATE && state <= CPUINFO_INT_INPUT_STATE + 5) { diff --git a/src/emu/cpu/saturn/saturn.c b/src/emu/cpu/saturn/saturn.c index e18ec06dc9b..6caceb0dda9 100644 --- a/src/emu/cpu/saturn/saturn.c +++ b/src/emu/cpu/saturn/saturn.c @@ -153,7 +153,7 @@ INLINE void saturn_take_irq(void) saturn.pending_irq = 0; } -int saturn_execute(int cycles) +static int saturn_execute(int cycles) { saturn_ICount = cycles; @@ -195,6 +195,7 @@ int saturn_execute(int cycles) return cycles - saturn_ICount; } +#ifdef UNUSED_FUNCTION void saturn_set_nmi_line(int state) { if (saturn.nmi_state == state) return; @@ -225,6 +226,7 @@ void saturn_set_irq_callback(int (*callback)(int)) { saturn.irq_callback = callback; } +#endif #if 0 static void saturn_state_save(void *file) diff --git a/src/emu/cpu/sh2/sh2.c b/src/emu/cpu/sh2/sh2.c index e6d486cfd77..ef56912acaa 100644 --- a/src/emu/cpu/sh2/sh2.c +++ b/src/emu/cpu/sh2/sh2.c @@ -2845,7 +2845,7 @@ READ32_HANDLER( sh2_internal_r ) return sh2.m[offset]; } -void sh2_set_frt_input(int cpunum, int state) +static void sh2_set_frt_input(int cpunum, int state) { if(state == PULSE_LINE) { diff --git a/src/emu/cpu/sh4/sh4.c b/src/emu/cpu/sh4/sh4.c index 75967883d3d..82daf0cc51c 100644 --- a/src/emu/cpu/sh4/sh4.c +++ b/src/emu/cpu/sh4/sh4.c @@ -3944,7 +3944,7 @@ READ32_HANDLER( sh4_internal_r ) return sh4.m[offset]; } -void sh4_set_frt_input(int cpunum, int state) +static void sh4_set_frt_input(int cpunum, int state) { if(state == PULSE_LINE) { @@ -3984,7 +3984,7 @@ void sh4_set_frt_input(int cpunum, int state) cpuintrf_pop_context(); } -void sh4_set_irln_input(int cpunum, int value) +static void sh4_set_irln_input(int cpunum, int value) { if (sh4.irln == value) return; @@ -4221,7 +4221,7 @@ static void sh4_init(int index, int clock, const void *config, int (*irqcallback } -void sh4_dma_ddt(struct sh4_ddt_dma *s) +static void sh4_dma_ddt(struct sh4_ddt_dma *s) { UINT32 chcr; UINT32 *p32bits; diff --git a/src/emu/cpu/sharc/sharc.c b/src/emu/cpu/sharc/sharc.c index fea1374e454..3570ea27eb8 100644 --- a/src/emu/cpu/sharc/sharc.c +++ b/src/emu/cpu/sharc/sharc.c @@ -845,7 +845,7 @@ static void sharc_set_info(UINT32 state, cpuinfo *info) } #if (HAS_ADSP21062) -void adsp21062_set_info(UINT32 state, cpuinfo *info) +static void adsp21062_set_info(UINT32 state, cpuinfo *info) { if (state >= CPUINFO_INT_INPUT_STATE && state <= CPUINFO_INT_INPUT_STATE + 2) { @@ -956,7 +956,7 @@ static ADDRESS_MAP_START( internal_pgm, ADDRESS_SPACE_PROGRAM, 64 ) AM_RANGE(0x20000, 0x7ffff) AM_RAM ADDRESS_MAP_END -void sharc_get_info(UINT32 state, cpuinfo *info) +static void sharc_get_info(UINT32 state, cpuinfo *info) { switch(state) { diff --git a/src/emu/cpu/sharc/sharcdsm.c b/src/emu/cpu/sharc/sharcdsm.c index a796d0dcd68..3845433f9e7 100644 --- a/src/emu/cpu/sharc/sharcdsm.c +++ b/src/emu/cpu/sharc/sharcdsm.c @@ -298,7 +298,7 @@ static void get_if_condition(int cond) } } -void pm_dm_ureg(int g, int d, int i, int m, int ureg, int update) +static void pm_dm_ureg(int g, int d, int i, int m, int ureg, int update) { if (update) // post-modify { @@ -353,7 +353,7 @@ void pm_dm_ureg(int g, int d, int i, int m, int ureg, int update) } } -void pm_dm_imm_dreg(int g, int d, int i, int data, int dreg, int update) +static void pm_dm_imm_dreg(int g, int d, int i, int data, int dreg, int update) { if (update) // post-modify { @@ -407,7 +407,7 @@ void pm_dm_imm_dreg(int g, int d, int i, int data, int dreg, int update) } } -void pm_dm_dreg(int g, int d, int i, int m, int dreg) +static void pm_dm_dreg(int g, int d, int i, int m, int dreg) { if (d) { @@ -433,7 +433,7 @@ void pm_dm_dreg(int g, int d, int i, int m, int dreg) } } -void shiftop(int shift, int data, int rn, int rx) +static void shiftop(int shift, int data, int rn, int rx) { INT8 data8 = data & 0xff; int bit6 = data & 0x3f; diff --git a/src/emu/cpu/t11/t11dasm.c b/src/emu/cpu/t11/t11dasm.c index 0564b6bffcb..a3cd49ceb86 100644 --- a/src/emu/cpu/t11/t11dasm.c +++ b/src/emu/cpu/t11/t11dasm.c @@ -17,7 +17,7 @@ static offs_t pcbase; #define PARAM_WORD(v) ((v) = rombase[pc - pcbase] | (rombase[pc + 1 - pcbase] << 8), pc += 2) -unsigned MakeEA (char **ea, int lo, unsigned pc, int width) +static unsigned MakeEA (char **ea, int lo, unsigned pc, int width) { char *buffer = cpuintrf_temp_str(); int reg, pm; diff --git a/src/emu/cpu/tlcs90/tlcs90.c b/src/emu/cpu/tlcs90/tlcs90.c index 7cce9e8fd89..3a1576eaa65 100644 --- a/src/emu/cpu/tlcs90/tlcs90.c +++ b/src/emu/cpu/tlcs90/tlcs90.c @@ -2302,7 +2302,7 @@ static READ8_HANDLER( t90_internal_registers_r ) return data; } -void t90_start_timer(int i) +static void t90_start_timer(int i) { int prescaler; attotime period; @@ -2349,7 +2349,7 @@ void t90_start_timer(int i) logerror("%04X: CPU Timer %d started at %lf Hz\n", activecpu_get_pc(), i, 1.0 / attotime_to_double(period)); } -void t90_start_timer4(void) +static void t90_start_timer4(void) { int prescaler; attotime period; @@ -2372,13 +2372,13 @@ void t90_start_timer4(void) } -void t90_stop_timer(int i) +static void t90_stop_timer(int i) { timer_adjust(T90.timer[i], attotime_never, i, attotime_zero); logerror("%04X: CPU Timer %d stopped\n", activecpu_get_pc(), i); } -void t90_stop_timer4(void) +static void t90_stop_timer4(void) { t90_stop_timer(4); } diff --git a/src/emu/cpu/tms32025/tms32025.c b/src/emu/cpu/tms32025/tms32025.c index a4935a38c8d..3c9c3b971a7 100644 --- a/src/emu/cpu/tms32025/tms32025.c +++ b/src/emu/cpu/tms32025/tms32025.c @@ -130,8 +130,8 @@ Table 3-2. TMS32025/26 Memory Blocks #endif -UINT16 *tms32025_pgmmap[0x200]; -UINT16 *tms32025_datamap[0x200]; +static UINT16 *tms32025_pgmmap[0x200]; +static UINT16 *tms32025_datamap[0x200]; #define SET_PC(x) do { R.PC = (x); change_pc(R.PC<<1); } while (0) diff --git a/src/emu/cpu/tms32031/tms32031.c b/src/emu/cpu/tms32031/tms32031.c index 3545bc9e7fb..6907cd1cc2f 100644 --- a/src/emu/cpu/tms32031/tms32031.c +++ b/src/emu/cpu/tms32031/tms32031.c @@ -416,7 +416,7 @@ static void tms32031_reset(void) static UINT32 hits[0x200*4]; #endif -void tms32031_exit(void) +static void tms32031_exit(void) { #if (LOG_OPCODE_USAGE) int i; diff --git a/src/emu/cpu/tms32051/dis32051.c b/src/emu/cpu/tms32051/dis32051.c index f78862048f6..7a0b577c37a 100644 --- a/src/emu/cpu/tms32051/dis32051.c +++ b/src/emu/cpu/tms32051/dis32051.c @@ -127,7 +127,7 @@ static char *GET_SHIFT(int shift) return buffer; } -void dasm_group_be(UINT16 opcode) +static void dasm_group_be(UINT16 opcode) { int subop = opcode & 0xff; diff --git a/src/emu/cpu/tms32051/tms32051.c b/src/emu/cpu/tms32051/tms32051.c index f1dbd246530..9bea362fb33 100644 --- a/src/emu/cpu/tms32051/tms32051.c +++ b/src/emu/cpu/tms32051/tms32051.c @@ -670,7 +670,7 @@ static void tms_get_info(UINT32 state, cpuinfo *info) } #if (HAS_TMS32051) -void tms32051_set_info(UINT32 state, cpuinfo *info) +static void tms32051_set_info(UINT32 state, cpuinfo *info) { if (state >= CPUINFO_INT_INPUT_STATE && state <= CPUINFO_INT_INPUT_STATE + 5) { diff --git a/src/emu/cpu/tms34010/34010dsm.c b/src/emu/cpu/tms34010/34010dsm.c index 129ae27517e..7bc2bf8922e 100644 --- a/src/emu/cpu/tms34010/34010dsm.c +++ b/src/emu/cpu/tms34010/34010dsm.c @@ -246,7 +246,7 @@ static void print_reg_list(UINT16 rev) } -unsigned Dasm340x0(char *buff, UINT32 pc, int is_34020) +static unsigned Dasm340x0(char *buff, UINT32 pc, int is_34020) { int flags = 0; UINT8 bad = 0; diff --git a/src/emu/cpu/upd7810/upd7810.c b/src/emu/cpu/upd7810/upd7810.c index c726934a4b1..ea9ad902bec 100644 --- a/src/emu/cpu/upd7810/upd7810.c +++ b/src/emu/cpu/upd7810/upd7810.c @@ -1497,7 +1497,7 @@ static void upd7810_timers(int cycles) } } -void upd7810_init(int index, int clock, const void *config, int (*irqcallback)(int)) +static void upd7810_init(int index, int clock, const void *config, int (*irqcallback)(int)) { upd7810.config = *(const UPD7810_CONFIG*) config; upd7810.irq_callback = irqcallback; diff --git a/src/emu/cpu/v30mz/v30mz.c b/src/emu/cpu/v30mz/v30mz.c index 940e50d20b1..83ad5c867d7 100644 --- a/src/emu/cpu/v30mz/v30mz.c +++ b/src/emu/cpu/v30mz/v30mz.c @@ -949,8 +949,8 @@ static void nec_init(int index, int clock, const void *config, int (*irqcallback I.irq_callback = irqcallback; } -void v30mz_init(int index, int clock, const void *config, int (*irqcallback)(int)) { nec_init(index, clock, config, irqcallback, 3); } -int v30mz_execute(int cycles) +static void v30mz_init(int index, int clock, const void *config, int (*irqcallback)(int)) { nec_init(index, clock, config, irqcallback, 3); } +static int v30mz_execute(int cycles) { nec_ICount=cycles; chip_type=V30MZ; diff --git a/src/emu/cpu/v810/v810.c b/src/emu/cpu/v810/v810.c index 277c8895536..4eabb624492 100644 --- a/src/emu/cpu/v810/v810.c +++ b/src/emu/cpu/v810/v810.c @@ -945,7 +945,7 @@ static UINT32 (*OpCodeTable[64])(void) = /* 0x3f */ opOUTW // out.w reg2, disp16[reg1] 6b }; -void v810_init(int index, int clock, const void *config, int (*irqcallback)(int)) +static void v810_init(int index, int clock, const void *config, int (*irqcallback)(int)) { v810.irq_line = CLEAR_LINE; v810.nmi_line = CLEAR_LINE; @@ -958,7 +958,7 @@ void v810_init(int index, int clock, const void *config, int (*irqcallback)(int) } -void v810_reset(void) +static void v810_reset(void) { int i; for(i=0;i<64;i++) v810.reg[i]=0; @@ -967,7 +967,7 @@ void v810_reset(void) ECR = 0x0000fff0; } -int v810_execute(int cycles) +static int v810_execute(int cycles) { v810_ICount = cycles; while(v810_ICount>=0) @@ -981,13 +981,13 @@ int v810_execute(int cycles) return cycles-v810_ICount; } -void v810_get_context(void *dst) +static void v810_get_context(void *dst) { if(dst) *(v810info *)dst = v810; } -void v810_set_context(void *src) +static void v810_set_context(void *src) { if(src) v810 = *(v810info *)src; diff --git a/src/emu/cpu/z180/z180.c b/src/emu/cpu/z180/z180.c index e0c4cfdc127..b72dceaafbc 100644 --- a/src/emu/cpu/z180/z180.c +++ b/src/emu/cpu/z180/z180.c @@ -743,7 +743,7 @@ typedef struct { #define Z180_IOCR_RMASK 0xff #define Z180_IOCR_WMASK 0xff -int z180_icount; +static int z180_icount; static Z180_Regs Z180; static UINT32 EA; @@ -2294,6 +2294,7 @@ static void z180_set_context (void *src) z180_change_pc(_PCD); } +#ifdef UNUSED_FUNCTION READ8_HANDLER( z180_internal_r ) { return Z180.io[offset & 0x3f]; @@ -2305,6 +2306,7 @@ WRITE8_HANDLER( z180_internal_w ) info.i = data; z180_set_info( CPUINFO_INT_REGISTER + Z180_CNTLA0 + (offset & 0x3f), &info ); } +#endif /**************************************************************************** * Set IRQ line state diff --git a/src/emu/cpu/z8000/z8000.c b/src/emu/cpu/z8000/z8000.c index 1e1cfd2ee7a..d845083aacc 100644 --- a/src/emu/cpu/z8000/z8000.c +++ b/src/emu/cpu/z8000/z8000.c @@ -84,7 +84,7 @@ typedef struct { int (*irq_callback)(int irqline); } z8000_Regs; -int z8000_ICount; +static int z8000_ICount; /* current CPU context */ static z8000_Regs Z; diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index d65b07c216e..803443c175d 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -77,7 +77,7 @@ static UINT64 tempvar[NUM_TEMP_VARIABLES]; FUNCTION PROTOTYPES ***************************************************************************/ -void debug_cpu_exit(running_machine *machine); +static void debug_cpu_exit(running_machine *machine); static void perform_trace(debug_cpu_info *info); static void prepare_for_step_overout(void); static void process_source_file(void); @@ -288,7 +288,7 @@ void debug_cpu_init(running_machine *machine) debug_cpu_exit - free all memory -------------------------------------------------*/ -void debug_cpu_exit(running_machine *machine) +static void debug_cpu_exit(running_machine *machine) { int cpunum, spacenum; diff --git a/src/emu/driver.h b/src/emu/driver.h index 5833b4a1455..797a6ca5895 100644 --- a/src/emu/driver.h +++ b/src/emu/driver.h @@ -283,14 +283,14 @@ struct _game_driver #define MDRV_CPU_REPLACE(tag, _type, _clock) \ cpu = driver_find_cpu(machine, tag); \ - cpu->type = (CPU_##_type); \ - cpu->clock = (_clock); \ + cpu->type = (CPU_##_type); \ + cpu->clock = (_clock); \ /* CPU parameters */ #define MDRV_CPU_FLAGS(_flags) \ if (cpu) \ - cpu->flags = (_flags); \ + cpu->flags = (_flags); \ #define MDRV_CPU_CONFIG(config) \ if (cpu) \ diff --git a/src/emu/emupal.c b/src/emu/emupal.c index 78440c3aa0c..44ace94bba9 100644 --- a/src/emu/emupal.c +++ b/src/emu/emupal.c @@ -59,8 +59,8 @@ struct _palette_private }; -/* typedef struct _colortable colortable; */ -struct _colortable +/* typedef struct _colortable_t colortable_t; */ +struct _colortable_t { running_machine * machine; /* associated machine */ UINT32 entries; /* number of entries */ @@ -365,9 +365,9 @@ void palette_set_shadow_dRGB32(running_machine *machine, int mode, int dr, int d with the given number of entries -------------------------------------------------*/ -colortable *colortable_alloc(running_machine *machine, UINT32 palettesize) +colortable_t *colortable_alloc(running_machine *machine, UINT32 palettesize) { - colortable *ctable; + colortable_t *ctable; UINT32 index; /* allocate the colortable */ @@ -400,7 +400,7 @@ colortable *colortable_alloc(running_machine *machine, UINT32 palettesize) of a colortable entry -------------------------------------------------*/ -void colortable_entry_set_value(colortable *ctable, UINT32 entry, UINT16 value) +void colortable_entry_set_value(colortable_t *ctable, UINT32 entry, UINT16 value) { /* ensure values are within range */ assert(entry < ctable->entries); @@ -420,7 +420,7 @@ void colortable_entry_set_value(colortable *ctable, UINT32 entry, UINT16 value) of a colortable entry -------------------------------------------------*/ -UINT16 colortable_entry_get_value(colortable *ctable, UINT32 entry) +UINT16 colortable_entry_get_value(colortable_t *ctable, UINT32 entry) { assert(entry < ctable->entries); return ctable->raw[entry]; @@ -432,7 +432,7 @@ UINT16 colortable_entry_get_value(colortable *ctable, UINT32 entry) color of a colortable palette entry -------------------------------------------------*/ -void colortable_palette_set_color(colortable *ctable, UINT32 entry, rgb_t color) +void colortable_palette_set_color(colortable_t *ctable, UINT32 entry, rgb_t color) { /* ensure values are within range */ assert(entry < ctable->palentries); @@ -460,7 +460,7 @@ void colortable_palette_set_color(colortable *ctable, UINT32 entry, rgb_t color) of a colortable palette entry -------------------------------------------------*/ -rgb_t colortable_palette_get_color(colortable *ctable, UINT32 entry) +rgb_t colortable_palette_get_color(colortable_t *ctable, UINT32 entry) { assert(entry < ctable->palentries); return ctable->palette[entry]; @@ -473,7 +473,7 @@ rgb_t colortable_palette_get_color(colortable *ctable, UINT32 entry) color -------------------------------------------------*/ -UINT32 colortable_get_transpen_mask(colortable *ctable, const gfx_element *gfx, int color, int transcolor) +UINT32 colortable_get_transpen_mask(colortable_t *ctable, const gfx_element *gfx, int color, int transcolor) { UINT32 entry = gfx->color_base + (color % gfx->total_colors) * gfx->color_granularity; UINT32 mask = 0; @@ -503,7 +503,7 @@ UINT32 colortable_get_transpen_mask(colortable *ctable, const gfx_element *gfx, (each group maps to a gfx color) -------------------------------------------------*/ -void colortable_configure_tilemap_groups(colortable *ctable, tilemap *tmap, const gfx_element *gfx, int transcolor) +void colortable_configure_tilemap_groups(colortable_t *ctable, tilemap *tmap, const gfx_element *gfx, int transcolor) { int color; diff --git a/src/emu/emupal.h b/src/emu/emupal.h index 8e6a58b7fa4..3523341466d 100644 --- a/src/emu/emupal.h +++ b/src/emu/emupal.h @@ -112,7 +112,7 @@ TYPE DEFINITIONS ***************************************************************************/ -typedef struct _colortable colortable; +typedef struct _colortable_t colortable_t; @@ -154,25 +154,25 @@ void palette_set_shadow_dRGB32(running_machine *machine, int mode, int dr, int d /* ----- colortable management ----- */ /* allocate a new colortable with the given number of entries */ -colortable *colortable_alloc(running_machine *machine, UINT32 palettesize); +colortable_t *colortable_alloc(running_machine *machine, UINT32 palettesize); /* set the value of a colortable entry */ -void colortable_entry_set_value(colortable *ctable, UINT32 entry, UINT16 value); +void colortable_entry_set_value(colortable_t *ctable, UINT32 entry, UINT16 value); /* return the value of a colortable entry */ -UINT16 colortable_entry_get_value(colortable *ctable, UINT32 entry); +UINT16 colortable_entry_get_value(colortable_t *ctable, UINT32 entry); /* change the color of a colortable palette entry */ -void colortable_palette_set_color(colortable *ctable, UINT32 entry, rgb_t color); +void colortable_palette_set_color(colortable_t *ctable, UINT32 entry, rgb_t color); /* return the color of a colortable palette entry */ -rgb_t colortable_palette_get_color(colortable *ctable, UINT32 entry); +rgb_t colortable_palette_get_color(colortable_t *ctable, UINT32 entry); /* return a 32-bit transparency mask for a given gfx element and color */ -UINT32 colortable_get_transpen_mask(colortable *ctable, const gfx_element *gfx, int color, int transcolor); +UINT32 colortable_get_transpen_mask(colortable_t *ctable, const gfx_element *gfx, int color, int transcolor); /* configure groups in a tilemap to represent transparency based on colortable entries (each group maps to a gfx color) */ -void colortable_configure_tilemap_groups(colortable *ctable, tilemap *tmap, const gfx_element *gfx, int transcolor); +void colortable_configure_tilemap_groups(colortable_t *ctable, tilemap *tmap, const gfx_element *gfx, int transcolor); diff --git a/src/emu/machine/tmp68301.c b/src/emu/machine/tmp68301.c index f8bbb01f2d9..e00a6e30bdb 100644 --- a/src/emu/machine/tmp68301.c +++ b/src/emu/machine/tmp68301.c @@ -61,7 +61,7 @@ static TIMER_CALLBACK( tmp68301_timer_callback ) } } -void tmp68301_update_timer( int i ) +static void tmp68301_update_timer( int i ) { UINT16 TCR = tmp68301_regs[(0x200 + i * 0x20)/2]; UINT16 MAX1 = tmp68301_regs[(0x204 + i * 0x20)/2]; diff --git a/src/emu/mame.c b/src/emu/mame.c index bed4dd9ba96..bc50082303a 100644 --- a/src/emu/mame.c +++ b/src/emu/mame.c @@ -1073,6 +1073,7 @@ void mame_printf_debug(const char *format, ...) appropriate callback -------------------------------------------------*/ +#ifdef UNUSED_FUNCTION void mame_printf_log(const char *format, ...) { va_list argptr; @@ -1089,6 +1090,7 @@ void mame_printf_log(const char *format, ...) (*output_cb[OUTPUT_CHANNEL_LOG])(output_cb_param[OUTPUT_CHANNEL_LOG], format, argptr); va_end(argptr); } +#endif diff --git a/src/emu/mame.h b/src/emu/mame.h index 940c3fd4fb5..63a2edf9981 100644 --- a/src/emu/mame.h +++ b/src/emu/mame.h @@ -186,6 +186,7 @@ struct _running_machine /* fix me - some games try to modify remapped_colortable directly */ /* search for "palette hack" to find instances */ const pen_t * pens; /* remapped palette pen numbers */ + struct _colortable_t * colortable; /* global colortable for remapping */ const UINT16 * game_colortable; /* lookup table used to map gfx pen numbers to color numbers */ const pen_t * remapped_colortable;/* the above, already remapped through Machine->pens */ pen_t * shadow_table; /* table for looking up a shadowed pen */ diff --git a/src/emu/sndintrf.c b/src/emu/sndintrf.c index 9d6c8bf6bcb..52f426c64a6 100644 --- a/src/emu/sndintrf.c +++ b/src/emu/sndintrf.c @@ -67,7 +67,7 @@ struct _sndintrf_data EXTERNAL PROTOTYPES ***************************************************************************/ -void dummy_sound_get_info(void *token, UINT32 state, sndinfo *info); +static void dummy_sound_get_info(void *token, UINT32 state, sndinfo *info); void custom_get_info(void *token, UINT32 state, sndinfo *info); void samples_get_info(void *token, UINT32 state, sndinfo *info); void dac_get_info(void *token, UINT32 state, sndinfo *info); @@ -945,7 +945,7 @@ static void dummy_sound_set_info(void *token, UINT32 state, sndinfo *info) } -void dummy_sound_get_info(void *token, UINT32 state, sndinfo *info) +static void dummy_sound_get_info(void *token, UINT32 state, sndinfo *info) { switch (state) { diff --git a/src/emu/sound/3812intf.h b/src/emu/sound/3812intf.h index d4ffce65ca4..f1692859ab3 100644 --- a/src/emu/sound/3812intf.h +++ b/src/emu/sound/3812intf.h @@ -25,20 +25,24 @@ struct Y8950interface /* YM3812 */ READ8_HANDLER ( YM3812_status_port_0_r ); WRITE8_HANDLER( YM3812_control_port_0_w ); +READ8_HANDLER( YM3812_read_port_0_r ); WRITE8_HANDLER( YM3812_write_port_0_w ); READ8_HANDLER ( YM3812_status_port_1_r ); WRITE8_HANDLER( YM3812_control_port_1_w ); +READ8_HANDLER( YM3812_read_port_1_r ); WRITE8_HANDLER( YM3812_write_port_1_w ); /* YM3526 */ READ8_HANDLER ( YM3526_status_port_0_r ); WRITE8_HANDLER( YM3526_control_port_0_w ); +READ8_HANDLER( YM3526_read_port_0_r ); WRITE8_HANDLER( YM3526_write_port_0_w ); READ8_HANDLER ( YM3526_status_port_1_r ); WRITE8_HANDLER( YM3526_control_port_1_w ); +READ8_HANDLER( YM3526_read_port_1_r ); WRITE8_HANDLER( YM3526_write_port_1_w ); diff --git a/src/emu/sound/astrocde.c b/src/emu/sound/astrocde.c index 88457451453..cd4e32861ce 100644 --- a/src/emu/sound/astrocde.c +++ b/src/emu/sound/astrocde.c @@ -287,7 +287,7 @@ static void *astrocade_start(int sndindex, int clock, const void *config) * *************************************/ -void astrocade_sound_w(UINT8 num, offs_t offset, UINT8 data) +static void astrocade_sound_w(UINT8 num, offs_t offset, UINT8 data) { struct astrocade_info *chip = sndti_token(SOUND_ASTROCADE, num); diff --git a/src/emu/sound/ics2115.c b/src/emu/sound/ics2115.c index d81cb4994b9..aee2e9c20bf 100644 --- a/src/emu/sound/ics2115.c +++ b/src/emu/sound/ics2115.c @@ -526,7 +526,7 @@ WRITE8_HANDLER( ics2115_w ) // if (ICS2115LOGERROR) logerror("ICS2115: wi %d, %02x (%04x)\n", offset, data, caller_get_pc()); } -void ics2115_reset(void *_chip) +static void ics2115_reset(void *_chip) { struct ics2115 *chip = _chip; chip->irq_en = 0; diff --git a/src/emu/sound/iremga20.c b/src/emu/sound/iremga20.c index 981e0668b8f..768882226fa 100644 --- a/src/emu/sound/iremga20.c +++ b/src/emu/sound/iremga20.c @@ -56,7 +56,7 @@ struct IremGA20_chip_def struct IremGA20_channel_def channel[4]; }; -void IremGA20_update( void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length ) +static void IremGA20_update( void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length ) { struct IremGA20_chip_def *chip = param; UINT32 rate[4], pos[4], frac[4], end[4], vol[4], play[4]; diff --git a/src/emu/sound/k053260.c b/src/emu/sound/k053260.c index 82179687dcb..6ab7691314a 100644 --- a/src/emu/sound/k053260.c +++ b/src/emu/sound/k053260.c @@ -94,7 +94,7 @@ INLINE int limit( int val, int max, int min ) { #define MAXOUT 0x7fff #define MINOUT -0x8000 -void K053260_update( void * param, stream_sample_t **inputs, stream_sample_t **buffer, int length ) { +static void K053260_update( void * param, stream_sample_t **inputs, stream_sample_t **buffer, int length ) { static long dpcmcnv[] = { 0,1,2,4,8,16,32,64, -128, -64, -32, -16, -8, -4, -2, -1}; int i, j, lvol[4], rvol[4], play[4], loop[4], ppcm_data[4], ppcm[4]; @@ -250,7 +250,7 @@ INLINE void check_bounds( struct K053260_chip_def *ic, int channel ) { #endif } -void K053260_write( int chip, offs_t offset, UINT8 data ) +static void K053260_write( int chip, offs_t offset, UINT8 data ) { int i, t; int r = offset; @@ -367,7 +367,7 @@ void K053260_write( int chip, offs_t offset, UINT8 data ) } } -UINT8 K053260_read( int chip, offs_t offset ) +static UINT8 K053260_read( int chip, offs_t offset ) { struct K053260_chip_def *ic = sndti_token(SOUND_K053260, chip); diff --git a/src/emu/sound/msm5232.c b/src/emu/sound/msm5232.c index b51947e14b0..0853d38acb2 100644 --- a/src/emu/sound/msm5232.c +++ b/src/emu/sound/msm5232.c @@ -665,7 +665,7 @@ INLINE void TG_group_advance(MSM5232 *chip, int groupidx) #endif -void MSM5232_update_one(void *param, stream_sample_t **inputs, stream_sample_t** buffer, int samples) +static void MSM5232_update_one(void *param, stream_sample_t **inputs, stream_sample_t** buffer, int samples) { MSM5232 * chip = param; stream_sample_t *buf1 = buffer[0]; diff --git a/src/emu/sound/nes_apu.c b/src/emu/sound/nes_apu.c index 21c5768abe5..1e5e431d15a 100644 --- a/src/emu/sound/nes_apu.c +++ b/src/emu/sound/nes_apu.c @@ -657,7 +657,7 @@ WRITE8_HANDLER( NESPSG_0_w ) {apu_write(0,offset,data);} WRITE8_HANDLER( NESPSG_1_w ) {apu_write(1,offset,data);} /* UPDATE APU SYSTEM */ -void NESPSG_update_sound(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length) +static void NESPSG_update_sound(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length) { struct nesapu_info *info = param; apu_update(info, buffer[0], length); diff --git a/src/emu/sound/pokey.c b/src/emu/sound/pokey.c index fcb1b097aaf..4d01cbcdfc7 100644 --- a/src/emu/sound/pokey.c +++ b/src/emu/sound/pokey.c @@ -551,7 +551,7 @@ static TIMER_CALLBACK_PTR( pokey_pot_trigger_7 ); #endif -void pokey_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length) +static void pokey_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length) { struct POKEYregisters *chip = param; stream_sample_t *buffer = _buffer[0]; @@ -1037,7 +1037,7 @@ READ8_HANDLER( quad_pokey_r ) } -void pokey_register_w(int chip, int offs, int data) +static void pokey_register_w(int chip, int offs, int data) { struct POKEYregisters *p = sndti_token(SOUND_POKEY, chip); int ch_mask = 0, new_val; @@ -1473,7 +1473,7 @@ void pokey4_serin_ready(int after) timer_set_ptr(attotime_mul(p->clock_period, after), p, pokey_serin_ready); } -void pokey_break_w(int chip, int shift) +static void pokey_break_w(int chip, int shift) { struct POKEYregisters *p = sndti_token(SOUND_POKEY, chip); if( shift ) /* shift code ? */ @@ -1510,7 +1510,7 @@ void pokey4_break_w(int shift) pokey_break_w(3, shift); } -void pokey_kbcode_w(int chip, int kbcode, int make) +static void pokey_kbcode_w(int chip, int kbcode, int make) { struct POKEYregisters *p = sndti_token(SOUND_POKEY, chip); /* make code ? */ diff --git a/src/emu/sound/qsound.c b/src/emu/sound/qsound.c index 1eabe0759b0..b95181ba827 100644 --- a/src/emu/sound/qsound.c +++ b/src/emu/sound/qsound.c @@ -91,8 +91,8 @@ struct qsound_info }; /* Function prototypes */ -void qsound_update( void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length ); -void qsound_set_command(struct qsound_info *chip, int data, int value); +static void qsound_update( void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length ); +static void qsound_set_command(struct qsound_info *chip, int data, int value); static void *qsound_start(int sndindex, int clock, const void *config) { @@ -198,7 +198,7 @@ READ8_HANDLER( qsound_status_r ) return 0x80; } -void qsound_set_command(struct qsound_info *chip, int data, int value) +static void qsound_set_command(struct qsound_info *chip, int data, int value) { int ch=0,reg=0; if (data < 0x80) @@ -313,7 +313,7 @@ void qsound_set_command(struct qsound_info *chip, int data, int value) } -void qsound_update( void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length ) +static void qsound_update( void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length ) { struct qsound_info *chip = param; int i,j; diff --git a/src/emu/sound/s14001a.c b/src/emu/sound/s14001a.c index 051b12489aa..306b537db8d 100644 --- a/src/emu/sound/s14001a.c +++ b/src/emu/sound/s14001a.c @@ -289,7 +289,7 @@ static void PostPhoneme(S14001AChip *chip) /* figure out what the heck to do aft #endif } -void s14001a_clock(S14001AChip *chip) /* called once per clock */ +static void s14001a_clock(S14001AChip *chip) /* called once per clock */ { UINT8 CurDelta; // Current delta diff --git a/src/emu/sound/scsp.c b/src/emu/sound/scsp.c index 357d7c3bb84..78b788838c4 100644 --- a/src/emu/sound/scsp.c +++ b/src/emu/sound/scsp.c @@ -1370,11 +1370,13 @@ static void dma_scsp(struct _SCSP *SCSP) cpunum_set_input_line(2,dma_transfer_end,HOLD_LINE); } +#ifdef UNUSED_FUNCTION int SCSP_IRQCB(void *param) { CheckPendingIRQ(param); return -1; } +#endif static void SCSP_Update(void *param, stream_sample_t **inputs, stream_sample_t **buf, int samples) { diff --git a/src/emu/sound/tms36xx.c b/src/emu/sound/tms36xx.c index bd0d1d68bf6..911e929e08b 100644 --- a/src/emu/sound/tms36xx.c +++ b/src/emu/sound/tms36xx.c @@ -447,7 +447,7 @@ void tms36xx_note_w(int chip, int octave, int note) tms->tune_max = note + 1; } -void tms3617_enable(struct TMS36XX *tms, int enable) +static void tms3617_enable(struct TMS36XX *tms, int enable) { int i, bits = 0; diff --git a/src/emu/sound/ymz280b.c b/src/emu/sound/ymz280b.c index e9df9742413..e27edd8ca4e 100644 --- a/src/emu/sound/ymz280b.c +++ b/src/emu/sound/ymz280b.c @@ -707,6 +707,7 @@ static void *ymz280b_start(int sndindex, int clock, const void *config) ***********************************************************************************************/ +#ifdef UNUSED_FUNCTION void YMZ280B_sh_stop(void) { #if MAKE_WAVS @@ -721,6 +722,7 @@ void YMZ280B_sh_stop(void) } #endif } +#endif diff --git a/src/emu/uimenu.c b/src/emu/uimenu.c index f058e6dda59..b33f3e6eecd 100644 --- a/src/emu/uimenu.c +++ b/src/emu/uimenu.c @@ -531,7 +531,7 @@ int ui_menu_draw(const ui_menu_item *items, int numitems, int selected, const me bottom -------------------------------------------------*/ -void ui_menu_draw_text_box(const char *text) +static void ui_menu_draw_text_box(const char *text) { const char *priortext = ui_getstring(UI_returntoprior); float line_height = ui_get_line_height(); diff --git a/src/emu/uitext.c b/src/emu/uitext.c index e3fa967cf69..62e4b9abe7b 100644 --- a/src/emu/uitext.c +++ b/src/emu/uitext.c @@ -18,7 +18,7 @@ extern const char *mess_default_text[]; #endif /* MESS */ -lang_struct lang; +static lang_struct lang; /* All entries in this table must match the enum ordering in "uitext.h" */ static const char *mame_default_text[] = diff --git a/src/emu/validity.c b/src/emu/validity.c index 6bfaf303c31..faa37b60768 100644 --- a/src/emu/validity.c +++ b/src/emu/validity.c @@ -216,15 +216,15 @@ static void build_quarks(void) static int validate_inlines(void) { #undef rand - UINT64 testu64a = rand() + (rand() << 15) + ((UINT64)rand() << 30) + ((UINT64)rand() << 45) + 1; - INT64 testi64a = rand() + (rand() << 15) + ((INT64)rand() << 30) + ((INT64)rand() << 45) + 1; + volatile UINT64 testu64a = rand() ^ (rand() << 15) ^ ((UINT64)rand() << 30) ^ ((UINT64)rand() << 45); + volatile INT64 testi64a = rand() ^ (rand() << 15) ^ ((INT64)rand() << 30) ^ ((INT64)rand() << 45); #ifdef PTR64 - INT64 testi64b = rand() + (rand() << 15) + ((INT64)rand() << 30) + ((INT64)rand() << 45) + 1; + volatile INT64 testi64b = rand() ^ (rand() << 15) ^ ((INT64)rand() << 30) ^ ((INT64)rand() << 45); #endif - UINT32 testu32a = rand() + (rand() << 15) + 1; - UINT32 testu32b = rand() + (rand() << 15) + 1; - INT32 testi32a = rand() + (rand() << 15) + 1; - INT32 testi32b = rand() + (rand() << 15) + 1; + volatile UINT32 testu32a = rand() ^ (rand() << 15); + volatile UINT32 testu32b = rand() ^ (rand() << 15); + volatile INT32 testi32a = rand() ^ (rand() << 15); + volatile INT32 testi32b = rand() ^ (rand() << 15); INT32 resulti32, expectedi32; UINT32 resultu32, expectedu32; INT64 resulti64, expectedi64; @@ -233,6 +233,21 @@ static int validate_inlines(void) UINT32 uremainder, expuremainder; int error = FALSE; + /* use only non-zero, positive numbers */ + if (testu64a == 0) testu64a++; + if (testi64a == 0) testi64a++; + else if (testi64a < 0) testi64a = -testi64a; +#ifdef PTR64 + if (testi64b == 0) testi64b++; + else if (testi64b < 0) testi64b = -testi64b; +#endif + if (testu32a == 0) testu32a++; + if (testu32b == 0) testu32b++; + if (testi32a == 0) testi32a++; + else if (testi32a < 0) testi32a = -testi32a; + if (testi32b == 0) testi32b++; + else if (testi32b < 0) testi32b = -testi32b; + resulti64 = mul_32x32(testi32a, testi32b); expectedi64 = (INT64)testi32a * (INT64)testi32b; if (resulti64 != expectedi64) |