diff options
author | 2007-12-17 16:33:33 +0000 | |
---|---|---|
committer | 2007-12-17 16:33:33 +0000 | |
commit | 8a8ccc594989d85f2277c48d3c158f7cee41d06b (patch) | |
tree | 821ddcb66109a2340909394308a4b348d4cb2a53 | |
parent | 7b77f1218624ea26dbb2efd85a19f795f5d4e02e (diff) |
Changes for MAME 0.121u1.mame0121u1
148 files changed, 4809 insertions, 2862 deletions
diff --git a/.gitattributes b/.gitattributes index 5e53ffb10d2..db3dd15a020 100644 --- a/.gitattributes +++ b/.gitattributes @@ -72,6 +72,7 @@ src/emu/cpu/dsp56k/dsp56ops.c svneol=native#text/plain src/emu/cpu/e132xs/32xsdasm.c svneol=native#text/plain src/emu/cpu/e132xs/e132xs.c svneol=native#text/plain src/emu/cpu/e132xs/e132xs.h svneol=native#text/plain +src/emu/cpu/e132xs/e132xsop.c svneol=native#text/plain src/emu/cpu/f8/f3853.c svneol=native#text/plain src/emu/cpu/f8/f3853.h svneol=native#text/plain src/emu/cpu/f8/f8.c svneol=native#text/plain @@ -3257,6 +3258,8 @@ src/osd/windows/drawd3d.c svneol=native#text/plain src/osd/windows/drawdd.c svneol=native#text/plain src/osd/windows/drawgdi.c svneol=native#text/plain src/osd/windows/drawnone.c svneol=native#text/plain +src/osd/windows/eivc.h svneol=native#text/plain +src/osd/windows/eivcx86.h svneol=native#text/plain src/osd/windows/input.c svneol=native#text/plain src/osd/windows/input.h svneol=native#text/plain src/osd/windows/ledutil.c svneol=native#text/plain @@ -91,10 +91,11 @@ X86_PPC_DRC = 1 # uncomment one of the next lines to build a target-optimized build # NATIVE = 1 # ATHLON = 1 +# AMD64 = 1 # I686 = 1 # P4 = 1 # PM = 1 -# AMD64 = 1 +# CORE2 = 1 # G4 = 1 # G5 = 1 # CELL = 1 @@ -198,6 +199,11 @@ SUFFIX = at ARCH = -march=athlon endif +ifdef AMD64 +SUFFIX = 64 +ARCH = -march=athlon64 +endif + ifdef I686 SUFFIX = pp ARCH = -march=pentiumpro @@ -208,14 +214,14 @@ SUFFIX = p4 ARCH = -march=pentium4 endif -ifdef AMD64 -SUFFIX = 64 -ARCH = -march=athlon64 -endif - ifdef PM SUFFIX = pm -ARCH = -march=pentium3 -msse2 +ARCH = -march=pentium-m +endif + +ifdef CORE2 +SUFFIX = c2 +ARCH = -march=pentium-m -msse3 endif ifdef G4 @@ -237,6 +243,7 @@ ENDIAN = big endif + #------------------------------------------------- # form the name of the executable #------------------------------------------------- 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) diff --git a/src/lib/util/chd.c b/src/lib/util/chd.c index b36bd5c70fe..813ad8c31fe 100644 --- a/src/lib/util/chd.c +++ b/src/lib/util/chd.c @@ -835,6 +835,7 @@ core_file *chd_core_file(chd_file *chd) filename -------------------------------------------------*/ +#ifdef UNUSED_FUNCTION void chd_multi_filename(const char *origname, char *finalname, int index) { char *extension; @@ -856,6 +857,7 @@ void chd_multi_filename(const char *origname, char *finalname, int index) findex[2] = 'h'; strcpy(extension, findex); } +#endif diff --git a/src/mame/drivers/acefruit.c b/src/mame/drivers/acefruit.c index 276dae9ddbb..7433977e0e9 100644 --- a/src/mame/drivers/acefruit.c +++ b/src/mame/drivers/acefruit.c @@ -240,29 +240,15 @@ static PALETTE_INIT( acefruit ) palette_set_color( machine, 6, MAKE_RGB(0xff, 0xff, 0xff) ); palette_set_color( machine, 7, MAKE_RGB(0x7f, 0x3f, 0x1f) ); - colortable[ 0 ] = 0; - colortable[ 1 ] = 1; - colortable[ 2 ] = 2; - colortable[ 3 ] = 3; - colortable[ 4 ] = 4; - colortable[ 5 ] = 5; - colortable[ 6 ] = 6; - colortable[ 7 ] = 7; - /* tiles */ - palette_set_color( machine, 8, MAKE_RGB(0xff, 0xff, 0xff) ); - palette_set_color( machine, 9, MAKE_RGB(0x00, 0x00, 0xff) ); - palette_set_color( machine, 10, MAKE_RGB(0x00, 0xff, 0x00) ); - palette_set_color( machine, 11, MAKE_RGB(0xff, 0x00, 0x00) ); - - colortable[ 8 ] = 0; - colortable[ 9 ] = 8; - colortable[ 10 ] = 0; - colortable[ 11 ] = 9; - colortable[ 12 ] = 0; - colortable[ 13 ] = 10; - colortable[ 14 ] = 0; - colortable[ 15 ] = 11; + palette_set_color( machine, 8, MAKE_RGB(0x00, 0x00, 0x00) ); + palette_set_color( machine, 9, MAKE_RGB(0xff, 0xff, 0xff) ); + palette_set_color( machine, 10, MAKE_RGB(0x00, 0x00, 0x00) ); + palette_set_color( machine, 11, MAKE_RGB(0x00, 0x00, 0xff) ); + palette_set_color( machine, 12, MAKE_RGB(0x00, 0x00, 0x00) ); + palette_set_color( machine, 13, MAKE_RGB(0x00, 0xff, 0x00) ); + palette_set_color( machine, 14, MAKE_RGB(0x00, 0x00, 0x00) ); + palette_set_color( machine, 15, MAKE_RGB(0xff, 0x00, 0x00) ); } static ADDRESS_MAP_START( acefruit_map, ADDRESS_SPACE_PROGRAM, 8 ) @@ -573,8 +559,7 @@ static MACHINE_DRIVER_START( acefruit ) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MDRV_SCREEN_SIZE(512, 256) MDRV_SCREEN_VISIBLE_AREA(0, 511, 0, 255) - MDRV_PALETTE_LENGTH(12) - MDRV_COLORTABLE_LENGTH(16) + MDRV_PALETTE_LENGTH(16) MDRV_NVRAM_HANDLER(generic_0fill) diff --git a/src/mame/drivers/atarifb.c b/src/mame/drivers/atarifb.c index 99ccff9bb09..bdb7b0837b5 100644 --- a/src/mame/drivers/atarifb.c +++ b/src/mame/drivers/atarifb.c @@ -121,23 +121,25 @@ int atarifb_game; * *************************************/ -static const UINT16 colortable_source[] = -{ - 0x02, 0x00, /* chars */ - 0x03, 0x02, /* sprites */ - 0x03, 0x00, - 0x03, 0x01, /* sprite masks */ - 0x03, 0x00, - 0x03, 0x02, -}; - static PALETTE_INIT( atarifb ) { - palette_set_color(machine,0,MAKE_RGB(0x00,0x00,0x00)); /* black */ - palette_set_color(machine,1,MAKE_RGB(0x80,0x80,0x80)); /* grey */ - palette_set_color(machine,2,MAKE_RGB(0xff,0xff,0xff)); /* white */ - palette_set_color(machine,3,MAKE_RGB(0x40,0x40,0x40)); /* dark grey (?) - used in Soccer only */ - memcpy(colortable,colortable_source,sizeof(colortable_source)); + /* chars */ + palette_set_color(machine,0,MAKE_RGB(0xff,0xff,0xff)); /* white */ + palette_set_color(machine,1,MAKE_RGB(0x00,0x00,0x00)); /* black */ + + /* sprites */ + palette_set_color(machine,2,MAKE_RGB(0x40,0x40,0x40)); /* dark grey (?) - used in Soccer only */ + palette_set_color(machine,3,MAKE_RGB(0xff,0xff,0xff)); /* white */ + palette_set_color(machine,4,MAKE_RGB(0x40,0x40,0x40)); /* dark grey (?) - used in Soccer only */ + palette_set_color(machine,5,MAKE_RGB(0x00,0x00,0x00)); /* black */ + + /* sprite masks */ + palette_set_color(machine,6,MAKE_RGB(0x40,0x40,0x40)); /* dark grey (?) - used in Soccer only */ + palette_set_color(machine,7,MAKE_RGB(0x80,0x80,0x80)); /* grey */ + palette_set_color(machine,8,MAKE_RGB(0x40,0x40,0x40)); /* dark grey (?) - used in Soccer only */ + palette_set_color(machine,9,MAKE_RGB(0x00,0x00,0x00)); /* black */ + palette_set_color(machine,10,MAKE_RGB(0x40,0x40,0x40)); /* dark grey (?) - used in Soccer only */ + palette_set_color(machine,11,MAKE_RGB(0xff,0xff,0xff)); /* white */ } @@ -538,8 +540,7 @@ static MACHINE_DRIVER_START( atarifb ) MDRV_SCREEN_SIZE(38*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(0*8, 38*8-1, 1*8, 31*8-1) MDRV_GFXDECODE(atarifb) - MDRV_PALETTE_LENGTH(4) - MDRV_COLORTABLE_LENGTH(sizeof(colortable_source) / sizeof(colortable_source[0])) + MDRV_PALETTE_LENGTH(12) MDRV_PALETTE_INIT(atarifb) MDRV_VIDEO_START(generic) diff --git a/src/mame/drivers/boxer.c b/src/mame/drivers/boxer.c index eca21a26d72..050b8044307 100644 --- a/src/mame/drivers/boxer.c +++ b/src/mame/drivers/boxer.c @@ -80,10 +80,8 @@ static PALETTE_INIT( boxer ) palette_set_color(machine,0, MAKE_RGB(0x00,0x00,0x00)); palette_set_color(machine,1, MAKE_RGB(0xff,0xff,0xff)); - colortable[0] = 0; - colortable[1] = 1; - colortable[2] = 1; - colortable[3] = 0; + palette_set_color(machine,2, MAKE_RGB(0xff,0xff,0xff)); + palette_set_color(machine,3, MAKE_RGB(0x00,0x00,0x00)); } @@ -314,8 +312,7 @@ static MACHINE_DRIVER_START(boxer) MDRV_SCREEN_SIZE(256, 262) MDRV_SCREEN_VISIBLE_AREA(8, 247, 0, 239) MDRV_GFXDECODE(boxer) - MDRV_PALETTE_LENGTH(2) - MDRV_COLORTABLE_LENGTH(4) + MDRV_PALETTE_LENGTH(4) MDRV_PALETTE_INIT(boxer) MDRV_VIDEO_UPDATE(boxer) diff --git a/src/mame/drivers/bsktball.c b/src/mame/drivers/bsktball.c index e8b5d3e75ec..6fd011d3006 100644 --- a/src/mame/drivers/bsktball.c +++ b/src/mame/drivers/bsktball.c @@ -32,101 +32,34 @@ * *************************************/ -static UINT16 colortable_source[] = -{ - /* Playfield */ - 0x01, 0x00, 0x00, 0x00, - 0x01, 0x03, 0x03, 0x03, - - /* Motion */ - 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x01, 0x00, - 0x01, 0x00, 0x02, 0x00, - 0x01, 0x00, 0x03, 0x00, - - 0x01, 0x01, 0x00, 0x00, - 0x01, 0x01, 0x01, 0x00, - 0x01, 0x01, 0x02, 0x00, - 0x01, 0x01, 0x03, 0x00, - - 0x01, 0x02, 0x00, 0x00, - 0x01, 0x02, 0x01, 0x00, - 0x01, 0x02, 0x02, 0x00, - 0x01, 0x02, 0x03, 0x00, - - 0x01, 0x03, 0x00, 0x00, - 0x01, 0x03, 0x01, 0x00, - 0x01, 0x03, 0x02, 0x00, - 0x01, 0x03, 0x03, 0x00, - - 0x01, 0x00, 0x00, 0x01, - 0x01, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x02, 0x01, - 0x01, 0x00, 0x03, 0x01, - - 0x01, 0x01, 0x00, 0x01, - 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x02, 0x01, - 0x01, 0x01, 0x03, 0x01, - - 0x01, 0x02, 0x00, 0x01, - 0x01, 0x02, 0x01, 0x01, - 0x01, 0x02, 0x02, 0x01, - 0x01, 0x02, 0x03, 0x01, - - 0x01, 0x03, 0x00, 0x01, - 0x01, 0x03, 0x01, 0x01, - 0x01, 0x03, 0x02, 0x01, - 0x01, 0x03, 0x03, 0x01, - - 0x01, 0x00, 0x00, 0x02, - 0x01, 0x00, 0x01, 0x02, - 0x01, 0x00, 0x02, 0x02, - 0x01, 0x00, 0x03, 0x02, - - 0x01, 0x01, 0x00, 0x02, - 0x01, 0x01, 0x01, 0x02, - 0x01, 0x01, 0x02, 0x02, - 0x01, 0x01, 0x03, 0x02, - - 0x01, 0x02, 0x00, 0x02, - 0x01, 0x02, 0x01, 0x02, - 0x01, 0x02, 0x02, 0x02, - 0x01, 0x02, 0x03, 0x02, - - 0x01, 0x03, 0x00, 0x02, - 0x01, 0x03, 0x01, 0x02, - 0x01, 0x03, 0x02, 0x02, - 0x01, 0x03, 0x03, 0x02, - - 0x01, 0x00, 0x00, 0x03, - 0x01, 0x00, 0x01, 0x03, - 0x01, 0x00, 0x02, 0x03, - 0x01, 0x00, 0x03, 0x03, - - 0x01, 0x01, 0x00, 0x03, - 0x01, 0x01, 0x01, 0x03, - 0x01, 0x01, 0x02, 0x03, - 0x01, 0x01, 0x03, 0x03, - - 0x01, 0x02, 0x00, 0x03, - 0x01, 0x02, 0x01, 0x03, - 0x01, 0x02, 0x02, 0x03, - 0x01, 0x02, 0x03, 0x03, - - 0x01, 0x03, 0x00, 0x03, - 0x01, 0x03, 0x01, 0x03, - 0x01, 0x03, 0x02, 0x03, - 0x01, 0x03, 0x03, 0x03, -}; - static PALETTE_INIT( bsktball ) { - palette_set_color(machine,0,MAKE_RGB(0x00,0x00,0x00)); /* BLACK */ - palette_set_color(machine,1,MAKE_RGB(0x80,0x80,0x80)); /* LIGHT GREY */ - palette_set_color(machine,2,MAKE_RGB(0x50,0x50,0x50)); /* DARK GREY */ - palette_set_color(machine,3,MAKE_RGB(0xff,0xff,0xff)); /* WHITE */ - memcpy(colortable,colortable_source,sizeof(colortable_source)); + int i; + + machine->colortable = colortable_alloc(machine, 4); + + colortable_palette_set_color(machine->colortable,0,MAKE_RGB(0x00,0x00,0x00)); /* BLACK */ + colortable_palette_set_color(machine->colortable,1,MAKE_RGB(0x80,0x80,0x80)); /* LIGHT GREY */ + colortable_palette_set_color(machine->colortable,2,MAKE_RGB(0x50,0x50,0x50)); /* DARK GREY */ + colortable_palette_set_color(machine->colortable,3,MAKE_RGB(0xff,0xff,0xff)); /* WHITE */ + + /* playfield */ + for (i = 0; i < 2; i++) + { + colortable_entry_set_value(machine->colortable, i*4 + 0, 1); + colortable_entry_set_value(machine->colortable, i*4 + 1, 3 * i); + colortable_entry_set_value(machine->colortable, i*4 + 2, 3 * i); + colortable_entry_set_value(machine->colortable, i*4 + 3, 3 * i); + } + + /* motion */ + for (i = 0; i < 4*4*4; i++) + { + colortable_entry_set_value(machine->colortable, 2*4 + i*4 + 0, 1); + colortable_entry_set_value(machine->colortable, 2*4 + i*4 + 1, (i >> 2) & 3); + colortable_entry_set_value(machine->colortable, 2*4 + i*4 + 2, (i >> 0) & 3); + colortable_entry_set_value(machine->colortable, 2*4 + i*4 + 3, (i >> 4) & 3); + } } @@ -288,8 +221,7 @@ static MACHINE_DRIVER_START( bsktball ) MDRV_SCREEN_SIZE(32*8, 28*8) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1) MDRV_GFXDECODE(bsktball) - MDRV_PALETTE_LENGTH(4) - MDRV_COLORTABLE_LENGTH(sizeof(colortable_source) / sizeof(colortable_source[0])) + MDRV_PALETTE_LENGTH(2*4 + 4*4*4*4) MDRV_PALETTE_INIT(bsktball) MDRV_VIDEO_START(bsktball) diff --git a/src/mame/drivers/canyon.c b/src/mame/drivers/canyon.c index 830a4f50926..62d76ed33a2 100644 --- a/src/mame/drivers/canyon.c +++ b/src/mame/drivers/canyon.c @@ -47,14 +47,10 @@ static PALETTE_INIT( canyon ) { - palette_set_color(machine, 0, MAKE_RGB(0x00, 0x00, 0x00)); /* BLACK */ - palette_set_color(machine, 1, MAKE_RGB(0xff, 0xff, 0xff)); /* WHITE */ + palette_set_color(machine, 0, MAKE_RGB(0x80, 0x80, 0x80)); /* GREY */ + palette_set_color(machine, 1, MAKE_RGB(0x00, 0x00, 0x00)); /* BLACK */ palette_set_color(machine, 2, MAKE_RGB(0x80, 0x80, 0x80)); /* GREY */ - - colortable[0] = 2; - colortable[1] = 0; - colortable[2] = 2; - colortable[3] = 1; + palette_set_color(machine, 3, MAKE_RGB(0xff, 0xff, 0xff)); /* WHITE */ } @@ -253,8 +249,7 @@ static MACHINE_DRIVER_START( canyon ) MDRV_SCREEN_SIZE(256, 240) MDRV_SCREEN_VISIBLE_AREA(0, 255, 0, 239) MDRV_GFXDECODE(canyon) - MDRV_PALETTE_LENGTH(3) - MDRV_COLORTABLE_LENGTH(4) + MDRV_PALETTE_LENGTH(4) MDRV_PALETTE_INIT(canyon) MDRV_VIDEO_START(canyon) diff --git a/src/mame/drivers/cherrym.c b/src/mame/drivers/cherrym.c index 95f6266ef0c..001639501ea 100644 --- a/src/mame/drivers/cherrym.c +++ b/src/mame/drivers/cherrym.c @@ -16,7 +16,6 @@ static tilemap *bg_tilemap; static PALETTE_INIT( cm ) { - #define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs]) int i; for ( i = 0; i < machine->drv->total_colors; i++ ) @@ -392,7 +391,6 @@ static MACHINE_DRIVER_START( cmv801 ) MDRV_GFXDECODE(cherrym) MDRV_PALETTE_LENGTH(256) - MDRV_COLORTABLE_LENGTH(256) MDRV_PALETTE_INIT(cm) MDRV_VIDEO_START(cm) diff --git a/src/mame/drivers/cischeat.c b/src/mame/drivers/cischeat.c index 8c9daa21276..960af69ef61 100644 --- a/src/mame/drivers/cischeat.c +++ b/src/mame/drivers/cischeat.c @@ -523,7 +523,7 @@ READ16_HANDLER( scudhamm_motor_pos_r ) Within $20 vblanks the motor must reach the target. */ -WRITE16_HANDLER( scudhamm_motor_command_w ) +static WRITE16_HANDLER( scudhamm_motor_command_w ) { COMBINE_DATA( &scudhamm_motor_command ); } diff --git a/src/mame/drivers/decocass.c b/src/mame/drivers/decocass.c index 51af59e7587..c8e8815faf1 100644 --- a/src/mame/drivers/decocass.c +++ b/src/mame/drivers/decocass.c @@ -354,26 +354,29 @@ GFXDECODE_END static PALETTE_INIT( decocass ) { int i; + + machine->colortable = colortable_alloc(machine, 32); + /* set up 32 colors 1:1 pens */ for (i = 0; i < 32; i++) - colortable[i] = i; + colortable_entry_set_value(machine->colortable, i, i); /* setup straight/flipped colors for background tiles (D7 of color_center_bot ?) */ for (i = 0; i < 8; i++) { - colortable[32+i] = 3*8+i; - colortable[40+i] = 3*8+((i << 1) & 0x04) + ((i >> 1) & 0x02) + (i & 0x01); + colortable_entry_set_value(machine->colortable, 32+i, 3*8+i); + colortable_entry_set_value(machine->colortable, 40+i, 3*8+((i << 1) & 0x04) + ((i >> 1) & 0x02) + (i & 0x01)); } /* setup 4 colors for 1bpp object */ - colortable[48+0*2+0] = 0; - colortable[48+0*2+1] = 25; /* testtape red from 4th palette section? */ - colortable[48+1*2+0] = 0; - colortable[48+1*2+1] = 28; /* testtape blue from 4th palette section? */ - colortable[48+2*2+0] = 0; - colortable[48+2*2+1] = 26; /* testtape green from 4th palette section? */ - colortable[48+3*2+0] = 0; - colortable[48+3*2+1] = 23; /* ???? */ + colortable_entry_set_value(machine->colortable, 48+0*2+0, 0); + colortable_entry_set_value(machine->colortable, 48+0*2+1, 25); /* testtape red from 4th palette section? */ + colortable_entry_set_value(machine->colortable, 48+1*2+0, 0); + colortable_entry_set_value(machine->colortable, 48+1*2+1, 28); /* testtape blue from 4th palette section? */ + colortable_entry_set_value(machine->colortable, 48+2*2+0, 0); + colortable_entry_set_value(machine->colortable, 48+2*2+1, 26); /* testtape green from 4th palette section? */ + colortable_entry_set_value(machine->colortable, 48+3*2+0, 0); + colortable_entry_set_value(machine->colortable, 48+3*2+1, 23); /* ???? */ } @@ -402,8 +405,7 @@ static MACHINE_DRIVER_START( decocass ) MDRV_SCREEN_SIZE(32*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 1*8, 31*8-1) MDRV_GFXDECODE(decocass) - MDRV_PALETTE_LENGTH(32) - MDRV_COLORTABLE_LENGTH(32+2*8+2*4) + MDRV_PALETTE_LENGTH(32+2*8+2*4) MDRV_PALETTE_INIT(decocass) MDRV_VIDEO_START(decocass) diff --git a/src/mame/drivers/dgpix.c b/src/mame/drivers/dgpix.c index 2d1ffa56eca..206018571df 100644 --- a/src/mame/drivers/dgpix.c +++ b/src/mame/drivers/dgpix.c @@ -213,6 +213,13 @@ static WRITE32_HANDLER( coin_w ) coin_counter_w(1, data & 2); } +static READ32_HANDLER( vblank_r ) +{ + /* burn a bunch of cycles because this is polled frequently during busy loops */ + activecpu_adjust_icount(-100); + return input_port_0_dword_r(offset, 0); +} + static ADDRESS_MAP_START( cpu_map, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_RANGE(0x40000000, 0x4003ffff) AM_READWRITE(vram_r, vram_w) @@ -223,7 +230,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 32 ) AM_RANGE(0x0200, 0x0203) AM_READNOP // used to sync with the protecion PIC? tested bits 0 and 1 - AM_RANGE(0x0400, 0x0403) AM_READWRITE(input_port_0_dword_r, vbuffer_w) + AM_RANGE(0x0400, 0x0403) AM_READWRITE(vblank_r, vbuffer_w) AM_RANGE(0x0a10, 0x0a13) AM_READ(input_port_1_dword_r) AM_RANGE(0x0200, 0x0203) AM_WRITE(coin_w) AM_RANGE(0x0c00, 0x0c03) AM_WRITENOP // writes only: 1, 0, 1 at startup @@ -311,7 +318,7 @@ static VIDEO_UPDATE( dgpix ) } static MACHINE_DRIVER_START( dgpix ) - MDRV_CPU_ADD(E132XT, 20000000) + MDRV_CPU_ADD(E132XT, 20000000*4) /* 4x internal multiplier */ MDRV_CPU_PROGRAM_MAP(cpu_map,0) MDRV_CPU_IO_MAP(io_map,0) diff --git a/src/mame/drivers/dlair.c b/src/mame/drivers/dlair.c index c3a8e7f45b3..9bbed62b3d8 100644 --- a/src/mame/drivers/dlair.c +++ b/src/mame/drivers/dlair.c @@ -181,11 +181,9 @@ static PALETTE_INIT( dleuro ) for (i = 0; i < 8; i++) { - palette_set_color_rgb(machine, i, pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2)); - colortable[2 * i + 0] = 8; - colortable[2 * i + 1] = i; + palette_set_color(machine, 2 * i + 0, MAKE_RGB(0, 0, 0)); + palette_set_color_rgb(machine, 2 * i + 1, pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2)); } - palette_set_color(machine, 8, MAKE_RGB(0, 0, 0)); } @@ -858,8 +856,7 @@ static MACHINE_DRIVER_START( dleuro ) MDRV_SCREEN_VISIBLE_AREA(0, 199, 0, 239) MDRV_GFXDECODE(dlair) - MDRV_PALETTE_LENGTH(9) - MDRV_COLORTABLE_LENGTH(16) + MDRV_PALETTE_LENGTH(16) MDRV_PALETTE_INIT(dleuro) MDRV_VIDEO_START(dleuro) diff --git a/src/mame/drivers/eolith16.c b/src/mame/drivers/eolith16.c index 113b99ad394..dd7bc5f5ea0 100644 --- a/src/mame/drivers/eolith16.c +++ b/src/mame/drivers/eolith16.c @@ -163,7 +163,7 @@ static PALETTE_INIT( eolith16 ) static MACHINE_DRIVER_START( eolith16 ) - MDRV_CPU_ADD(E116T, 60000000) /* 60 MHz */ + MDRV_CPU_ADD(E116T, 60000000) /* no internal multiplier */ MDRV_CPU_PROGRAM_MAP(eolith16_map,0) MDRV_CPU_VBLANK_INT(eolith_speedup,262) diff --git a/src/mame/drivers/exidy.c b/src/mame/drivers/exidy.c index ea4d163c84d..067f01fddf8 100644 --- a/src/mame/drivers/exidy.c +++ b/src/mame/drivers/exidy.c @@ -744,8 +744,8 @@ static const gfx_layout charlayout_1bpp = 256, 1, { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + { STEP8(0,1) }, + { STEP8(0,8) }, 8*8 }; @@ -755,8 +755,8 @@ static const gfx_layout charlayout_2bpp = 256, 2, { 0, 256*8*8 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + { STEP8(0,1) }, + { STEP8(0,8) }, 8*8 }; @@ -766,21 +766,21 @@ static const gfx_layout spritelayout = RGN_FRAC(1,1), 1, { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7, 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7}, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8}, + { STEP8(0,1), STEP8(16*8,1), }, + { STEP16(0,8) }, 8*32 }; static GFXDECODE_START( 1bpp ) - GFXDECODE_ENTRY( REGION_CPU1, 0x4800, charlayout_1bpp, 0, 4 ) /* the game dynamically modifies this */ - GFXDECODE_ENTRY( REGION_GFX1, 0x0000, spritelayout, 8, 2 ) + GFXDECODE_ENTRY( REGION_CPU1, 0x4800, charlayout_1bpp, 4, 4 ) /* the game dynamically modifies this */ + GFXDECODE_ENTRY( REGION_GFX1, 0x0000, spritelayout, 0, 2 ) GFXDECODE_END static GFXDECODE_START( 2bpp ) - GFXDECODE_ENTRY( REGION_CPU1, 0x6000, charlayout_2bpp, 0, 4 ) /* the game dynamically modifies this */ - GFXDECODE_ENTRY( REGION_GFX1, 0x0000, spritelayout, 16, 2 ) + GFXDECODE_ENTRY( REGION_CPU1, 0x6000, charlayout_2bpp, 4, 4 ) /* the game dynamically modifies this */ + GFXDECODE_ENTRY( REGION_GFX1, 0x0000, spritelayout, 0, 2 ) GFXDECODE_END @@ -836,10 +836,8 @@ static MACHINE_DRIVER_START( targ ) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MDRV_SCREEN_RAW_PARAMS(EXIDY_PIXEL_CLOCK, EXIDY_HTOTAL, EXIDY_HBEND, EXIDY_HBSTART, EXIDY_VTOTAL, EXIDY_VBEND, EXIDY_VBSTART) MDRV_GFXDECODE(1bpp) - MDRV_PALETTE_LENGTH(PALETTE_LEN) - MDRV_COLORTABLE_LENGTH(COLORTABLE_LEN) + MDRV_PALETTE_LENGTH(2*2 + 4*2) - MDRV_PALETTE_INIT(exidy) MDRV_VIDEO_START(exidy) MDRV_VIDEO_EOF(exidy) MDRV_VIDEO_UPDATE(exidy) @@ -913,6 +911,7 @@ static MACHINE_DRIVER_START( pepper2 ) /* video hardware */ MDRV_GFXDECODE(2bpp) + MDRV_PALETTE_LENGTH(2*2 + 4*4) MACHINE_DRIVER_END @@ -1341,10 +1340,8 @@ ROM_END * *************************************/ -static void exidy_common_init(UINT8 palette[], UINT16 colortable[], UINT8 cmask, UINT8 cinvert) +static void exidy_common_init(UINT8 cmask, UINT8 cinvert) { - exidy_palette = palette; - exidy_colortable = colortable; exidy_collision_mask = cmask; exidy_collision_invert = cinvert; targ_spec_flag = 0; @@ -1353,7 +1350,12 @@ static void exidy_common_init(UINT8 palette[], UINT16 colortable[], UINT8 cmask, static DRIVER_INIT( sidetrac ) { - exidy_common_init(sidetrac_palette, exidy_1bpp_colortable, 0x00, 0x00); + exidy_common_init(0x00, 0x00); + + /* hard-coded palette controlled via 8x3 DIP switches on the board */ + exidy_color_latch[2] = 0xf8; + exidy_color_latch[1] = 0xdc; + exidy_color_latch[0] = 0xb8; /* ROM in place of character RAM */ memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x4800, 0x4bff, 0, 0, MWA8_ROM); @@ -1362,19 +1364,35 @@ static DRIVER_INIT( sidetrac ) static DRIVER_INIT( targ ) { - exidy_common_init(targ_palette, exidy_1bpp_colortable, 0x00, 0x00); + exidy_common_init(0x00, 0x00); + + /* hard-coded palette controlled via 8x3 DIP switches on the board */ + exidy_color_latch[2] = 0x5c; + exidy_color_latch[1] = 0xee; + exidy_color_latch[0] = 0x6b; + targ_spec_flag = 1; } static DRIVER_INIT( spectar ) { - exidy_common_init(spectar_palette, exidy_1bpp_colortable, 0x00, 0x00); + exidy_common_init(0x00, 0x00); + + /* hard-coded palette controlled via 8x3 DIP switches on the board */ + exidy_color_latch[2] = 0x58; + exidy_color_latch[1] = 0xee; + exidy_color_latch[0] = 0x09; } static DRIVER_INIT( rallys ) { - exidy_common_init(spectar_palette, exidy_1bpp_colortable, 0x00, 0x00); + exidy_common_init(0x00, 0x00); + + /* hard-coded palette controlled via 8x3 DIP switches on the board */ + exidy_color_latch[2] = 0x58; + exidy_color_latch[1] = 0xee; + exidy_color_latch[0] = 0x09; /* sprite locations are slightly different */ memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x5000, 0x5000, 0, 0, exidy_sprite1_xpos_w); @@ -1385,7 +1403,12 @@ static DRIVER_INIT( rallys ) static DRIVER_INIT( phantoma ) { - exidy_common_init(spectar_palette, exidy_1bpp_colortable, 0x00, 0x00); + exidy_common_init(0x00, 0x00); + + /* hard-coded palette controlled via 8x3 DIP switches on the board */ + exidy_color_latch[2] = 0x58; + exidy_color_latch[1] = 0xee; + exidy_color_latch[0] = 0x09; /* sprite locations are slightly different */ memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x5000, 0x5000, 0, 0, exidy_sprite1_xpos_w); @@ -1401,19 +1424,19 @@ static DRIVER_INIT( phantoma ) static DRIVER_INIT( mtrap ) { - exidy_common_init(NULL, exidy_1bpp_colortable, 0x14, 0x00); + exidy_common_init(0x14, 0x00); } static DRIVER_INIT( venture ) { - exidy_common_init(NULL, exidy_1bpp_colortable, 0x04, 0x04); + exidy_common_init(0x04, 0x04); } static DRIVER_INIT( teetert ) { - exidy_common_init(NULL, exidy_1bpp_colortable, 0x0c, 0x0c); + exidy_common_init(0x0c, 0x0c); /* special input handler for the dial */ memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x5101, 0x5101, 0, 0, teetert_input_r); @@ -1422,7 +1445,7 @@ static DRIVER_INIT( teetert ) static DRIVER_INIT( pepper2 ) { - exidy_common_init(NULL, exidy_2bpp_colortable, 0x14, 0x04); + exidy_common_init(0x14, 0x04); /* two 6116 character RAMs */ exidy_characterram = memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x6fff, 0, 0, MRA8_RAM); @@ -1434,7 +1457,7 @@ static DRIVER_INIT( pepper2 ) static DRIVER_INIT( fax ) { - exidy_common_init(NULL, exidy_2bpp_colortable, 0x04, 0x04); + exidy_common_init(0x04, 0x04); /* reset the ROM bank */ fax_bank_select_w(0,0); diff --git a/src/mame/drivers/f-32.c b/src/mame/drivers/f-32.c index ba303d53bda..f8225404911 100644 --- a/src/mame/drivers/f-32.c +++ b/src/mame/drivers/f-32.c @@ -134,10 +134,10 @@ static INPUT_PORTS_START( mosaicf2 ) INPUT_PORTS_END static MACHINE_DRIVER_START( mosaicf2 ) - MDRV_CPU_ADD_TAG("main", E132XT, 20000000) // E132XN actually! /* 20 MHz */ + MDRV_CPU_ADD_TAG("main", E132XN, 20000000*4) /* 4x internal multiplier */ MDRV_CPU_PROGRAM_MAP(common_map,0) MDRV_CPU_IO_MAP(mosaicf2_io,0) - MDRV_CPU_VBLANK_INT(irq5_line_pulse, 1) + MDRV_CPU_VBLANK_INT(irq0_line_hold, 1) MDRV_SCREEN_REFRESH_RATE(60) MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION) diff --git a/src/mame/drivers/fgoal.c b/src/mame/drivers/fgoal.c index f2486c3f222..3f492acd6de 100644 --- a/src/mame/drivers/fgoal.c +++ b/src/mame/drivers/fgoal.c @@ -59,45 +59,22 @@ static PALETTE_INIT( fgoal ) { int i; - for (i = 0; i < 64; i++) - { - int r = (i >> 4) & 3; - int g = (i >> 2) & 3; - int b = (i >> 0) & 3; - - palette_set_color_rgb(machine,i, - intensity(r), - intensity(g), - intensity(b)); - } - - palette_set_color(machine,0x40,MAKE_RGB(0x2e,0x80,0x2e)); - palette_set_color(machine,0x41,MAKE_RGB(0x2e,0x2e,0x2e)); - /* for B/W screens PCB can be jumpered to use lower half of PROM */ for (i = 0; i < 128; i++) { - colortable[i] = color_prom[0x80 | i] & 63; + UINT8 color = color_prom[0x80 | i] & 63; + palette_set_color_rgb(machine, i, intensity(color >> 4), intensity(color >> 2), intensity(color >> 0)); + } + + for (i = 0; i < 8; i++) + { + palette_set_color(machine, 128 + 0*8 + i, MAKE_RGB(0x2e,0x80,0x2e)); + palette_set_color(machine, 128 + 1*8 + i, MAKE_RGB(0x2e,0x2e,0x2e)); } - colortable[0x80] = 0x40; - colortable[0x81] = 0x40; - colortable[0x82] = 0x40; - colortable[0x83] = 0x40; - colortable[0x84] = 0x40; - colortable[0x85] = 0x40; - colortable[0x86] = 0x40; - colortable[0x87] = 0x40; - - colortable[0x88] = 0x41; - colortable[0x89] = 0x41; - colortable[0x8a] = 0x41; - colortable[0x8b] = 0x41; - colortable[0x8c] = 0x41; - colortable[0x8d] = 0x41; - colortable[0x8e] = 0x41; - colortable[0x8f] = 0x41; + /* ball is a fixed color */ + palette_set_color_rgb(machine, 128 + 16, intensity(0x38 >> 4), intensity(0x38 >> 2), intensity(0x38 >> 0)); } @@ -398,8 +375,7 @@ static MACHINE_DRIVER_START( fgoal ) MDRV_SCREEN_SIZE(256, 263) MDRV_SCREEN_VISIBLE_AREA(0, 255, 16, 255) MDRV_GFXDECODE(fgoal) - MDRV_PALETTE_LENGTH(64 + 2) - MDRV_COLORTABLE_LENGTH(128 + 16) + MDRV_PALETTE_LENGTH(128 + 16 + 1) MDRV_PALETTE_INIT(fgoal) MDRV_VIDEO_START(fgoal) diff --git a/src/mame/drivers/firetrk.c b/src/mame/drivers/firetrk.c index bdc24ea0d51..9c755c33658 100644 --- a/src/mame/drivers/firetrk.c +++ b/src/mame/drivers/firetrk.c @@ -15,6 +15,9 @@ Atari Fire Truck + Super Bug + Monte Carlo driver int firetrk_game; +UINT32 firetrk_color1_mask; +UINT32 firetrk_color2_mask; + static int last_service; static int steer_dir[2]; static int steer_flag[2]; @@ -244,7 +247,7 @@ static MACHINE_RESET( firetrk ) static PALETTE_INIT( firetrk ) { - static const UINT16 colortable_source[] = + static const UINT8 colortable_source[] = { 0, 0, 1, 0, 2, 0, 3, 0, @@ -254,13 +257,25 @@ static PALETTE_INIT( firetrk ) 2, 0, 0, 3, 3, 0, 0, 3 }; + static const rgb_t palette_source[] = + { + MAKE_RGB(0x00, 0x00, 0x00), + MAKE_RGB(0x5b, 0x5b, 0x5b), + MAKE_RGB(0xa4, 0xa4, 0xa4), + MAKE_RGB(0xff, 0xff, 0xff) + }; + int i; - palette_set_color(machine, 0, MAKE_RGB(0x00, 0x00, 0x00)); - palette_set_color(machine, 1, MAKE_RGB(0x5b, 0x5b, 0x5b)); - palette_set_color(machine, 2, MAKE_RGB(0xa4, 0xa4, 0xa4)); - palette_set_color(machine, 3, MAKE_RGB(0xff, 0xff, 0xff)); - - memcpy(colortable, colortable_source, sizeof(colortable_source)); + firetrk_color1_mask = firetrk_color2_mask = 0; + for (i = 0; i < ARRAY_LENGTH(colortable_source); i++) + { + UINT8 color = colortable_source[i]; + if (color == 1) + firetrk_color1_mask |= 1 << i; + else if (color == 2) + firetrk_color2_mask |= 1 << i; + palette_set_color(machine, i, palette_source[color]); + } } @@ -272,7 +287,7 @@ static void prom_to_palette(running_machine *machine, int number, UINT8 val) static PALETTE_INIT( montecar ) { - static const UINT16 colortable_source[] = + static const UINT8 colortable_source[] = { 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, @@ -280,12 +295,11 @@ static PALETTE_INIT( montecar ) 0x03, 0x01, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x01, 0x02, 0x02, - 0x00, 0x05, 0x06, 0x07, - 0x00, 0x09, 0x0A, 0x0B, - 0x00, 0x0D, 0x0E, 0x0F, - 0x00, 0x11, 0x12, 0x13, - 0x00, 0x15, 0x16, 0x17, - 0x18, 0x19 + 0x00, 0x10, 0x20, 0x30, + 0x00, 0x04, 0x08, 0x0C, + 0x00, 0x44, 0x48, 0x4C, + 0x00, 0x84, 0x88, 0x8C, + 0x00, 0xC4, 0xC8, 0xCC }; /* @@ -307,43 +321,21 @@ static PALETTE_INIT( montecar ) */ const UINT8* p = memory_region(REGION_PROMS); + int i; - int number = 0; - - prom_to_palette(machine, number++, p[0x100]); - prom_to_palette(machine, number++, p[0x101]); - prom_to_palette(machine, number++, p[0x102]); - prom_to_palette(machine, number++, p[0x103]); - - prom_to_palette(machine, number++, p[0x100]); - prom_to_palette(machine, number++, p[0x110]); - prom_to_palette(machine, number++, p[0x120]); - prom_to_palette(machine, number++, p[0x130]); - - prom_to_palette(machine, number++, p[0x100]); - prom_to_palette(machine, number++, p[0x104]); - prom_to_palette(machine, number++, p[0x108]); - prom_to_palette(machine, number++, p[0x10C]); - - prom_to_palette(machine, number++, p[0x140]); - prom_to_palette(machine, number++, p[0x144]); - prom_to_palette(machine, number++, p[0x148]); - prom_to_palette(machine, number++, p[0x14C]); - - prom_to_palette(machine, number++, p[0x180]); - prom_to_palette(machine, number++, p[0x184]); - prom_to_palette(machine, number++, p[0x188]); - prom_to_palette(machine, number++, p[0x18C]); - - prom_to_palette(machine, number++, p[0x1C0]); - prom_to_palette(machine, number++, p[0x1C4]); - prom_to_palette(machine, number++, p[0x1C8]); - prom_to_palette(machine, number++, p[0x1CC]); - - palette_set_color(machine, number++, MAKE_RGB(0x00, 0x00, 0x00)); - palette_set_color(machine, number++, MAKE_RGB(0xff, 0xff, 0xff)); + firetrk_color1_mask = firetrk_color2_mask = 0; + for (i = 0; i < ARRAY_LENGTH(colortable_source); i++) + { + UINT8 color = colortable_source[i]; + if (color == 1) + firetrk_color1_mask |= 1 << i; + else if (color == 2) + firetrk_color2_mask |= 1 << i; + prom_to_palette(machine, i, p[0x100 + colortable_source[i]]); + } - memcpy(colortable, colortable_source, sizeof(colortable_source)); + palette_set_color(machine, ARRAY_LENGTH(colortable_source) + 0, MAKE_RGB(0x00, 0x00, 0x00)); + palette_set_color(machine, ARRAY_LENGTH(colortable_source) + 1, MAKE_RGB(0xff, 0xff, 0xff)); } @@ -1074,8 +1066,7 @@ static MACHINE_DRIVER_START( firetrk ) MDRV_GFXDECODE(firetrk) MDRV_PALETTE_INIT(firetrk) - MDRV_PALETTE_LENGTH(4) - MDRV_COLORTABLE_LENGTH(28) + MDRV_PALETTE_LENGTH(28) MDRV_VIDEO_START(firetrk) MDRV_VIDEO_EOF(firetrk) @@ -1101,8 +1092,7 @@ static MACHINE_DRIVER_START( superbug ) MDRV_GFXDECODE(superbug) MDRV_PALETTE_INIT(firetrk) - MDRV_PALETTE_LENGTH(4) - MDRV_COLORTABLE_LENGTH(28) + MDRV_PALETTE_LENGTH(28) /* sound hardware */ MDRV_SOUND_REPLACE("discrete", DISCRETE, 0) @@ -1122,8 +1112,7 @@ static MACHINE_DRIVER_START( montecar ) MDRV_GFXDECODE(montecar) MDRV_PALETTE_INIT(montecar) - MDRV_PALETTE_LENGTH(26) - MDRV_COLORTABLE_LENGTH(46) + MDRV_PALETTE_LENGTH(46) /* sound hardware */ MDRV_SOUND_REPLACE("discrete", DISCRETE, 0) diff --git a/src/mame/drivers/gstream.c b/src/mame/drivers/gstream.c index 29631fb192b..9ba34c5ade4 100644 --- a/src/mame/drivers/gstream.c +++ b/src/mame/drivers/gstream.c @@ -385,10 +385,10 @@ static VIDEO_UPDATE(gstream) } static MACHINE_DRIVER_START( gstream ) - MDRV_CPU_ADD_TAG("main", E132XT, 16000000) /* 16 Mhz? */ + MDRV_CPU_ADD_TAG("main", E132XT, 16000000*4) /* 4x internal multiplier */ MDRV_CPU_PROGRAM_MAP(gstream_32bit_map,0) MDRV_CPU_IO_MAP(gstream_io,0) - MDRV_CPU_VBLANK_INT(irq5_line_hold,1) + MDRV_CPU_VBLANK_INT(irq0_line_hold,1) MDRV_SCREEN_REFRESH_RATE(60) MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) diff --git a/src/mame/drivers/lazercmd.c b/src/mame/drivers/lazercmd.c index 5583be8f1ca..1590cf14b12 100644 --- a/src/mame/drivers/lazercmd.c +++ b/src/mame/drivers/lazercmd.c @@ -599,17 +599,15 @@ static GFXDECODE_START( lazercmd ) GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0, 2 ) GFXDECODE_END -static UINT16 colortable_source[] = -{ - 1, 0, - 0, 1 -}; static PALETTE_INIT( lazercmd ) { - palette_set_color(machine,0,MAKE_RGB(0x00,0x00,0x00)); /* black */ - palette_set_color(machine,1,MAKE_RGB(0xb0,0xb0,0xb0)); /* white */ - palette_set_color(machine,2,MAKE_RGB(0xff,0xff,0xff)); /* bright white */ - memcpy(colortable,colortable_source,sizeof(colortable_source)); + palette_set_color(machine,0,MAKE_RGB(0xb0,0xb0,0xb0)); /* white */ + palette_set_color(machine,1,MAKE_RGB(0x00,0x00,0x00)); /* black */ + + palette_set_color(machine,2,MAKE_RGB(0x00,0x00,0x00)); /* black */ + palette_set_color(machine,3,MAKE_RGB(0xb0,0xb0,0xb0)); /* white */ + + palette_set_color(machine,4,MAKE_RGB(0xff,0xff,0xff)); /* bright white */ } static MACHINE_DRIVER_START( lazercmd ) @@ -634,8 +632,7 @@ static MACHINE_DRIVER_START( lazercmd ) MDRV_SCREEN_VISIBLE_AREA(0 * HORZ_CHR, HORZ_RES * HORZ_CHR - 1, 0 * VERT_CHR, (VERT_RES - 1) * VERT_CHR - 1) MDRV_GFXDECODE(lazercmd) - MDRV_PALETTE_LENGTH(3) - MDRV_COLORTABLE_LENGTH(2*2) + MDRV_PALETTE_LENGTH(5) MDRV_PALETTE_INIT(lazercmd) MDRV_VIDEO_UPDATE(lazercmd) @@ -670,8 +667,7 @@ static MACHINE_DRIVER_START( medlanes ) MDRV_SCREEN_VISIBLE_AREA(0 * HORZ_CHR, HORZ_RES * HORZ_CHR - 1, 0 * VERT_CHR, VERT_RES * VERT_CHR - 1) MDRV_GFXDECODE(lazercmd) - MDRV_PALETTE_LENGTH(3) - MDRV_COLORTABLE_LENGTH(2*2) + MDRV_PALETTE_LENGTH(5) MDRV_PALETTE_INIT(lazercmd) MDRV_VIDEO_UPDATE(lazercmd) @@ -706,8 +702,7 @@ static MACHINE_DRIVER_START( bbonk ) MDRV_SCREEN_VISIBLE_AREA(0 * HORZ_CHR, HORZ_RES * HORZ_CHR - 1, 0 * VERT_CHR, (VERT_RES - 1) * VERT_CHR - 1) MDRV_GFXDECODE(lazercmd) - MDRV_PALETTE_LENGTH(3) - MDRV_COLORTABLE_LENGTH(2*2) + MDRV_PALETTE_LENGTH(5) MDRV_PALETTE_INIT(lazercmd) MDRV_VIDEO_UPDATE(lazercmd) diff --git a/src/mame/drivers/limenko.c b/src/mame/drivers/limenko.c index 6aaff8d392c..73288f2aaf2 100644 --- a/src/mame/drivers/limenko.c +++ b/src/mame/drivers/limenko.c @@ -475,10 +475,10 @@ GFXDECODE_END static MACHINE_DRIVER_START( limenko ) - MDRV_CPU_ADD(E132XT, 80000000) //E132XN! + MDRV_CPU_ADD(E132XN, 20000000*4) /* 4x internal multiplier */ MDRV_CPU_PROGRAM_MAP(limenko_map,0) MDRV_CPU_IO_MAP(limenko_io_map,0) - MDRV_CPU_VBLANK_INT(irq5_line_hold, 1) + MDRV_CPU_VBLANK_INT(irq0_line_hold, 1) MDRV_SCREEN_REFRESH_RATE(60) MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) @@ -501,10 +501,10 @@ static MACHINE_DRIVER_START( limenko ) MACHINE_DRIVER_END static MACHINE_DRIVER_START( spotty ) - MDRV_CPU_ADD(GMS30C2232, 80000000) /* 20 MHz with 4x internal clock multiplier? */ + MDRV_CPU_ADD(GMS30C2232, 20000000) /* 20 MHz, no internal multiplier */ MDRV_CPU_PROGRAM_MAP(spotty_map,0) MDRV_CPU_IO_MAP(spotty_io_map,0) - MDRV_CPU_VBLANK_INT(irq5_line_hold, 1) + MDRV_CPU_VBLANK_INT(irq0_line_hold, 1) MDRV_CPU_ADD(I8051, 4000000) /* 4 MHz */ MDRV_CPU_PROGRAM_MAP(spotty_sound_prg_map, 0) diff --git a/src/mame/drivers/malzak.c b/src/mame/drivers/malzak.c index a3a1e6c3f18..1e3842edbe2 100644 --- a/src/mame/drivers/malzak.c +++ b/src/mame/drivers/malzak.c @@ -391,31 +391,6 @@ static const gfx_layout saa5050_lolayout = 8 * 10 }; -static const rgb_t saa5050_palette[8] = -{ - MAKE_RGB(0x00, 0x00, 0x00), /* black */ - MAKE_RGB(0xff, 0x00, 0x00), /* red */ - MAKE_RGB(0x00, 0xff, 0x00), /* green */ - MAKE_RGB(0xff, 0xff, 0x00), /* yellow */ - MAKE_RGB(0x00, 0x00, 0xff), /* blue */ - MAKE_RGB(0xff, 0x00, 0xff), /* magenta */ - MAKE_RGB(0x00, 0xff, 0xff), /* cyan */ - MAKE_RGB(0xff, 0xff, 0xff) /* white */ -}; - -/* bgnd, fgnd */ -static unsigned short saa5050_colortable[64 * 2] = -{ - 0,1, 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, - 1,0, 1,1, 1,2, 1,3, 1,4, 1,5, 1,6, 1,7, - 2,0, 2,1, 2,2, 2,3, 2,4, 2,5, 2,6, 2,7, - 3,0, 3,1, 3,2, 3,3, 3,4, 3,5, 3,6, 3,7, - 4,0, 4,1, 4,2, 4,3, 4,4, 4,5, 4,6, 4,7, - 5,0, 5,1, 5,2, 5,3, 5,4, 5,5, 5,6, 5,7, - 6,0, 6,1, 6,2, 6,3, 6,4, 6,5, 6,6, 6,7, - 7,0, 7,1, 7,2, 7,3, 7,4, 7,5, 7,6, 7,7 -}; - //add s2636 decodes here (i.e. from zac2650) and maybe re-arrange them static GFXDECODE_START( malzak ) GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0, 16 ) @@ -429,8 +404,13 @@ GFXDECODE_END static PALETTE_INIT( malzak ) { - palette_set_colors(machine, 0, saa5050_palette, ARRAY_LENGTH(saa5050_palette)); - memcpy(colortable, saa5050_colortable, sizeof (saa5050_colortable)); + int i; + + for (i = 0; i < 8*8; i++) + { + palette_set_color_rgb(machine, i * 2 + 0, pal1bit(i >> 3), pal1bit(i >> 4), pal1bit(i >> 5)); + palette_set_color_rgb(machine, i * 2 + 1, pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2)); + } } @@ -478,9 +458,8 @@ static MACHINE_DRIVER_START( malzak ) MDRV_SCREEN_SIZE(240, 256) /* vert size is a guess */ MDRV_SCREEN_VISIBLE_AREA(0, 239, 0, 239) MDRV_GFXDECODE(malzak) - MDRV_PALETTE_LENGTH(16) + MDRV_PALETTE_LENGTH(128) MDRV_PALETTE_INIT(malzak) - MDRV_COLORTABLE_LENGTH(128) // MDRV_MACHINE_RESET(malzak) diff --git a/src/mame/drivers/megadriv.c b/src/mame/drivers/megadriv.c index 5fa3fddbd6f..05da1ee4bab 100644 --- a/src/mame/drivers/megadriv.c +++ b/src/mame/drivers/megadriv.c @@ -608,10 +608,9 @@ static UINT16 get_word_from_68k_mem(UINT32 source) /* Note, In reality this transfer is NOT instant, the 68k isn't paused as the 68k address bus isn't accessed */ -static void megadrive_do_insta_vram_copy(UINT32 source, UINT16 length); /* Wani Wani World, James Pond 3, Pirates Gold! */ -void megadrive_do_insta_vram_copy(UINT32 source, UINT16 length) +static void megadrive_do_insta_vram_copy(UINT32 source, UINT16 length) { int x; diff --git a/src/mame/drivers/megatech.c b/src/mame/drivers/megatech.c index da9a7065661..00124da73bf 100644 --- a/src/mame/drivers/megatech.c +++ b/src/mame/drivers/megatech.c @@ -1053,11 +1053,11 @@ ROM_START( mt_cols ) /* Columns */ MEGATECH_GAME36(REGION_USER1, REGION_USER2) ROM_END -/* Game 04 - Great Golf (SMS) - bad dump */ +/* Game 04 - Great Golf (SMS) */ #define MEGATECH_GAME04(GAME_REGION, INSTRUCTION_REGION) \ ROM_REGION( 0x300000, GAME_REGION, 0 ) \ - ROM_LOAD( "mp11129f.ic1", 0x000000, 0x020000, BAD_DUMP CRC(942738ba) SHA1(e99d4e39c965fc123a39d75521a274687e917a57) ) \ + ROM_LOAD( "mp11129f.ic1", 0x000000, 0x020000, CRC(972c75ac) SHA1(2ae74c8563a3cefb27611d17bf3926865b6ebd45) ) \ MEGATECH_INSTRUCTION_REGION( INSTRUCTION_REGION, MEGATECH_GAME_IS_SMS ) \ ROM_LOAD( "12368-04.ic2", 0x000000, 0x08000, CRC(62e5579b) SHA1(e1f531be5c40a1216d4192baeda9352384444410) ) \ diff --git a/src/mame/drivers/mexico86.c b/src/mame/drivers/mexico86.c index 8184c056af3..dc7625d9456 100644 --- a/src/mame/drivers/mexico86.c +++ b/src/mame/drivers/mexico86.c @@ -383,7 +383,7 @@ static MACHINE_DRIVER_START( mexico86 ) MDRV_CPU_ADD_TAG("main",Z80, 24000000/4) /* 6 MHz, Uses clock divided 24MHz OSC */ MDRV_CPU_PROGRAM_MAP(readmem,writemem) - MDRV_CPU_ADD(Z80, 8000000/2) /* 4 MHz, Uses 8Mhz OSC */ + MDRV_CPU_ADD(Z80, 24000000/4) /* 6 MHz, Uses clock divided 24MHz OSC */ MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) MDRV_CPU_VBLANK_INT(irq0_line_hold,1) @@ -391,7 +391,7 @@ static MACHINE_DRIVER_START( mexico86 ) MDRV_CPU_PROGRAM_MAP(m68705_readmem,m68705_writemem) MDRV_CPU_VBLANK_INT(mexico86_m68705_interrupt,2) - MDRV_CPU_ADD_TAG("sub", Z80, 24000000/4) /* 6 MHz, Uses clock divided 24MHz OSC */ + MDRV_CPU_ADD_TAG("sub", Z80, 8000000/2) /* 4 MHz, Uses 8Mhz OSC */ MDRV_CPU_PROGRAM_MAP(sub_cpu_map,0) MDRV_CPU_VBLANK_INT(irq0_line_hold,1) diff --git a/src/mame/drivers/mogura.c b/src/mame/drivers/mogura.c index 8f703c27c5c..968f997add8 100644 --- a/src/mame/drivers/mogura.c +++ b/src/mame/drivers/mogura.c @@ -10,7 +10,6 @@ static tilemap *mogura_tilemap; static PALETTE_INIT( mogura ) { int i,j; - #define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs]) j = 0; for (i = 0;i < 0x20;i++) diff --git a/src/mame/drivers/namcos86.c b/src/mame/drivers/namcos86.c index 6bc9b0eab92..b09afe5099e 100644 --- a/src/mame/drivers/namcos86.c +++ b/src/mame/drivers/namcos86.c @@ -1088,8 +1088,7 @@ static MACHINE_DRIVER_START( hopmappy ) MDRV_SCREEN_SIZE(64*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(3 + 8*8, 3 + 44*8-1, 2*8, 30*8-1) MDRV_GFXDECODE(namcos86) - MDRV_PALETTE_LENGTH(512) - MDRV_COLORTABLE_LENGTH(4096) + MDRV_PALETTE_LENGTH(4096) MDRV_PALETTE_INIT(namcos86) MDRV_VIDEO_START(namcos86) @@ -1216,8 +1215,8 @@ ROM_START( skykiddx ) ROM_REGION( 0x1420, REGION_PROMS, 0 ) ROM_LOAD( "sk3-1.3r", 0x0000, 0x0200, CRC(9e81dedd) SHA1(9d2ddf51788d22ed65db9070684e586b2f64f99e) ) /* red & green components */ ROM_LOAD( "sk3-2.3s", 0x0200, 0x0200, CRC(cbfec4dd) SHA1(98adf5db270a853ab2a2e1cdd9edfd5657287a96) ) /* blue component */ - ROM_LOAD( "sk3-3.4v", 0x0400, 0x0800, CRC(81714109) SHA1(577e513369a4368b7dd29dff80904eb0ac2004ff) ) /* tiles colortable */ - ROM_LOAD( "sk3-4.5v", 0x0c00, 0x0800, CRC(1bf25acc) SHA1(a8db254ba4cbb85efc232a5bf9b268534455ad4a) ) /* sprites colortable */ + ROM_LOAD( "sk3-3.4v", 0x0400, 0x0800, CRC(81714109) SHA1(577e513369a4368b7dd29dff80904eb0ac2004ff) ) /* tiles color table */ + ROM_LOAD( "sk3-4.5v", 0x0c00, 0x0800, CRC(1bf25acc) SHA1(a8db254ba4cbb85efc232a5bf9b268534455ad4a) ) /* sprites color table */ ROM_LOAD( "sk3-5.6u", 0x1400, 0x0020, CRC(e4130804) SHA1(e1a3e1383186d036fba6dc8a8681f48f24f59281) ) /* tile address decoder (used at runtime) */ ROM_REGION( 0x10000, REGION_CPU3, 0 ) @@ -1252,8 +1251,8 @@ ROM_START( skykiddo ) ROM_REGION( 0x1420, REGION_PROMS, 0 ) ROM_LOAD( "sk3-1.3r", 0x0000, 0x0200, CRC(9e81dedd) SHA1(9d2ddf51788d22ed65db9070684e586b2f64f99e) ) /* red & green components */ ROM_LOAD( "sk3-2.3s", 0x0200, 0x0200, CRC(cbfec4dd) SHA1(98adf5db270a853ab2a2e1cdd9edfd5657287a96) ) /* blue component */ - ROM_LOAD( "sk3-3.4v", 0x0400, 0x0800, CRC(81714109) SHA1(577e513369a4368b7dd29dff80904eb0ac2004ff) ) /* tiles colortable */ - ROM_LOAD( "sk3-4.5v", 0x0c00, 0x0800, CRC(1bf25acc) SHA1(a8db254ba4cbb85efc232a5bf9b268534455ad4a) ) /* sprites colortable */ + ROM_LOAD( "sk3-3.4v", 0x0400, 0x0800, CRC(81714109) SHA1(577e513369a4368b7dd29dff80904eb0ac2004ff) ) /* tiles color table */ + ROM_LOAD( "sk3-4.5v", 0x0c00, 0x0800, CRC(1bf25acc) SHA1(a8db254ba4cbb85efc232a5bf9b268534455ad4a) ) /* sprites color table */ ROM_LOAD( "sk3-5.6u", 0x1400, 0x0020, CRC(e4130804) SHA1(e1a3e1383186d036fba6dc8a8681f48f24f59281) ) /* tile address decoder (used at runtime) */ ROM_REGION( 0x10000, REGION_CPU3, 0 ) @@ -1287,8 +1286,8 @@ ROM_START( hopmappy ) ROM_REGION( 0x1420, REGION_PROMS, 0 ) ROM_LOAD( "hm1-1.3r", 0x0000, 0x0200, CRC(cc801088) SHA1(d2c39ac1694d9b8c426e253702ecd096e68c6db9) ) /* red & green components */ ROM_LOAD( "hm1-2.3s", 0x0200, 0x0200, CRC(a1cb71c5) SHA1(d8c33c2e52d64ebf4a07d8a26453e7b872cae413) ) /* blue component */ - ROM_LOAD( "hm1-3.4v", 0x0400, 0x0800, CRC(e362d613) SHA1(16d87711c1ac4ac2b649a32a5627cbd62cc5031f) ) /* tiles colortable */ - ROM_LOAD( "hm1-4.5v", 0x0c00, 0x0800, CRC(678252b4) SHA1(9e2f7328532be3ac4b48bd5d52cd993108558452) ) /* sprites colortable */ + ROM_LOAD( "hm1-3.4v", 0x0400, 0x0800, CRC(e362d613) SHA1(16d87711c1ac4ac2b649a32a5627cbd62cc5031f) ) /* tiles color table */ + ROM_LOAD( "hm1-4.5v", 0x0c00, 0x0800, CRC(678252b4) SHA1(9e2f7328532be3ac4b48bd5d52cd993108558452) ) /* sprites color table */ ROM_LOAD( "hm1-5.6u", 0x1400, 0x0020, CRC(475bf500) SHA1(7e6a91e57d3709a5c70786c8e3ed545ee6026d03) ) /* tile address decoder (used at runtime) */ ROM_REGION( 0x10000, REGION_CPU3, 0 ) @@ -1328,8 +1327,8 @@ ROM_START( roishtar ) ROM_REGION( 0x1420, REGION_PROMS, 0 ) ROM_LOAD( "ri1-1.3r", 0x0000, 0x0200, CRC(29cd0400) SHA1(a9b0d09492710e72e34155cd6a7b7c1a34c56b20) ) /* red & green components */ ROM_LOAD( "ri1-2.3s", 0x0200, 0x0200, CRC(02fd278d) SHA1(db104fc7acf2739def902180981eb7ba10ec3dda) ) /* blue component */ - ROM_LOAD( "ri1-3.4v", 0x0400, 0x0800, CRC(cbd7e53f) SHA1(77ef70be4e8a21948d697649352a5e3527086cf2) ) /* tiles colortable */ - ROM_LOAD( "ri1-4.5v", 0x0c00, 0x0800, CRC(22921617) SHA1(7304cb5a86f524f912feb8b58801393cce5d3b09) ) /* sprites colortable */ + ROM_LOAD( "ri1-3.4v", 0x0400, 0x0800, CRC(cbd7e53f) SHA1(77ef70be4e8a21948d697649352a5e3527086cf2) ) /* tiles color table */ + ROM_LOAD( "ri1-4.5v", 0x0c00, 0x0800, CRC(22921617) SHA1(7304cb5a86f524f912feb8b58801393cce5d3b09) ) /* sprites color table */ ROM_LOAD( "ri1-5.6u", 0x1400, 0x0020, CRC(e2188075) SHA1(be079ace2070433d4d90c757aef3e415b4e21455) ) /* tile address decoder (used at runtime) */ ROM_REGION( 0x10000, REGION_CPU3, 0 ) @@ -1370,8 +1369,8 @@ ROM_START( genpeitd ) ROM_REGION( 0x1420, REGION_PROMS, 0 ) ROM_LOAD( "gt1-1.3r", 0x0000, 0x0200, CRC(2f0ddddb) SHA1(27fa45c0baf9a48002db11be9b3c0472ecfd986c) ) /* red & green components */ ROM_LOAD( "gt1-2.3s", 0x0200, 0x0200, CRC(87d27025) SHA1(a50f969d48a99c6d29141458fb3e34b23cf5e67c) ) /* blue component */ - ROM_LOAD( "gt1-3.4v", 0x0400, 0x0800, CRC(c178de99) SHA1(67289ef9e5068636023316560f9f1690a8384bfb) ) /* tiles colortable */ - ROM_LOAD( "gt1-4.5v", 0x0c00, 0x0800, CRC(9f48ef17) SHA1(78c813dd57326f3f5ab785005ef89ba96303adeb) ) /* sprites colortable */ + ROM_LOAD( "gt1-3.4v", 0x0400, 0x0800, CRC(c178de99) SHA1(67289ef9e5068636023316560f9f1690a8384bfb) ) /* tiles color table */ + ROM_LOAD( "gt1-4.5v", 0x0c00, 0x0800, CRC(9f48ef17) SHA1(78c813dd57326f3f5ab785005ef89ba96303adeb) ) /* sprites color table */ ROM_LOAD( "gt1-5.6u", 0x1400, 0x0020, CRC(e4130804) SHA1(e1a3e1383186d036fba6dc8a8681f48f24f59281) ) /* tile address decoder (used at runtime) */ ROM_REGION( 0x10000, REGION_CPU3, 0 ) @@ -1421,8 +1420,8 @@ ROM_START( rthunder ) ROM_REGION( 0x1420, REGION_PROMS, 0 ) ROM_LOAD( "rt1-1.3r", 0x0000, 0x0200, CRC(8ef3bb9d) SHA1(4636d6b8ba7611b11d4863fab02475dc4a619eaf) ) /* red & green components */ ROM_LOAD( "rt1-2.3s", 0x0200, 0x0200, CRC(6510a8f2) SHA1(935f140bfa7e6f8cebafa7f1b0de99dd319273d4) ) /* blue component */ - ROM_LOAD( "rt1-3.4v", 0x0400, 0x0800, CRC(95c7d944) SHA1(ca5fea028674882a61507ac7c89ada96f5b2674d) ) /* tiles colortable */ - ROM_LOAD( "rt1-4.5v", 0x0c00, 0x0800, CRC(1391fec9) SHA1(8ca94e22110b20d2ecdf03610bcc89ff4245920f) ) /* sprites colortable */ + ROM_LOAD( "rt1-3.4v", 0x0400, 0x0800, CRC(95c7d944) SHA1(ca5fea028674882a61507ac7c89ada96f5b2674d) ) /* tiles color table */ + ROM_LOAD( "rt1-4.5v", 0x0c00, 0x0800, CRC(1391fec9) SHA1(8ca94e22110b20d2ecdf03610bcc89ff4245920f) ) /* sprites color table */ ROM_LOAD( "rt1-5.6u", 0x1400, 0x0020, CRC(e4130804) SHA1(e1a3e1383186d036fba6dc8a8681f48f24f59281) ) /* tile address decoder (used at runtime) */ ROM_REGION( 0x10000, REGION_CPU3, 0 ) @@ -1472,8 +1471,8 @@ ROM_START( rthundro ) ROM_REGION( 0x1420, REGION_PROMS, 0 ) ROM_LOAD( "rt1-1.3r", 0x0000, 0x0200, CRC(8ef3bb9d) SHA1(4636d6b8ba7611b11d4863fab02475dc4a619eaf) ) /* red & green components */ ROM_LOAD( "rt1-2.3s", 0x0200, 0x0200, CRC(6510a8f2) SHA1(935f140bfa7e6f8cebafa7f1b0de99dd319273d4) ) /* blue component */ - ROM_LOAD( "rt1-3.4v", 0x0400, 0x0800, CRC(95c7d944) SHA1(ca5fea028674882a61507ac7c89ada96f5b2674d) ) /* tiles colortable */ - ROM_LOAD( "rt1-4.5v", 0x0c00, 0x0800, CRC(1391fec9) SHA1(8ca94e22110b20d2ecdf03610bcc89ff4245920f) ) /* sprites colortable */ + ROM_LOAD( "rt1-3.4v", 0x0400, 0x0800, CRC(95c7d944) SHA1(ca5fea028674882a61507ac7c89ada96f5b2674d) ) /* tiles color table */ + ROM_LOAD( "rt1-4.5v", 0x0c00, 0x0800, CRC(1391fec9) SHA1(8ca94e22110b20d2ecdf03610bcc89ff4245920f) ) /* sprites color table */ ROM_LOAD( "rt1-5.6u", 0x1400, 0x0020, CRC(e4130804) SHA1(e1a3e1383186d036fba6dc8a8681f48f24f59281) ) /* tile address decoder (used at runtime) */ ROM_REGION( 0x10000, REGION_CPU3, 0 ) @@ -1523,8 +1522,8 @@ ROM_START( wndrmomo ) ROM_REGION( 0x1420, REGION_PROMS, 0 ) ROM_LOAD( "wm1-1.3r", 0x0000, 0x0200, CRC(1af8ade8) SHA1(1aa0d314c34abc4154092d4b588214afb0b21e22) ) /* red & green components */ ROM_LOAD( "wm1-2.3s", 0x0200, 0x0200, CRC(8694e213) SHA1(f00d692e587c3706e71b6eeef21e1ea87c9dd921) ) /* blue component */ - ROM_LOAD( "wm1-3.4v", 0x0400, 0x0800, CRC(2ffaf9a4) SHA1(2002df3cc38e05f3e127d05c244cb101d1f1d85f) ) /* tiles colortable */ - ROM_LOAD( "wm1-4.5v", 0x0c00, 0x0800, CRC(f4e83e0b) SHA1(b000d884c6e0373b0403bc9d63eb0452c1197491) ) /* sprites colortable */ + ROM_LOAD( "wm1-3.4v", 0x0400, 0x0800, CRC(2ffaf9a4) SHA1(2002df3cc38e05f3e127d05c244cb101d1f1d85f) ) /* tiles color table */ + ROM_LOAD( "wm1-4.5v", 0x0c00, 0x0800, CRC(f4e83e0b) SHA1(b000d884c6e0373b0403bc9d63eb0452c1197491) ) /* sprites color table */ ROM_LOAD( "wm1-5.6u", 0x1400, 0x0020, CRC(e4130804) SHA1(e1a3e1383186d036fba6dc8a8681f48f24f59281) ) /* tile address decoder (used at runtime) */ ROM_REGION( 0x10000, REGION_CPU3, 0 ) diff --git a/src/mame/drivers/pasha2.c b/src/mame/drivers/pasha2.c index d49b0fb75af..5ec60396c0a 100644 --- a/src/mame/drivers/pasha2.c +++ b/src/mame/drivers/pasha2.c @@ -386,10 +386,10 @@ static VIDEO_UPDATE( pasha2 ) } static MACHINE_DRIVER_START( pasha2 ) - MDRV_CPU_ADD(E116T /*E116XT*/, 20000000) /* 20 MHz */ + MDRV_CPU_ADD(E116XT, 20000000*4) /* 4x internal multiplier */ MDRV_CPU_PROGRAM_MAP(pasha2_map,0) MDRV_CPU_IO_MAP(pasha2_io,0) - MDRV_CPU_VBLANK_INT(irq5_line_pulse, 1) + MDRV_CPU_VBLANK_INT(irq0_line_hold, 1) MDRV_SCREEN_REFRESH_RATE(60) MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) diff --git a/src/mame/drivers/segas32.c b/src/mame/drivers/segas32.c index bd4ab103faf..0f5ead5de23 100644 --- a/src/mame/drivers/segas32.c +++ b/src/mame/drivers/segas32.c @@ -3533,34 +3533,66 @@ ROM_END */ ROM_START( scross ) ROM_REGION( 0x200000, REGION_CPU1, 0 ) /* v60 code */ - ROM_LOAD32_WORD_x2( "epr15093.bin", 0x000000, 0x040000, CRC(2adc7a4b) SHA1(dca71f00d94898c0758394704d819e13482bf120) ) - ROM_LOAD32_WORD_x2( "epr15094.bin", 0x000002, 0x040000, CRC(bbb0ae73) SHA1(0d8837706405f301adf8fa85c8d4813d7600af98) ) - ROM_LOAD32_WORD( "epr15018.bin", 0x100000, 0x080000, CRC(3a98385e) SHA1(8088d337655030c28e290da4bbf44cb647dab66c) ) - ROM_LOAD32_WORD( "epr15019.bin", 0x100002, 0x080000, CRC(8bf4ac83) SHA1(e594d9d9b42d0765ed8a20a40b7dd92b75124d34) ) + ROM_LOAD32_WORD_x2( "epr-15093.bin", 0x000000, 0x040000, CRC(2adc7a4b) SHA1(dca71f00d94898c0758394704d819e13482bf120) ) + ROM_LOAD32_WORD_x2( "epr-15094.bin", 0x000002, 0x040000, CRC(bbb0ae73) SHA1(0d8837706405f301adf8fa85c8d4813d7600af98) ) + ROM_LOAD32_WORD( "epr-15018.bin", 0x100000, 0x080000, CRC(3a98385e) SHA1(8088d337655030c28e290da4bbf44cb647dab66c) ) + ROM_LOAD32_WORD( "epr-15019.bin", 0x100002, 0x080000, CRC(8bf4ac83) SHA1(e594d9d9b42d0765ed8a20a40b7dd92b75124d34) ) ROM_REGION( 0x180000, REGION_CPU2, 0 ) /* sound CPU */ - ROM_LOAD_x4( "epr15192.bin", 0x100000, 0x20000, CRC(7524290b) SHA1(ee58be2c0c4293ee19622b96ca493f4ce4da0038) ) + ROM_LOAD_x4( "epr-15192.bin", 0x100000, 0x20000, CRC(7524290b) SHA1(ee58be2c0c4293ee19622b96ca493f4ce4da0038) ) ROM_REGION( 0x400000, REGION_GFX1, ROMREGION_DISPOSE ) /* tiles */ /* 1ST AND 2ND HALF IDENTICAL (all roms) */ - ROM_LOAD16_BYTE( "epr15020.bin", 0x000000, 0x200000, CRC(65afea2f) SHA1(ad573727398bfac8e94f321be84b60e5690bfba6) ) - ROM_LOAD16_BYTE( "epr15021.bin", 0x000001, 0x200000, CRC(27bc6969) SHA1(d6bb446becb2d36b73bca5055357a43b837afc0a) ) + ROM_LOAD16_BYTE( "epr-15020.bin", 0x000000, 0x200000, CRC(65afea2f) SHA1(ad573727398bfac8e94f321be84b60e5690bfba6) ) + ROM_LOAD16_BYTE( "epr-15021.bin", 0x000001, 0x200000, CRC(27bc6969) SHA1(d6bb446becb2d36b73bca5055357a43b837afc0a) ) ROM_REGION32_BE( 0x1000000, REGION_GFX2, 0 ) /* sprites */ /* 1ST AND 2ND HALF IDENTICAL (all roms) */ - ROMX_LOAD( "epr15022.bin", 0x000000, 0x200000, CRC(09ca9608) SHA1(cbd0138c1c7811d42b051fed6a7e3526cc4e457f) , ROM_SKIP(6)|ROM_GROUPWORD ) - ROMX_LOAD( "epr15024.bin", 0x000002, 0x200000, CRC(0dc920eb) SHA1(d24d637aa0dcd3bae779ef7e12663df81667dbf7) , ROM_SKIP(6)|ROM_GROUPWORD ) - ROMX_LOAD( "epr15026.bin", 0x000004, 0x200000, CRC(67637c37) SHA1(7c250e7e9dd5c07da4fa35bacdfcecd5e8fa4ec7) , ROM_SKIP(6)|ROM_GROUPWORD ) - ROMX_LOAD( "epr15028.bin", 0x000006, 0x200000, CRC(9929abdc) SHA1(34b6624ddd3a0aedec0a2b433643a37f745ec66d) , ROM_SKIP(6)|ROM_GROUPWORD ) - ROMX_LOAD( "epr15023.bin", 0x800000, 0x200000, CRC(0e42a2bb) SHA1(503214caf5fa9a2324b61e04f378fd1a790322df) , ROM_SKIP(6)|ROM_GROUPWORD ) - ROMX_LOAD( "epr15025.bin", 0x800002, 0x200000, CRC(0c677fc6) SHA1(fc2207008417072e7ee91f722797d827e150ce2d) , ROM_SKIP(6)|ROM_GROUPWORD ) - ROMX_LOAD( "epr15027.bin", 0x800004, 0x200000, CRC(d6d077f9) SHA1(928cefae9ae58239fbffb1dcee282c6ac1e661fe) , ROM_SKIP(6)|ROM_GROUPWORD ) - ROMX_LOAD( "epr15029.bin", 0x800006, 0x200000, CRC(707af749) SHA1(fae5325c983df3cf198878220ad88d47339ac512) , ROM_SKIP(6)|ROM_GROUPWORD ) + ROMX_LOAD( "epr-15022.bin", 0x000000, 0x200000, CRC(09ca9608) SHA1(cbd0138c1c7811d42b051fed6a7e3526cc4e457f) , ROM_SKIP(6)|ROM_GROUPWORD ) + ROMX_LOAD( "epr-15024.bin", 0x000002, 0x200000, CRC(0dc920eb) SHA1(d24d637aa0dcd3bae779ef7e12663df81667dbf7) , ROM_SKIP(6)|ROM_GROUPWORD ) + ROMX_LOAD( "epr-15026.bin", 0x000004, 0x200000, CRC(67637c37) SHA1(7c250e7e9dd5c07da4fa35bacdfcecd5e8fa4ec7) , ROM_SKIP(6)|ROM_GROUPWORD ) + ROMX_LOAD( "epr-15028.bin", 0x000006, 0x200000, CRC(9929abdc) SHA1(34b6624ddd3a0aedec0a2b433643a37f745ec66d) , ROM_SKIP(6)|ROM_GROUPWORD ) + ROMX_LOAD( "epr-15023.bin", 0x800000, 0x200000, CRC(0e42a2bb) SHA1(503214caf5fa9a2324b61e04f378fd1a790322df) , ROM_SKIP(6)|ROM_GROUPWORD ) + ROMX_LOAD( "epr-15025.bin", 0x800002, 0x200000, CRC(0c677fc6) SHA1(fc2207008417072e7ee91f722797d827e150ce2d) , ROM_SKIP(6)|ROM_GROUPWORD ) + ROMX_LOAD( "epr-15027.bin", 0x800004, 0x200000, CRC(d6d077f9) SHA1(928cefae9ae58239fbffb1dcee282c6ac1e661fe) , ROM_SKIP(6)|ROM_GROUPWORD ) + ROMX_LOAD( "epr-15029.bin", 0x800006, 0x200000, CRC(707af749) SHA1(fae5325c983df3cf198878220ad88d47339ac512) , ROM_SKIP(6)|ROM_GROUPWORD ) ROM_REGION( 0x400000, REGION_SOUND1, 0 ) /* Sega PCM sound data */ /* 1ST AND 2ND HALF IDENTICAL (all roms, are these OK?) */ - ROM_LOAD("epr15031.bin", 0x000000, 0x200000, CRC(663a7fd2) SHA1(b4393a687225b075db21960d19a6ddd7a9d7d086) ) - ROM_LOAD("epr15032.bin", 0x200000, 0x200000, CRC(cb709f3d) SHA1(3962c8b5907d1f8f611f58ddac693cc47364a79c) ) + ROM_LOAD("epr-15031.bin", 0x000000, 0x200000, CRC(663a7fd2) SHA1(b4393a687225b075db21960d19a6ddd7a9d7d086) ) + ROM_LOAD("epr-15032.bin", 0x200000, 0x200000, CRC(cb709f3d) SHA1(3962c8b5907d1f8f611f58ddac693cc47364a79c) ) +ROM_END + +ROM_START( scrossu ) + ROM_REGION( 0x200000, REGION_CPU1, 0 ) /* v60 code */ + ROM_LOAD32_WORD_x2( "epr-15091.bin", 0x000000, 0x040000, CRC(2c572293) SHA1(6377a6eb6084f7332ce6eeaaf0c37200da792d0c) ) + ROM_LOAD32_WORD_x2( "epr-15092.bin", 0x000002, 0x040000, CRC(6e3e175a) SHA1(feaca0720646e2a4b78b376e99dc86788adb98e7) ) + ROM_LOAD32_WORD( "epr-15018.bin", 0x100000, 0x080000, CRC(3a98385e) SHA1(8088d337655030c28e290da4bbf44cb647dab66c) ) + ROM_LOAD32_WORD( "epr-15019.bin", 0x100002, 0x080000, CRC(8bf4ac83) SHA1(e594d9d9b42d0765ed8a20a40b7dd92b75124d34) ) + + ROM_REGION( 0x180000, REGION_CPU2, 0 ) /* sound CPU */ + ROM_LOAD_x4( "epr-15192.bin", 0x100000, 0x20000, CRC(7524290b) SHA1(ee58be2c0c4293ee19622b96ca493f4ce4da0038) ) + + ROM_REGION( 0x400000, REGION_GFX1, ROMREGION_DISPOSE ) /* tiles */ + /* 1ST AND 2ND HALF IDENTICAL (all roms) */ + ROM_LOAD16_BYTE( "epr-15020.bin", 0x000000, 0x200000, CRC(65afea2f) SHA1(ad573727398bfac8e94f321be84b60e5690bfba6) ) + ROM_LOAD16_BYTE( "epr-15021.bin", 0x000001, 0x200000, CRC(27bc6969) SHA1(d6bb446becb2d36b73bca5055357a43b837afc0a) ) + + ROM_REGION32_BE( 0x1000000, REGION_GFX2, 0 ) /* sprites */ + /* 1ST AND 2ND HALF IDENTICAL (all roms) */ + ROMX_LOAD( "epr-15022.bin", 0x000000, 0x200000, CRC(09ca9608) SHA1(cbd0138c1c7811d42b051fed6a7e3526cc4e457f) , ROM_SKIP(6)|ROM_GROUPWORD ) + ROMX_LOAD( "epr-15024.bin", 0x000002, 0x200000, CRC(0dc920eb) SHA1(d24d637aa0dcd3bae779ef7e12663df81667dbf7) , ROM_SKIP(6)|ROM_GROUPWORD ) + ROMX_LOAD( "epr-15026.bin", 0x000004, 0x200000, CRC(67637c37) SHA1(7c250e7e9dd5c07da4fa35bacdfcecd5e8fa4ec7) , ROM_SKIP(6)|ROM_GROUPWORD ) + ROMX_LOAD( "epr-15028.bin", 0x000006, 0x200000, CRC(9929abdc) SHA1(34b6624ddd3a0aedec0a2b433643a37f745ec66d) , ROM_SKIP(6)|ROM_GROUPWORD ) + ROMX_LOAD( "epr-15023.bin", 0x800000, 0x200000, CRC(0e42a2bb) SHA1(503214caf5fa9a2324b61e04f378fd1a790322df) , ROM_SKIP(6)|ROM_GROUPWORD ) + ROMX_LOAD( "epr-15025.bin", 0x800002, 0x200000, CRC(0c677fc6) SHA1(fc2207008417072e7ee91f722797d827e150ce2d) , ROM_SKIP(6)|ROM_GROUPWORD ) + ROMX_LOAD( "epr-15027.bin", 0x800004, 0x200000, CRC(d6d077f9) SHA1(928cefae9ae58239fbffb1dcee282c6ac1e661fe) , ROM_SKIP(6)|ROM_GROUPWORD ) + ROMX_LOAD( "epr-15029.bin", 0x800006, 0x200000, CRC(707af749) SHA1(fae5325c983df3cf198878220ad88d47339ac512) , ROM_SKIP(6)|ROM_GROUPWORD ) + + ROM_REGION( 0x400000, REGION_SOUND1, 0 ) /* Sega PCM sound data */ + /* 1ST AND 2ND HALF IDENTICAL (all roms, are these OK?) */ + ROM_LOAD("epr-15031.bin", 0x000000, 0x200000, CRC(663a7fd2) SHA1(b4393a687225b075db21960d19a6ddd7a9d7d086) ) + ROM_LOAD("epr-15032.bin", 0x200000, 0x200000, CRC(cb709f3d) SHA1(3962c8b5907d1f8f611f58ddac693cc47364a79c) ) ROM_END @@ -4045,5 +4077,6 @@ GAME( 1994, harddunj, harddunk, multi32, harddunk, harddunk, ROT0, "Sega", GAME( 1992, orunners, 0, multi32, orunners, orunners, ROT0, "Sega", "OutRunners (World)", GAME_IMPERFECT_GRAPHICS ) GAME( 1992, orunneru, orunners, multi32, orunners, orunners, ROT0, "Sega", "OutRunners (US)", GAME_IMPERFECT_GRAPHICS ) GAME( 1992, scross, 0, multi32, scross, scross, ROT0, "Sega", "Stadium Cross (World)", GAME_IMPERFECT_GRAPHICS ) +GAME( 1992, scrossu, scross, multi32, scross, scross, ROT0, "Sega", "Stadium Cross (US)", GAME_IMPERFECT_GRAPHICS ) GAME( 1992, titlef, 0, multi32, titlef, titlef, ROT0, "Sega", "Title Fight (World)", GAME_IMPERFECT_GRAPHICS ) GAME( 1992, titlefu, titlef, multi32, titlef, titlef, ROT0, "Sega", "Title Fight (US)", GAME_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/snk.c b/src/mame/drivers/snk.c index 3b0ceb0b53a..ba27ebf7c10 100644 --- a/src/mame/drivers/snk.c +++ b/src/mame/drivers/snk.c @@ -40,7 +40,7 @@ Oct. 5, 2003: Stephh's notes (based on the games Z80 code and some tests) : -1) 'ftsoccer' +1) 'fsoccerb' - The code to support the rotary jotsticks has been removed and/or patched in this version (check the 'jmp' instruction at 0x00f1). @@ -120,8 +120,8 @@ AT08XX03: - revamped CPU handshaking, improved clipping and made changes public to marvins.c, hal21.c and sgladiat.c - fixed shadows in tnk3, athena, fitegolf, countryc, - and ftsoccer - - added highlights to tdfever and ftsoccer(needs masking at team selection) + and fsoccer + - added highlights to tdfever and fsoccer(needs masking at team selection) - notes: Mad Crasher and Gladiator(sgladiat.c) have different memory maps but @@ -466,7 +466,7 @@ static READ8_HANDLER( cpuA_io_r ){ case 0x500: return snk_input_port_r( 9 ); // unused by tdfever case 0x580: return snk_input_port_r( 10 ); // dsw case 0x600: return snk_input_port_r( 11 ); // dsw - case 0x080: return snk_input_port_r( 12 ); // player start (types C and D in 'ftsoccer') + case 0x080: return snk_input_port_r( 12 ); // player start (types C and D in 'fsoccer') case 0x700: return(snk_cpuB_nmi_trigger_r(0)); @@ -1258,7 +1258,7 @@ static MACHINE_DRIVER_START( tdfever2 ) MACHINE_DRIVER_END -static MACHINE_DRIVER_START( ftsoccer ) +static MACHINE_DRIVER_START( fsoccer ) /* basic machine hardware */ MDRV_CPU_ADD(Z80, 4000000) @@ -1272,7 +1272,7 @@ static MACHINE_DRIVER_START( ftsoccer ) MDRV_CPU_ADD(Z80, 4000000) /* audio CPU */ MDRV_CPU_PROGRAM_MAP(Y8950_sound_map, 0) - MDRV_CPU_VBLANK_INT(irq0_line_hold,1) + MDRV_CPU_VBLANK_INT(irq0_line_hold,2) MDRV_SCREEN_REFRESH_RATE(60) MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION) @@ -2665,7 +2665,48 @@ ROM_END /***********************************************************************/ -ROM_START( ftsoccer ) +ROM_START( fsoccer ) + ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64k for cpuA code */ + ROM_LOAD( "fs3_ver4.bin", 0x00000, 0x10000, CRC(94c3f918) SHA1(7c8343556d6c3897e72f8b41c6fbdc5c58e78b8c) ) + + ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for cpuB code */ + ROM_LOAD( "fs1_ver4.bin", 0x00000, 0x10000, CRC(97830108) SHA1(dab241baf8d889c768e1fbe25f1e5059b3cbbab6) ) + + ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* 64k for sound code */ + ROM_LOAD( "fs2.bin", 0x00000, 0x10000, CRC(9ee54ea1) SHA1(4e3bbacaa0e247eb8c4043f394e763817a4f9a28) ) + + ROM_REGION( 0x0c00, REGION_PROMS, 0 ) + ROM_LOAD( "prom2.bin", 0x000, 0x400, CRC(bf4ac706) SHA1(b5015563d88dbd93ba2838f01b189812958f142b) ) /* red */ + ROM_LOAD( "prom1.bin", 0x400, 0x400, CRC(1bac8010) SHA1(16854b1b6f3d1be48a247796d65aeb90547099b6) ) /* green */ + ROM_LOAD( "prom3.bin", 0x800, 0x400, CRC(dbeddb14) SHA1(6053b587a3c8272aefe728a7198a15aa7fb9b2fa) ) /* blue */ + + ROM_REGION( 0x8000, REGION_GFX1, ROMREGION_DISPOSE ) /* characters */ + ROM_LOAD( "fs13.bin", 0x0000, 0x08000, CRC(0de7b7ad) SHA1(4fa54b2acf83f03d09d16fc054ad6623cafe0f4a) ) + + ROM_REGION( 0x50000, REGION_GFX2, ROMREGION_DISPOSE ) /* background tiles */ + ROM_LOAD( "fs14.bin", 0x00000, 0x10000, CRC(38c38b40) SHA1(c4580add0946720441f5ef751d0d4a944cd92ad5) ) + ROM_LOAD( "fs15.bin", 0x10000, 0x10000, CRC(a614834f) SHA1(d73930e4bd780915e1b0d7f3fe7cbeaad19c233f) ) + +// ROM_REGION( 0x40000, REGION_GFX3, ROMREGION_DISPOSE ) /* 16x16 sprites */ + + ROM_REGION( 0x80000, REGION_GFX3, ROMREGION_DISPOSE ) /* 32x32 sprites */ + ROM_LOAD( "fs5.bin", 0x10000, 0x10000, CRC(def2f1d8) SHA1(b72e4dec3306d8afe461ac812b2de67ee85f9dd9) ) + ROM_LOAD( "fs6.bin", 0x00000, 0x10000, CRC(588d14b3) SHA1(c0489b061503677a38e4c5800ea8be17aabf4039) ) + + ROM_LOAD( "fs7.bin", 0x30000, 0x10000, CRC(d584964b) SHA1(7c806fc40dcce700ed0c268abbd2704938b65ff2) ) + ROM_LOAD( "fs8.bin", 0x20000, 0x10000, CRC(11156a7d) SHA1(f298a54fa4c118bf8e7c7cccb6c95a4b97daf4d4) ) + + ROM_LOAD( "fs9.bin", 0x50000, 0x10000, CRC(d8112aa6) SHA1(575dd6dff2f00901603768f2c121eb0ea5afa444) ) + ROM_LOAD( "fs10.bin", 0x40000, 0x10000, CRC(e42864d8) SHA1(fe18f58e5507676780fe181e2fb0e0e9d72e276e) ) + + ROM_LOAD( "fs11.bin", 0x70000, 0x10000, CRC(022f3e96) SHA1(57aa423b8f62015566bc3021300ac7e9682ed500) ) + ROM_LOAD( "fs12.bin", 0x60000, 0x10000, CRC(b2442c30) SHA1(ba9331810659726389494ddc7c94c5a02ba80747) ) + + ROM_REGION( 0x10000, REGION_SOUND1, 0 ) + ROM_LOAD( "fs4.bin", 0x00000, 0x10000, CRC(435c3716) SHA1(42053741f60594e7ae8516b3ba600f5badb3620f) ) +ROM_END + +ROM_START( fsoccerb ) ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64k for cpuA code */ ROM_LOAD( "ft-003.bin", 0x00000, 0x10000, CRC(649d4448) SHA1(876a4cf3ce3211ee19390deb17a661ec52b419d2) ) @@ -2673,7 +2714,7 @@ ROM_START( ftsoccer ) ROM_LOAD( "ft-001.bin", 0x00000, 0x10000, CRC(2f68e38b) SHA1(0cbf2de24a5a5ae2134eb6f1e1404691554192bc) ) ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* 64k for sound code */ - ROM_LOAD( "ft-002.bin", 0x00000, 0x10000, CRC(9ee54ea1) SHA1(4e3bbacaa0e247eb8c4043f394e763817a4f9a28) ) + ROM_LOAD( "fs2.bin", 0x00000, 0x10000, CRC(9ee54ea1) SHA1(4e3bbacaa0e247eb8c4043f394e763817a4f9a28) ) ROM_REGION( 0x0c00, REGION_PROMS, 0 ) ROM_LOAD( "prom2.bin", 0x000, 0x400, CRC(bf4ac706) SHA1(b5015563d88dbd93ba2838f01b189812958f142b) ) /* red */ @@ -2681,29 +2722,29 @@ ROM_START( ftsoccer ) ROM_LOAD( "prom3.bin", 0x800, 0x400, CRC(dbeddb14) SHA1(6053b587a3c8272aefe728a7198a15aa7fb9b2fa) ) /* blue */ ROM_REGION( 0x8000, REGION_GFX1, ROMREGION_DISPOSE ) /* characters */ - ROM_LOAD( "ft-013.bin", 0x0000, 0x08000, CRC(0de7b7ad) SHA1(4fa54b2acf83f03d09d16fc054ad6623cafe0f4a) ) + ROM_LOAD( "fs13.bin", 0x0000, 0x08000, CRC(0de7b7ad) SHA1(4fa54b2acf83f03d09d16fc054ad6623cafe0f4a) ) ROM_REGION( 0x50000, REGION_GFX2, ROMREGION_DISPOSE ) /* background tiles */ - ROM_LOAD( "ft-014.bin", 0x00000, 0x10000, CRC(38c38b40) SHA1(c4580add0946720441f5ef751d0d4a944cd92ad5) ) - ROM_LOAD( "ft-015.bin", 0x10000, 0x10000, CRC(a614834f) SHA1(d73930e4bd780915e1b0d7f3fe7cbeaad19c233f) ) + ROM_LOAD( "fs14.bin", 0x00000, 0x10000, CRC(38c38b40) SHA1(c4580add0946720441f5ef751d0d4a944cd92ad5) ) + ROM_LOAD( "fs15.bin", 0x10000, 0x10000, CRC(a614834f) SHA1(d73930e4bd780915e1b0d7f3fe7cbeaad19c233f) ) // ROM_REGION( 0x40000, REGION_GFX3, ROMREGION_DISPOSE ) /* 16x16 sprites */ ROM_REGION( 0x80000, REGION_GFX3, ROMREGION_DISPOSE ) /* 32x32 sprites */ - ROM_LOAD( "ft-005.bin", 0x10000, 0x10000, CRC(def2f1d8) SHA1(b72e4dec3306d8afe461ac812b2de67ee85f9dd9) ) - ROM_LOAD( "ft-006.bin", 0x00000, 0x10000, CRC(588d14b3) SHA1(c0489b061503677a38e4c5800ea8be17aabf4039) ) + ROM_LOAD( "fs5.bin", 0x10000, 0x10000, CRC(def2f1d8) SHA1(b72e4dec3306d8afe461ac812b2de67ee85f9dd9) ) + ROM_LOAD( "fs6.bin", 0x00000, 0x10000, CRC(588d14b3) SHA1(c0489b061503677a38e4c5800ea8be17aabf4039) ) - ROM_LOAD( "ft-007.bin", 0x30000, 0x10000, CRC(d584964b) SHA1(7c806fc40dcce700ed0c268abbd2704938b65ff2) ) - ROM_LOAD( "ft-008.bin", 0x20000, 0x10000, CRC(11156a7d) SHA1(f298a54fa4c118bf8e7c7cccb6c95a4b97daf4d4) ) + ROM_LOAD( "fs7.bin", 0x30000, 0x10000, CRC(d584964b) SHA1(7c806fc40dcce700ed0c268abbd2704938b65ff2) ) + ROM_LOAD( "fs8.bin", 0x20000, 0x10000, CRC(11156a7d) SHA1(f298a54fa4c118bf8e7c7cccb6c95a4b97daf4d4) ) - ROM_LOAD( "ft-009.bin", 0x50000, 0x10000, CRC(d8112aa6) SHA1(575dd6dff2f00901603768f2c121eb0ea5afa444) ) - ROM_LOAD( "ft-010.bin", 0x40000, 0x10000, CRC(e42864d8) SHA1(fe18f58e5507676780fe181e2fb0e0e9d72e276e) ) + ROM_LOAD( "fs9.bin", 0x50000, 0x10000, CRC(d8112aa6) SHA1(575dd6dff2f00901603768f2c121eb0ea5afa444) ) + ROM_LOAD( "fs10.bin", 0x40000, 0x10000, CRC(e42864d8) SHA1(fe18f58e5507676780fe181e2fb0e0e9d72e276e) ) - ROM_LOAD( "ft-011.bin", 0x70000, 0x10000, CRC(022f3e96) SHA1(57aa423b8f62015566bc3021300ac7e9682ed500) ) - ROM_LOAD( "ft-012.bin", 0x60000, 0x10000, CRC(b2442c30) SHA1(ba9331810659726389494ddc7c94c5a02ba80747) ) + ROM_LOAD( "fs11.bin", 0x70000, 0x10000, CRC(022f3e96) SHA1(57aa423b8f62015566bc3021300ac7e9682ed500) ) + ROM_LOAD( "fs12.bin", 0x60000, 0x10000, CRC(b2442c30) SHA1(ba9331810659726389494ddc7c94c5a02ba80747) ) ROM_REGION( 0x10000, REGION_SOUND1, 0 ) - ROM_LOAD( "ft-004.bin", 0x00000, 0x10000, CRC(435c3716) SHA1(42053741f60594e7ae8516b3ba600f5badb3620f) ) + ROM_LOAD( "fs4.bin", 0x00000, 0x10000, CRC(435c3716) SHA1(42053741f60594e7ae8516b3ba600f5badb3620f) ) ROM_END /***********************************************************************/ @@ -3817,7 +3858,7 @@ static INPUT_PORTS_START( countryc ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END -static INPUT_PORTS_START( ftsoccer ) +static INPUT_PORTS_START( fsoccer ) PORT_START_TAG("IN0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) @@ -4250,7 +4291,7 @@ static const SNK_INPUT_PORT_TYPE choppera_io[SNK_MAX_INPUT_PORTS] = { /* c080 */ SNK_UNUSED }; -static const SNK_INPUT_PORT_TYPE ftsoccer_io[SNK_MAX_INPUT_PORTS] = { +static const SNK_INPUT_PORT_TYPE fsoccer_io[SNK_MAX_INPUT_PORTS] = { /* c000 */ SNK_INP0, /* c100 */ SNK_INP1, SNK_INP2, SNK_INP3, SNK_INP4, /* joy1..joy4 */ /* c300 */ SNK_INP5, SNK_INP6, SNK_INP7, SNK_INP8, /* aim1..aim4 */ @@ -4424,9 +4465,9 @@ static DRIVER_INIT( tdfever2 ){ snk_irq_delay = 1000; } -static DRIVER_INIT( ftsoccer ){ +static DRIVER_INIT( fsoccer ){ snk_sound_busy_bit = 0x08; - snk_io = ftsoccer_io; + snk_io = fsoccer_io; hard_flags = 0; videoram = snk_rambase + 0x800; snk_gamegroup = 7; @@ -4476,7 +4517,7 @@ GAME( 1986, ikarijp, ikari, ikari, ikarijp, ikarijp, ROT270, "SNK", "Ik GAME( 1986, ikarijpb, ikari, ikari, ikarijpb, ikarijpb, ROT270, "bootleg", "Ikari (Japan bootleg)", GAME_NO_COCKTAIL ) GAME( 1986, victroad, 0, victroad, victroad, victroad, ROT270, "SNK", "Victory Road", GAME_NO_COCKTAIL ) GAME( 1986, dogosoke, victroad, victroad, victroad, dogosoke, ROT270, "SNK", "Dogou Souken", GAME_NO_COCKTAIL ) -GAME( 1986, dogosokj, victroad, victroad, dogosokj, dogosoke, ROT270, "bootleg", "Dogou Souken (Joystick bootleg)", GAME_NO_COCKTAIL ) +GAME( 1986, dogosokj, victroad, victroad, dogosokj, dogosoke, ROT270, "bootleg", "Dogou Souken (Joystick hack bootleg)", GAME_NO_COCKTAIL ) GAME( 1987, gwar, 0, gwar, gwar, gwar, ROT270, "SNK", "Guerrilla War (US)", GAME_NO_COCKTAIL ) GAME( 1987, gwarj, gwar, gwar, gwar, gwar, ROT270, "SNK", "Guevara (Japan)", GAME_NO_COCKTAIL ) GAME( 1987, gwara, gwar, gwar, gwar, gwara, ROT270, "SNK", "Guerrilla War (Version 1)", GAME_NO_COCKTAIL ) @@ -4492,6 +4533,8 @@ GAME( 1988, choppera, chopper, chopper1, choppera, choppera, ROT270, "SNK", "Ch GAME( 1988, chopperb, chopper, chopper1, legofair, chopper, ROT270, "SNK", "Chopper I (US set 3)", GAME_NO_COCKTAIL ) GAME( 1988, legofair, chopper, chopper1, legofair, chopper, ROT270, "SNK", "Koukuu Kihei Monogatari - The Legend of Air Cavalry (Japan)", GAME_NO_COCKTAIL ) GAME( 1987, tdfever, 0, tdfever, tdfever, tdfever, ROT270, "SNK", "TouchDown Fever", GAME_NO_COCKTAIL ) -GAME( 1987, tdfeverj, tdfever, tdfever, tdfeverj, tdfever, ROT270, "SNK", "TouchDown Fever (Japan)", GAME_NO_COCKTAIL ) +GAME( 1987, tdfeverj, tdfever, tdfever, tdfeverj, tdfever, ROT270, "SNK", "TouchDown Fever (Japan)", GAME_NO_COCKTAIL ) GAME( 1988, tdfever2, tdfever, tdfever2, tdfever, tdfever2, ROT270, "SNK", "TouchDown Fever 2", GAME_NO_COCKTAIL ) /* upgrade kit for Touchdown Fever */ -GAME( 1988, ftsoccer, 0, ftsoccer, ftsoccer, ftsoccer, ROT0, "SNK", "Fighting Soccer", GAME_NO_COCKTAIL ) +GAME( 1988, fsoccer, 0, fsoccer, fsoccer, fsoccer, ROT0, "SNK", "Fighting Soccer (version 4)", GAME_NO_COCKTAIL ) +GAME( 1988, fsoccerb, fsoccer, fsoccer, fsoccer, fsoccer, ROT0, "bootleg", "Fighting Soccer (joystick hack bootleg)", GAME_NO_COCKTAIL ) + diff --git a/src/mame/drivers/tmaster.c b/src/mame/drivers/tmaster.c index 1dd40619b14..93af06fc573 100644 --- a/src/mame/drivers/tmaster.c +++ b/src/mame/drivers/tmaster.c @@ -33,7 +33,7 @@ To Do: ***************************************************************************/ -int okibank; +static int okibank; static WRITE16_HANDLER( tmaster_oki_bank_w ) { if (ACCESSING_MSB) @@ -55,9 +55,9 @@ static WRITE16_HANDLER( tmaster_oki_bank_w ) ***************************************************************************/ -int touchscreen; +static int touchscreen; -void show_touchscreen(void) +static void show_touchscreen(void) { #ifdef MAME_DEBUG popmessage("% d] %03x %03x - %d",touchscreen,readinputportbytag("TSCREEN_X")&0x1ff,readinputportbytag("TSCREEN_Y"),okibank); @@ -127,9 +127,9 @@ static READ16_HANDLER( tmaster_tscreen_y_lo_r ) { return 0x00; } ***************************************************************************/ static mame_bitmap *tmaster_bitmap[2]; -UINT16 *tmaster_regs; -UINT16 tmaster_color; -UINT16 tmaster_addr; +static UINT16 *tmaster_regs; +static UINT16 tmaster_color; +static UINT16 tmaster_addr; static VIDEO_START( tmaster ) { @@ -235,7 +235,7 @@ static void tmaster_draw(void) } } -WRITE16_HANDLER( tmaster_blitter_w ) +static WRITE16_HANDLER( tmaster_blitter_w ) { COMBINE_DATA( tmaster_regs + offset ); switch (offset*2) @@ -300,7 +300,7 @@ ADDRESS_MAP_END ***************************************************************************/ -INPUT_PORTS_START( tmaster ) +static INPUT_PORTS_START( tmaster ) PORT_START_TAG("TSCREEN_X") PORT_BIT( 0x01ff, 0x100, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1, 0, 0) PORT_SENSITIVITY(35) PORT_KEYDELTA(3) PORT_PLAYER(1) PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_IMPULSE(5) // press diff --git a/src/mame/drivers/turbo.c b/src/mame/drivers/turbo.c index 404267952bf..37125b52732 100644 --- a/src/mame/drivers/turbo.c +++ b/src/mame/drivers/turbo.c @@ -1328,8 +1328,8 @@ ROM_START( buckrog ) ROM_LOAD( "pr-5195.cpu-ic53", 0x0020, 0x0020, CRC(181c6d23) SHA1(4749b205cbaa513ee65a644946235d2cfe275648) ) /* sprite state machine */ ROM_LOAD( "pr-5196.cpu-ic10", 0x0100, 0x0200, CRC(04204bcf) SHA1(5636eb184463ac58fcfd20012d13d14fb0769124) ) /* sprite Y scaling */ ROM_LOAD( "pr-5197.cpu-ic78", 0x0300, 0x0200, CRC(a42674af) SHA1(db3590dd0d0f8a85d4ba32ac4ee33f2f4ee4c348) ) /* video timing */ - ROM_LOAD( "pr-5198.cpu-ic93", 0x0500, 0x0200, CRC(32e74bc8) SHA1(dd2c812efd7b8f6b31a45e698d6453ea6bec132e) ) /* char colortable */ - ROM_LOAD( "pr-5199.cpu-ic95", 0x0700, 0x0400, CRC(45e997a8) SHA1(023703b90b503310351b12157b1e732e61430fa5) ) /* sprite colortable */ + ROM_LOAD( "pr-5198.cpu-ic93", 0x0500, 0x0200, CRC(32e74bc8) SHA1(dd2c812efd7b8f6b31a45e698d6453ea6bec132e) ) /* char color table */ + ROM_LOAD( "pr-5199.cpu-ic95", 0x0700, 0x0400, CRC(45e997a8) SHA1(023703b90b503310351b12157b1e732e61430fa5) ) /* sprite color table */ ROM_END @@ -1366,8 +1366,8 @@ ROM_START( buckrogn ) ROM_LOAD( "pr-5195.cpu-ic53", 0x0020, 0x0020, CRC(181c6d23) SHA1(4749b205cbaa513ee65a644946235d2cfe275648) ) /* sprite state machine */ ROM_LOAD( "pr-5196.cpu-ic10", 0x0100, 0x0200, CRC(04204bcf) SHA1(5636eb184463ac58fcfd20012d13d14fb0769124) ) /* sprite Y scaling */ ROM_LOAD( "pr-5197.cpu-ic78", 0x0300, 0x0200, CRC(a42674af) SHA1(db3590dd0d0f8a85d4ba32ac4ee33f2f4ee4c348) ) /* video timing */ - ROM_LOAD( "pr-5198.cpu-ic93", 0x0500, 0x0200, CRC(32e74bc8) SHA1(dd2c812efd7b8f6b31a45e698d6453ea6bec132e) ) /* char colortable */ - ROM_LOAD( "pr-5199.cpu-ic95", 0x0700, 0x0400, CRC(45e997a8) SHA1(023703b90b503310351b12157b1e732e61430fa5) ) /* sprite colortable */ + ROM_LOAD( "pr-5198.cpu-ic93", 0x0500, 0x0200, CRC(32e74bc8) SHA1(dd2c812efd7b8f6b31a45e698d6453ea6bec132e) ) /* char color table */ + ROM_LOAD( "pr-5199.cpu-ic95", 0x0700, 0x0400, CRC(45e997a8) SHA1(023703b90b503310351b12157b1e732e61430fa5) ) /* sprite color table */ ROM_END @@ -1404,8 +1404,8 @@ ROM_START( zoom909 ) ROM_LOAD( "pr-5195.cpu-ic53", 0x0020, 0x0020, CRC(181c6d23) SHA1(4749b205cbaa513ee65a644946235d2cfe275648) ) /* sprite state machine */ ROM_LOAD( "pr-5196.cpu-ic10", 0x0100, 0x0200, CRC(04204bcf) SHA1(5636eb184463ac58fcfd20012d13d14fb0769124) ) /* sprite Y scaling */ ROM_LOAD( "pr-5197.cpu-ic78", 0x0300, 0x0200, CRC(a42674af) SHA1(db3590dd0d0f8a85d4ba32ac4ee33f2f4ee4c348) ) /* video timing */ - ROM_LOAD( "pr-5198.cpu-ic93", 0x0500, 0x0200, CRC(32e74bc8) SHA1(dd2c812efd7b8f6b31a45e698d6453ea6bec132e) ) /* char colortable */ - ROM_LOAD( "pr-5199.cpu-ic95", 0x0700, 0x0400, BAD_DUMP CRC(45e997a8) SHA1(023703b90b503310351b12157b1e732e61430fa5) ) /* sprite colortable */ + ROM_LOAD( "pr-5198.cpu-ic93", 0x0500, 0x0200, CRC(32e74bc8) SHA1(dd2c812efd7b8f6b31a45e698d6453ea6bec132e) ) /* char color table */ + ROM_LOAD( "pr-5199.cpu-ic95", 0x0700, 0x0400, BAD_DUMP CRC(45e997a8) SHA1(023703b90b503310351b12157b1e732e61430fa5) ) /* sprite color table */ ROM_END diff --git a/src/mame/drivers/vamphalf.c b/src/mame/drivers/vamphalf.c index 50bac977ec8..c9c3d6ea45c 100644 --- a/src/mame/drivers/vamphalf.c +++ b/src/mame/drivers/vamphalf.c @@ -583,7 +583,7 @@ ADDRESS_MAP_END static MACHINE_DRIVER_START( common ) MDRV_CPU_ADD_TAG("main", E116T, 50000000) /* 50 MHz */ MDRV_CPU_PROGRAM_MAP(common_map,0) - MDRV_CPU_VBLANK_INT(irq4_line_pulse, 1) + MDRV_CPU_VBLANK_INT(irq1_line_hold, 1) MDRV_SCREEN_REFRESH_RATE(60) MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) @@ -656,7 +656,7 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( wyvernwg ) MDRV_IMPORT_FROM(common) - MDRV_CPU_REPLACE("main", E132XT, 50000000) /* 50 MHz */ + MDRV_CPU_REPLACE("main", E132T, 50000000) /* 50 MHz */ MDRV_CPU_PROGRAM_MAP(common_32bit_map,0) MDRV_CPU_IO_MAP(wyvernwg_io,0) @@ -665,7 +665,7 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( finalgdr ) MDRV_IMPORT_FROM(common) - MDRV_CPU_REPLACE("main", E132XT, 50000000) /* 50 MHz */ + MDRV_CPU_REPLACE("main", E132T, 50000000) /* 50 MHz */ MDRV_CPU_PROGRAM_MAP(common_32bit_map,0) MDRV_CPU_IO_MAP(finalgdr_io,0) diff --git a/src/mame/includes/amiga.h b/src/mame/includes/amiga.h index 9b4b56d0e17..85131bec248 100644 --- a/src/mame/includes/amiga.h +++ b/src/mame/includes/amiga.h @@ -394,6 +394,8 @@ void amiga_add_autoconfig(amiga_autoconfig_device *device); READ16_HANDLER( amiga_autoconfig_r ); WRITE16_HANDLER( amiga_autoconfig_w ); +const amiga_machine_interface *amiga_get_interface(void); + /*----------- defined in audio/amiga.c -----------*/ diff --git a/src/mame/includes/exidy.h b/src/mame/includes/exidy.h index cb79e9a8c34..5c450ac3235 100644 --- a/src/mame/includes/exidy.h +++ b/src/mame/includes/exidy.h @@ -52,23 +52,13 @@ WRITE8_HANDLER( targ_sh_w ); /*----------- defined in video/exidy.c -----------*/ -#define PALETTE_LEN 8 -#define COLORTABLE_LEN 20 - extern UINT8 *exidy_characterram; -extern UINT8 *exidy_palette; -extern UINT16 *exidy_colortable; - -extern UINT8 sidetrac_palette[]; -extern UINT8 targ_palette[]; -extern UINT8 spectar_palette[]; -extern UINT16 exidy_1bpp_colortable[]; -extern UINT16 exidy_2bpp_colortable[]; extern UINT8 exidy_collision_mask; extern UINT8 exidy_collision_invert; -PALETTE_INIT( exidy ); +extern UINT8 exidy_color_latch[3]; + VIDEO_START( exidy ); VIDEO_EOF( exidy ); VIDEO_UPDATE( exidy ); diff --git a/src/mame/includes/firetrk.h b/src/mame/includes/firetrk.h index 1dec7c0b3f9..6d6d99d6354 100644 --- a/src/mame/includes/firetrk.h +++ b/src/mame/includes/firetrk.h @@ -38,6 +38,9 @@ Atari Fire Truck + Super Bug + Monte Carlo driver extern int firetrk_game; +extern UINT32 firetrk_color1_mask; +extern UINT32 firetrk_color2_mask; + /*----------- defined in audio/firetrk.c -----------*/ diff --git a/src/mame/machine/amiga.c b/src/mame/machine/amiga.c index 27fdd27cb0a..8194a4943f3 100644 --- a/src/mame/machine/amiga.c +++ b/src/mame/machine/amiga.c @@ -1759,3 +1759,16 @@ WRITE16_HANDLER( amiga_autoconfig_w ) cur_autoconfig = cur_autoconfig->next; } } + + + +/************************************* + * + * Get interface + * + *************************************/ + +const amiga_machine_interface *amiga_get_interface(void) +{ + return amiga_intf; +} diff --git a/src/mame/machine/fddebug.c b/src/mame/machine/fddebug.c index d05c9f6e722..97492224916 100644 --- a/src/mame/machine/fddebug.c +++ b/src/mame/machine/fddebug.c @@ -258,7 +258,7 @@ static void (*key_changed)(void); static void set_default_key_params(void); static void load_overlay_file(void); static void save_overlay_file(void); -void fd1094_regenerate_key(void); +static void fd1094_regenerate_key(void); static int instruction_hook(offs_t curpc); diff --git a/src/mame/machine/kaneko16.c b/src/mame/machine/kaneko16.c index bf3b6657df2..76abb8920ee 100644 --- a/src/mame/machine/kaneko16.c +++ b/src/mame/machine/kaneko16.c @@ -311,7 +311,7 @@ CALC3_MCU_COM_W(3) - Supply code snippets to the 68000 */ -void calc3_mcu_run(void) +static void calc3_mcu_run(void) { UINT16 mcu_command; diff --git a/src/mame/machine/scudsp.c b/src/mame/machine/scudsp.c index 6311b08f149..7f7320961a7 100644 --- a/src/mame/machine/scudsp.c +++ b/src/mame/machine/scudsp.c @@ -1243,7 +1243,7 @@ static void dsp_dasm_dma( UINT32 op, char* buffer ) dsp_dasm_prefix( DMA_Command[(op & 0x3000) >> 12], buffer, data ); } -void dsp_dasm_opcode( UINT32 op, char *buffer ) +static void dsp_dasm_opcode( UINT32 op, char *buffer ) { switch( (op & 0xc0000000) >> 30 ) { diff --git a/src/mame/mamedriv.c b/src/mame/mamedriv.c index f4264151b1f..6ce3ef4f716 100644 --- a/src/mame/mamedriv.c +++ b/src/mame/mamedriv.c @@ -3632,6 +3632,7 @@ Sep.1994 Quiz Ghost Hunter DRIVER( titlef ) /* (c) 1992 (World) */ DRIVER( titlefu ) /* (c) 1992 (US) */ DRIVER( scross ) /* (c) 1992 (World) */ + DRIVER( scrossu ) /* (c) 1992 (World) */ /* Model 1 Games */ DRIVER( vf ) /* (c) 1993 */ @@ -5367,7 +5368,8 @@ BOMULEUL CHAJARA SEGA ST-V 1997/04/11 DRIVER( choppera ) /* A7003 'KK' (c) 1988 */ DRIVER( chopperb ) /* A7003 'KK' (c) 1988 */ DRIVER( legofair ) /* A7003 'KK' (c) 1988 */ - DRIVER( ftsoccer ) /* (c) 1988 */ + DRIVER( fsoccer ) /* A6006 'FS' (c) 1988 */ + DRIVER( fsoccerb ) /* (c) 1988 */ DRIVER( tdfever ) /* A6006 'TD' (c) 1987 */ DRIVER( tdfeverj ) /* A6006 'TD' (c) 1987 */ DRIVER( tdfever2 ) /* A6006 'TD'?(c) 1988 */ diff --git a/src/mame/video/bankp.c b/src/mame/video/bankp.c index ba2ce02cc51..94209252549 100644 --- a/src/mame/video/bankp.c +++ b/src/mame/video/bankp.c @@ -15,7 +15,6 @@ static int scroll_x; static int priority; static tilemap *bg_tilemap, *fg_tilemap; -static colortable *bankp_colortable; /*************************************************************************** @@ -43,11 +42,9 @@ static colortable *bankp_colortable; PALETTE_INIT( bankp ) { int i; - #define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity) - #define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs]) /* allocate the colortable */ - bankp_colortable = colortable_alloc(machine, 32); + machine->colortable = colortable_alloc(machine, 32); for (i = 0;i < 32;i++) { @@ -69,7 +66,7 @@ PALETTE_INIT( bankp ) bit2 = (*color_prom >> 7) & 0x01; b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - colortable_palette_set_color(bankp_colortable,i,MAKE_RGB(r,g,b)); + colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b)); color_prom++; } @@ -78,13 +75,13 @@ PALETTE_INIT( bankp ) /* charset #1 lookup table */ for (i = 0;i < machine->gfx[0]->total_colors * machine->gfx[0]->color_granularity;i++) - colortable_entry_set_value(bankp_colortable, machine->gfx[0]->color_base + i, *color_prom++ & 0x0f); + colortable_entry_set_value(machine->colortable, machine->gfx[0]->color_base + i, *color_prom++ & 0x0f); color_prom += 128; /* skip the bottom half of the PROM - seems to be not used */ /* charset #2 lookup table */ for (i = 0;i < machine->gfx[1]->total_colors * machine->gfx[1]->color_granularity;i++) - colortable_entry_set_value(bankp_colortable, machine->gfx[1]->color_base + i, *color_prom++ & 0x0f); + colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + i, *color_prom++ & 0x0f); /* the bottom half of the PROM seems to be not used */ } @@ -163,8 +160,8 @@ VIDEO_START( bankp ) fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 32, 32); - colortable_configure_tilemap_groups(bankp_colortable, bg_tilemap, machine->gfx[1], 0); - colortable_configure_tilemap_groups(bankp_colortable, fg_tilemap, machine->gfx[0], 0); + colortable_configure_tilemap_groups(machine->colortable, bg_tilemap, machine->gfx[1], 0); + colortable_configure_tilemap_groups(machine->colortable, fg_tilemap, machine->gfx[0], 0); } VIDEO_UPDATE( bankp ) diff --git a/src/mame/video/bosco.c b/src/mame/video/bosco.c index c9ecab69210..2fdb124368d 100644 --- a/src/mame/video/bosco.c +++ b/src/mame/video/bosco.c @@ -26,14 +26,12 @@ UINT8 *bosco_videoram; UINT8 *bosco_radarattr; static UINT8 *bosco_radarx,*bosco_radary; -static colortable *bosco_colortable; - PALETTE_INIT( bosco ) { int i; - bosco_colortable = colortable_alloc(machine, 32+64); + machine->colortable = colortable_alloc(machine, 32+64); /* core palette */ for (i = 0;i < 32;i++) @@ -54,7 +52,7 @@ PALETTE_INIT( bosco ) bit2 = ((*color_prom) >> 7) & 0x01; b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - colortable_palette_set_color(bosco_colortable,i,MAKE_RGB(r,g,b)); + colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b)); color_prom++; } @@ -71,24 +69,24 @@ PALETTE_INIT( bosco ) bits = (i >> 4) & 0x03; b = map[bits]; - colortable_palette_set_color(bosco_colortable,32 + i,MAKE_RGB(r,g,b)); + colortable_palette_set_color(machine->colortable,32 + i,MAKE_RGB(r,g,b)); } /* characters / sprites */ for (i = 0;i < 64*4;i++) { - colortable_entry_set_value(bosco_colortable, i, (color_prom[i] & 0x0f) + 0x10); /* chars */ - colortable_entry_set_value(bosco_colortable, i+64*4, color_prom[i] & 0x0f); /* sprites */ + colortable_entry_set_value(machine->colortable, i, (color_prom[i] & 0x0f) + 0x10); /* chars */ + colortable_entry_set_value(machine->colortable, i+64*4, color_prom[i] & 0x0f); /* sprites */ } /* bullets lookup table */ /* they use colors 28-31, I think - PAL 5A controls it */ for (i = 0;i < 4;i++) - colortable_entry_set_value(bosco_colortable, 64*4+64*4+i, 31-i); + colortable_entry_set_value(machine->colortable, 64*4+64*4+i, 31-i); /* now the stars */ for (i = 0;i < 64;i++) - colortable_entry_set_value(bosco_colortable, 64*4+64*4+4+i, 32 + i); + colortable_entry_set_value(machine->colortable, 64*4+64*4+4+i, 32 + i); } @@ -141,8 +139,8 @@ VIDEO_START( bosco ) bg_tilemap = tilemap_create(bg_get_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32); fg_tilemap = tilemap_create(fg_get_tile_info,fg_tilemap_scan, TILEMAP_TYPE_PEN,8,8, 8,32); - colortable_configure_tilemap_groups(bosco_colortable, bg_tilemap, machine->gfx[0], 0x1f); - colortable_configure_tilemap_groups(bosco_colortable, fg_tilemap, machine->gfx[0], 0x1f); + colortable_configure_tilemap_groups(machine->colortable, bg_tilemap, machine->gfx[0], 0x1f); + colortable_configure_tilemap_groups(machine->colortable, fg_tilemap, machine->gfx[0], 0x1f); tilemap_set_scrolldx(bg_tilemap,3,3); @@ -232,7 +230,7 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re flipx,flipy, sx,sy, cliprect,TRANSPARENCY_PENS, - colortable_get_transpen_mask(bosco_colortable, machine->gfx[1], color, 0x0f)); + colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0x0f)); } } diff --git a/src/mame/video/canyon.c b/src/mame/video/canyon.c index 8055c34ff60..e9c13df71f7 100644 --- a/src/mame/video/canyon.c +++ b/src/mame/video/canyon.c @@ -77,7 +77,7 @@ static void draw_bombs(mame_bitmap *bitmap, const rectangle* cliprect) if (rect.max_x > cliprect->max_x) rect.max_x = cliprect->max_x; if (rect.max_y > cliprect->max_y) rect.max_y = cliprect->max_y; - fillbitmap(bitmap, i, &rect); + fillbitmap(bitmap, 1 + 2 * i, &rect); } } diff --git a/src/mame/video/decocass.c b/src/mame/video/decocass.c index 6358610388f..04329dd08b3 100644 --- a/src/mame/video/decocass.c +++ b/src/mame/video/decocass.c @@ -208,7 +208,7 @@ WRITE8_HANDLER( decocass_paletteram_w ) * (ME/ input on 1st paletteram, inverter -> ME/ on 2nd) */ offset = (offset & 31) ^ 16; - paletteram_BBGGGRRR_w( offset, ~data ); + colortable_palette_set_color(Machine->colortable, offset, MAKE_RGB(pal3bit(~data >> 0), pal3bit(~data >> 3), pal2bit(~data >> 6))); } WRITE8_HANDLER( decocass_charram_w ) diff --git a/src/mame/video/digdug.c b/src/mame/video/digdug.c index ca9654a6ada..59b8db0cbac 100644 --- a/src/mame/video/digdug.c +++ b/src/mame/video/digdug.c @@ -9,8 +9,6 @@ static tilemap *bg_tilemap,*tx_tilemap; static INT32 bg_select, tx_color_mode, bg_disable, bg_color_bank; -static colortable *digdug_colortable; - /*************************************************************************** @@ -35,7 +33,7 @@ PALETTE_INIT( digdug ) { int i; - digdug_colortable = colortable_alloc(machine, 32); + machine->colortable = colortable_alloc(machine, 32); for (i = 0;i < 32;i++) { @@ -53,24 +51,24 @@ PALETTE_INIT( digdug ) bit1 = (*color_prom >> 6) & 0x01; bit2 = (*color_prom >> 7) & 0x01; b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - colortable_palette_set_color(digdug_colortable,i,MAKE_RGB(r,g,b)); + colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b)); color_prom++; } /* characters - direct mapping */ for (i = 0; i < 16; i++) { - colortable_entry_set_value(digdug_colortable, i*2+0, 0); - colortable_entry_set_value(digdug_colortable, i*2+1, i); + colortable_entry_set_value(machine->colortable, i*2+0, 0); + colortable_entry_set_value(machine->colortable, i*2+1, i); } /* sprites */ for (i = 0;i < 0x100;i++) - colortable_entry_set_value(digdug_colortable, 16*2+i, (*color_prom++ & 0x0f) + 0x10); + colortable_entry_set_value(machine->colortable, 16*2+i, (*color_prom++ & 0x0f) + 0x10); /* bg_select */ for (i = 0;i < 0x100;i++) - colortable_entry_set_value(digdug_colortable, 16*2+256+i, *color_prom++ & 0x0f); + colortable_entry_set_value(machine->colortable, 16*2+256+i, *color_prom++ & 0x0f); } @@ -292,7 +290,7 @@ static void draw_sprites(running_machine* machine, mame_bitmap *bitmap, const re { for (x = 0;x <= size;x++) { - UINT32 transmask = colortable_get_transpen_mask(digdug_colortable, machine->gfx[1], color, 0x1f); + UINT32 transmask = colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0x1f); drawgfx(bitmap,machine->gfx[1], sprite + gfx_offs[y ^ (size * flipy)][x ^ (size * flipx)], color, diff --git a/src/mame/video/equites.c b/src/mame/video/equites.c index 06782a87cd8..eec3eb00ada 100644 --- a/src/mame/video/equites.c +++ b/src/mame/video/equites.c @@ -34,7 +34,6 @@ static int scrollx, scrolly; static int bgcolor[4]; static rectangle halfclip; static struct PRESTEP_TYPE { unsigned sy, fdx; } *prestep; -static colortable *equites_colortable; /******************************************************************************/ // Exports @@ -78,17 +77,17 @@ PALETTE_INIT( equites ) UINT8 *clut_ptr; int i; - equites_colortable = colortable_alloc(machine, 256); + machine->colortable = colortable_alloc(machine, 256); for (i=0; i<256; i++) - colortable_palette_set_color(equites_colortable, i, MAKE_RGB(pal4bit(color_prom[i]), pal4bit(color_prom[i+0x100]), pal4bit(color_prom[i+0x200]))); + colortable_palette_set_color(machine->colortable, i, MAKE_RGB(pal4bit(color_prom[i]), pal4bit(color_prom[i+0x100]), pal4bit(color_prom[i+0x200]))); for (i=0; i<256; i++) - colortable_entry_set_value(equites_colortable, i, i); + colortable_entry_set_value(machine->colortable, i, i); clut_ptr = memory_region(REGION_USER1) + 0x80; for (i=0; i<128; i++) - colortable_entry_set_value(equites_colortable, i+0x100, clut_ptr[i]); + colortable_entry_set_value(machine->colortable, i+0x100, clut_ptr[i]); } static TILE_GET_INFO( equites_charinfo ) @@ -120,24 +119,24 @@ PALETTE_INIT( splndrbt ) UINT8 *prom_ptr; int i; - equites_colortable = colortable_alloc(machine, 256); + machine->colortable = colortable_alloc(machine, 256); for (i=0; i<0x100; i++) - colortable_palette_set_color(equites_colortable, i, MAKE_RGB(pal4bit(color_prom[i]), pal4bit(color_prom[i+0x100]), pal4bit(color_prom[i+0x200]))); + colortable_palette_set_color(machine->colortable, i, MAKE_RGB(pal4bit(color_prom[i]), pal4bit(color_prom[i+0x100]), pal4bit(color_prom[i+0x200]))); for (i = 0; i < 0x100; i++) - colortable_entry_set_value(equites_colortable, i, i); + colortable_entry_set_value(machine->colortable, i, i); prom_ptr = memory_region(REGION_USER1); for (i=0; i<0x80; i++) { - colortable_entry_set_value(equites_colortable, i + 0x100, prom_ptr[i] + 0x10); - colortable_entry_set_value(equites_colortable, i + 0x180, prom_ptr[i]); + colortable_entry_set_value(machine->colortable, i + 0x100, prom_ptr[i] + 0x10); + colortable_entry_set_value(machine->colortable, i + 0x180, prom_ptr[i]); } prom_ptr += 0x100; for (i=0; i<0x400; i++) - colortable_entry_set_value(equites_colortable, i + 0x200, prom_ptr[i]); + colortable_entry_set_value(machine->colortable, i + 0x200, prom_ptr[i]); } static TILE_GET_INFO( splndrbt_char0info ) @@ -276,7 +275,7 @@ static void equites_update_clut(running_machine *machine) c = *bgcolor; for (i=0x80; i<0x100; i+=0x08) - colortable_entry_set_value(equites_colortable, i, c); + colortable_entry_set_value(machine->colortable, i, c); } static void equites_draw_scroll(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) @@ -398,7 +397,7 @@ static void splndrbt_update_clut(running_machine *machine) switch(equites_id) { case 0x8511: - colortable_entry_set_value(equites_colortable, 0x114, c); + colortable_entry_set_value(machine->colortable, 0x114, c); break; } } diff --git a/src/mame/video/exidy.c b/src/mame/video/exidy.c index a72cb0ea231..f2fd7f21302 100644 --- a/src/mame/video/exidy.c +++ b/src/mame/video/exidy.c @@ -12,9 +12,6 @@ UINT8 *exidy_characterram; UINT8 exidy_collision_mask; UINT8 exidy_collision_invert; -UINT8 *exidy_palette; -UINT16 *exidy_colortable; - static mame_bitmap *motion_object_1_vid; static mame_bitmap *motion_object_2_vid; static mame_bitmap *motion_object_2_clip; @@ -31,118 +28,7 @@ static UINT8 sprite1_ypos; static UINT8 sprite2_xpos; static UINT8 sprite2_ypos; -static UINT8 color_latch[3]; - - - -/************************************* - * - * Hard coded palettes - * - *************************************/ - -/* Sidetrack/Targ/Spectar don't have a color PROM; colors are changed by the means of 8x3 */ -/* dip switches on the board. Here are the colors they map to. */ -UINT8 sidetrac_palette[PALETTE_LEN*3] = -{ - 0x00,0x00,0x00, /* BACKGND */ - 0x00,0x00,0x00, /* CSPACE0 */ - 0x00,0xff,0x00, /* CSPACE1 */ - 0xff,0xff,0xff, /* CSPACE2 */ - 0xff,0xff,0xff, /* CSPACE3 */ - 0xff,0x00,0xff, /* 5LINES (unused?) */ - 0xff,0xff,0x00, /* 5MO2VID */ - 0xff,0xff,0xff /* 5MO1VID */ -}; - -/* Targ has different colors */ -UINT8 targ_palette[PALETTE_LEN*3] = -{ - /* color use */ - 0x00,0x00,0xff, /* blue background */ - 0x00,0xff,0xff, /* cyan characters 192-255 */ - 0xff,0xff,0x00, /* yellow characters 128-191 */ - 0xff,0xff,0xff, /* white characters 64-127 */ - 0xff,0x00,0x00, /* red characters 0- 63 */ - 0x00,0xff,0xff, /* cyan not used */ - 0xff,0xff,0xff, /* white bullet sprite */ - 0x00,0xff,0x00, /* green wummel sprite */ -}; - -/* Spectar has different colors */ -UINT8 spectar_palette[PALETTE_LEN*3] = -{ - /* color use */ - 0x00,0x00,0xff, /* blue background */ - 0x00,0xff,0x00, /* green characters 192-255 */ - 0x00,0xff,0x00, /* green characters 128-191 */ - 0xff,0xff,0xff, /* white characters 64-127 */ - 0xff,0x00,0x00, /* red characters 0- 63 */ - 0x00,0xff,0x00, /* green not used */ - 0xff,0xff,0x00, /* yellow bullet sprite */ - 0x00,0xff,0x00, /* green wummel sprite */ -}; - - - -/************************************* - * - * Hard coded color tables - * - *************************************/ - -UINT16 exidy_1bpp_colortable[COLORTABLE_LEN] = -{ - /* one-bit characters */ - 0, 4, /* chars 0x00-0x3F */ - 0, 3, /* chars 0x40-0x7F */ - 0, 2, /* chars 0x80-0xBF */ - 0, 1, /* chars 0xC0-0xFF */ - - /* Motion Object 1 */ - 0, 7, - - /* Motion Object 2 */ - 0, 6, -}; - -UINT16 exidy_2bpp_colortable[COLORTABLE_LEN] = -{ - /* two-bit characters */ - /* (Because this is 2-bit color, the colorspace is only divided - in half instead of in quarters. That's why 00-3F = 40-7F and - 80-BF = C0-FF) */ - 0, 0, 4, 3, /* chars 0x00-0x3F */ - 0, 0, 4, 3, /* chars 0x40-0x7F */ - 0, 0, 2, 1, /* chars 0x80-0xBF */ - 0, 0, 2, 1, /* chars 0xC0-0xFF */ - - /* Motion Object 1 */ - 0, 7, - - /* Motion Object 2 */ - 0, 6, -}; - - - -/************************************* - * - * Palettes and colors - * - *************************************/ - -PALETTE_INIT( exidy ) -{ - if (exidy_palette) - { - int i; - - for (i = 0; i < PALETTE_LEN; i++) - palette_set_color_rgb(machine,i,exidy_palette[i*3+0],exidy_palette[i*3+1],exidy_palette[i*3+2]); - } - memcpy(colortable, exidy_colortable, COLORTABLE_LEN * sizeof(colortable[0])); -} +UINT8 exidy_color_latch[3]; @@ -159,6 +45,10 @@ VIDEO_START( exidy ) motion_object_1_vid = auto_bitmap_alloc(16, 16, machine->screen[0].format); motion_object_2_vid = auto_bitmap_alloc(16, 16, machine->screen[0].format); motion_object_2_clip = auto_bitmap_alloc(16, 16, machine->screen[0].format); + + exidy_color_w(0, exidy_color_latch[0]); + exidy_color_w(1, exidy_color_latch[1]); + exidy_color_w(2, exidy_color_latch[2]); } @@ -232,14 +122,56 @@ WRITE8_HANDLER( exidy_characterram_w ) * *************************************/ +INLINE void set_1_color(int index, int palette) +{ + palette_set_color_rgb(Machine, index, pal1bit(exidy_color_latch[2] >> palette), pal1bit(exidy_color_latch[1] >> palette), pal1bit(exidy_color_latch[0] >> palette)); +} + WRITE8_HANDLER( exidy_color_w ) { - int i; + exidy_color_latch[offset] = data; + + /* motion object 1 */ + set_1_color(0, 0); + set_1_color(1, 7); - color_latch[offset] = data; + /* motion object 2 */ + set_1_color(2, 0); + set_1_color(3, 6); + + /* one-bit characters */ + if (Machine->gfx[0]->color_granularity == 2) + { + set_1_color(4, 0); /* chars 0x00-0x3F */ + set_1_color(5, 4); + set_1_color(6, 0); /* chars 0x40-0x7F */ + set_1_color(7, 3); + set_1_color(8, 0); /* chars 0x80-0xBF */ + set_1_color(9, 2); + set_1_color(10, 0); /* chars 0xC0-0xFF */ + set_1_color(11, 1); + } - for (i = 0; i < 8; i++) - palette_set_color_rgb(Machine, i, pal1bit(color_latch[2] >> i), pal1bit(color_latch[1] >> i), pal1bit(color_latch[0] >> i)); + /* two-bit characters */ + else + { + set_1_color(4, 0); /* chars 0x00-0x3F */ + set_1_color(5, 0); + set_1_color(6, 4); + set_1_color(7, 3); + set_1_color(8, 0); /* chars 0x40-0x7F */ + set_1_color(9, 0); + set_1_color(10, 4); + set_1_color(11, 3); + set_1_color(12, 0); /* chars 0x80-0xBF */ + set_1_color(13, 0); + set_1_color(14, 2); + set_1_color(15, 1); + set_1_color(16, 0); /* chars 0xC0-0xFF */ + set_1_color(17, 0); + set_1_color(18, 2); + set_1_color(19, 1); + } } @@ -367,7 +299,7 @@ VIDEO_EOF( exidy ) { UINT8 enable_set = ((sprite_enable & 0x20) != 0); static const rectangle clip = { 0, 15, 0, 15 }; - int pen0 = machine->pens[0]; + int bgmask = machine->gfx[0]->color_granularity - 1; int org_1_x = 0, org_1_y = 0; int org_2_x = 0, org_2_y = 0; int sx, sy; @@ -390,64 +322,62 @@ VIDEO_EOF( exidy ) update_complete = 0; /* draw sprite 1 */ + fillbitmap(motion_object_1_vid, 0xff, &clip); if (sprite_1_enabled()) { org_1_x = 236 - sprite1_xpos - 4; org_1_y = 244 - sprite1_ypos - 4; drawgfx(motion_object_1_vid, machine->gfx[1], (spriteno & 0x0f) + 16 * enable_set, 0, - 0, 0, 0, 0, &clip, TRANSPARENCY_NONE, 0); + 0, 0, 0, 0, &clip, TRANSPARENCY_PEN, 0); } - else - fillbitmap(motion_object_1_vid, pen0, &clip); /* draw sprite 2 */ + fillbitmap(motion_object_2_vid, 0xff, &clip); if (sprite_2_enabled()) { org_2_x = 236 - sprite2_xpos - 4; org_2_y = 244 - sprite2_ypos - 4; drawgfx(motion_object_2_vid, machine->gfx[1], ((spriteno >> 4) & 0x0f) + 32, 0, - 0, 0, 0, 0, &clip, TRANSPARENCY_NONE, 0); + 0, 0, 0, 0, &clip, TRANSPARENCY_PEN, 0); } - else - fillbitmap(motion_object_2_vid, pen0, &clip); /* draw sprite 2 clipped to sprite 1's location */ - fillbitmap(motion_object_2_clip, pen0, &clip); + fillbitmap(motion_object_2_clip, 0xff, &clip); if (sprite_1_enabled() && sprite_2_enabled()) { sx = org_2_x - org_1_x; sy = org_2_y - org_1_y; drawgfx(motion_object_2_clip, machine->gfx[1], ((spriteno >> 4) & 0x0f) + 32, 0, - 0, 0, sx, sy, &clip, TRANSPARENCY_NONE, 0); + 0, 0, sx, sy, &clip, TRANSPARENCY_PEN, 0); } /* scan for collisions */ for (sy = 0; sy < 16; sy++) for (sx = 0; sx < 16; sx++) { - if (*BITMAP_ADDR16(motion_object_1_vid, sy, sx) != pen0) + if (*BITMAP_ADDR16(motion_object_1_vid, sy, sx) != 0xff) { UINT8 collision_mask = 0; /* check for background collision (M1CHAR) */ - if (*BITMAP_ADDR16(tmpbitmap, org_1_y + sy, org_1_x + sx) != pen0) + if (((*BITMAP_ADDR16(tmpbitmap, org_1_y + sy, org_1_x + sx) - 4) & bgmask) != 0) collision_mask |= 0x04; /* check for motion object collision (M1M2) */ - if (*BITMAP_ADDR16(motion_object_2_clip, sy, sx) != pen0) + if (*BITMAP_ADDR16(motion_object_2_clip, sy, sx) != 0xff) collision_mask |= 0x10; /* if we got one, trigger an interrupt */ if ((collision_mask & exidy_collision_mask) && count++ < 128) timer_set(video_screen_get_time_until_pos(0, org_1_x + sx, org_1_y + sy), collision_mask, collision_irq_callback); } - if (*BITMAP_ADDR16(motion_object_2_vid, sy, sx) != pen0) + if (*BITMAP_ADDR16(motion_object_2_vid, sy, sx) != 0xff) { /* check for background collision (M2CHAR) */ - if (*BITMAP_ADDR16(tmpbitmap, org_2_y + sy, org_2_x + sx) != pen0) + if (((*BITMAP_ADDR16(tmpbitmap, org_2_y + sy, org_2_x + sx) - 4) & bgmask) != 0) if ((exidy_collision_mask & 0x08) && count++ < 128) timer_set(video_screen_get_time_until_pos(0, org_2_x + sx, org_2_y + sy), 0x08, collision_irq_callback); } diff --git a/src/mame/video/exidy440.c b/src/mame/video/exidy440.c index eceade70355..d2f1f27d07b 100644 --- a/src/mame/video/exidy440.c +++ b/src/mame/video/exidy440.c @@ -220,7 +220,7 @@ WRITE8_HANDLER( exidy440_interrupt_clear_w ) * *************************************/ -void exidy440_update_firq(void) +static void exidy440_update_firq(void) { if (exidy440_firq_vblank || (firq_enable && exidy440_firq_beam)) cpunum_set_input_line(0, 1, ASSERT_LINE); diff --git a/src/mame/video/fgoal.c b/src/mame/video/fgoal.c index f5839bc811e..275ded26bc5 100644 --- a/src/mame/video/fgoal.c +++ b/src/mame/video/fgoal.c @@ -96,7 +96,7 @@ VIDEO_UPDATE( fgoal ) { if (y < 256 && x < 256) { - *BITMAP_ADDR16(fgbitmap, y, x) = 0x38; + *BITMAP_ADDR16(fgbitmap, y, x) = 128 + 16; } } } diff --git a/src/mame/video/firetrk.c b/src/mame/video/firetrk.c index 8e109baaab0..347ed9448fb 100644 --- a/src/mame/video/firetrk.c +++ b/src/mame/video/firetrk.c @@ -419,6 +419,7 @@ VIDEO_EOF( firetrk ) continue; } + fillbitmap(helper2, 0xff, NULL); drawgfx(helper2, machine->gfx[car[i].layout], car[i].number, @@ -428,7 +429,7 @@ VIDEO_EOF( firetrk ) car[i].x, car[i].y, &playfield_window, - TRANSPARENCY_NONE, 0); + TRANSPARENCY_PEN, 0); for (y = car[i].y; y < car[i].y + height; y++) { @@ -449,11 +450,11 @@ VIDEO_EOF( firetrk ) a = *BITMAP_ADDR16(helper1, y, x); b = *BITMAP_ADDR16(helper2, y, x); - if (b != 0 && a == 1) + if (b != 0xff && (firetrk_color1_mask >> a) & 1) { firetrk_crash[i] = 1; } - if (b != 0 && a == 2) + if (b != 0xff && (firetrk_color2_mask >> a) & 1) { firetrk_skid[i] = 1; } diff --git a/src/mame/video/galaga.c b/src/mame/video/galaga.c index 08c580b7f2e..57747b71d97 100644 --- a/src/mame/video/galaga.c +++ b/src/mame/video/galaga.c @@ -17,7 +17,6 @@ UINT8 *galaga_videoram; UINT8 *galaga_ram1,*galaga_ram2,*galaga_ram3; UINT8 galaga_starcontrol[6]; static UINT32 stars_scrollx,stars_scrolly; -static colortable *galaga_colortable; static INT32 galaga_gfxbank; // used by catsbee @@ -338,7 +337,7 @@ PALETTE_INIT( galaga ) { int i; - galaga_colortable = colortable_alloc(machine, 32+64); + machine->colortable = colortable_alloc(machine, 32+64); /* core palette */ for (i = 0;i < 32;i++) @@ -358,7 +357,7 @@ PALETTE_INIT( galaga ) bit2 = ((*color_prom) >> 7) & 0x01; b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - colortable_palette_set_color(galaga_colortable,i,MAKE_RGB(r,g,b)); + colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b)); color_prom++; } @@ -375,20 +374,20 @@ PALETTE_INIT( galaga ) bits = (i >> 4) & 0x03; b = map[bits]; - colortable_palette_set_color(galaga_colortable,32 + i,MAKE_RGB(r,g,b)); + colortable_palette_set_color(machine->colortable,32 + i,MAKE_RGB(r,g,b)); } /* characters */ for (i = 0;i < 64*4;i++) - colortable_entry_set_value(galaga_colortable, i, (*(color_prom++) & 0x0f) + 0x10); /* chars */ + colortable_entry_set_value(machine->colortable, i, (*(color_prom++) & 0x0f) + 0x10); /* chars */ /* sprites */ for (i = 0;i < 64*4;i++) - colortable_entry_set_value(galaga_colortable, 64*4+i, (*(color_prom++) & 0x0f)); + colortable_entry_set_value(machine->colortable, 64*4+i, (*(color_prom++) & 0x0f)); /* now the stars */ for (i = 0;i < 64;i++) - colortable_entry_set_value(galaga_colortable, 64*4+64*4+i, 32 + i); + colortable_entry_set_value(machine->colortable, 64*4+64*4+i, 32 + i); } @@ -442,7 +441,7 @@ static TILE_GET_INFO( get_tile_info ) VIDEO_START( galaga ) { tx_tilemap = tilemap_create(get_tile_info,tilemap_scan,TILEMAP_TYPE_PEN,8,8,36,28); - colortable_configure_tilemap_groups(galaga_colortable, tx_tilemap, machine->gfx[0], 0x1f); + colortable_configure_tilemap_groups(machine->colortable, tx_tilemap, machine->gfx[0], 0x1f); galaga_gfxbank = 0; @@ -536,7 +535,7 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re flipx,flipy, sx + 16*x, sy + 16*y, cliprect,TRANSPARENCY_PENS, - colortable_get_transpen_mask(galaga_colortable, machine->gfx[1], color, 0x0f)); + colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0x0f)); } } } diff --git a/src/mame/video/galaxian.c b/src/mame/video/galaxian.c index c331bce0c15..e862ade02ab 100644 --- a/src/mame/video/galaxian.c +++ b/src/mame/video/galaxian.c @@ -1844,7 +1844,7 @@ void galaxian_draw_stars(running_machine *machine, mame_bitmap *bitmap) } } -void scramble_draw_stars(running_machine *machine, mame_bitmap *bitmap) +static void scramble_draw_stars(running_machine *machine, mame_bitmap *bitmap) { int offs; diff --git a/src/mame/video/gaplus.c b/src/mame/video/gaplus.c index abd71e31d30..1d61d0fd858 100644 --- a/src/mame/video/gaplus.c +++ b/src/mame/video/gaplus.c @@ -13,7 +13,6 @@ UINT8 *gaplus_videoram; UINT8 *gaplus_spriteram; static tilemap *bg_tilemap; -static colortable *gaplus_colortable; /*************************************************************************** @@ -34,7 +33,7 @@ PALETTE_INIT( gaplus ) int i; /* allocate the colortable */ - gaplus_colortable = colortable_alloc(machine, 256); + machine->colortable = colortable_alloc(machine, 256); for (i = 0;i < 256;i++) { @@ -59,7 +58,7 @@ PALETTE_INIT( gaplus ) bit3 = (color_prom[i + 0x200] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - colortable_palette_set_color(gaplus_colortable,i,MAKE_RGB(r,g,b)); + colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b)); } color_prom += 0x300; @@ -67,12 +66,12 @@ PALETTE_INIT( gaplus ) /* characters use colors 0xf0-0xff */ for (i = 0;i < machine->gfx[0]->total_colors * machine->gfx[0]->color_granularity;i++) - colortable_entry_set_value(gaplus_colortable, machine->gfx[0]->color_base + i, 0xf0 + (*color_prom++ & 0x0f)); + colortable_entry_set_value(machine->colortable, machine->gfx[0]->color_base + i, 0xf0 + (*color_prom++ & 0x0f)); /* sprites */ for (i = 0;i < machine->gfx[1]->total_colors * machine->gfx[1]->color_granularity;i++) { - colortable_entry_set_value(gaplus_colortable, machine->gfx[1]->color_base + i, (color_prom[0] & 0x0f) + ((color_prom[0x200] & 0x0f) << 4)); + colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + i, (color_prom[0] & 0x0f) + ((color_prom[0x200] & 0x0f) << 4)); color_prom++; } } @@ -198,7 +197,7 @@ VIDEO_START( gaplus ) { bg_tilemap = tilemap_create(get_tile_info,tilemap_scan,TILEMAP_TYPE_PEN,8,8,36,28); - colortable_configure_tilemap_groups(gaplus_colortable, bg_tilemap, machine->gfx[0], 0xff); + colortable_configure_tilemap_groups(machine->colortable, bg_tilemap, machine->gfx[0], 0xff); spriteram = gaplus_spriteram + 0x780; spriteram_2 = spriteram + 0x800; @@ -311,7 +310,7 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re flipx,flipy, sx + 16*x,sy + 16*y, cliprect,TRANSPARENCY_PENS, - colortable_get_transpen_mask(gaplus_colortable, machine->gfx[1], color, 0xff)); + colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0xff)); } } } diff --git a/src/mame/video/lazercmd.c b/src/mame/video/lazercmd.c index 33a51ce08ec..bb8a37dcee6 100644 --- a/src/mame/video/lazercmd.c +++ b/src/mame/video/lazercmd.c @@ -47,7 +47,7 @@ static void plot_pattern(running_machine *machine, mame_bitmap *bitmap, int x, i if (x+xbit < 0 || x+xbit >= HORZ_RES * HORZ_CHR) continue; - *BITMAP_ADDR16(bitmap, y+ybit, x+xbit) = machine->pens[2]; + *BITMAP_ADDR16(bitmap, y+ybit, x+xbit) = 4; } } } diff --git a/src/mame/video/malzak.c b/src/mame/video/malzak.c index 76dd47cece3..8f05d10c918 100644 --- a/src/mame/video/malzak.c +++ b/src/mame/video/malzak.c @@ -206,7 +206,7 @@ VIDEO_UPDATE( malzak ) sx+=256; drawgfx(bitmap,machine->gfx[0],field[x*16 + y].code,7,0,0, - sx, sy, &machine->screen[0].visarea, TRANSPARENCY_COLOR, 0); + sx, sy, &machine->screen[0].visarea, TRANSPARENCY_PEN, 0); } // S2636 - Sprites / Collision detection (x2) diff --git a/src/mame/video/mappy.c b/src/mame/video/mappy.c index 2dfdc872d18..013d7336fc5 100644 --- a/src/mame/video/mappy.c +++ b/src/mame/video/mappy.c @@ -10,8 +10,6 @@ static tilemap *bg_tilemap; static mame_bitmap *sprite_bitmap; -static colortable *mappy_colortable; - /*************************************************************************** @@ -53,7 +51,7 @@ PALETTE_INIT( superpac ) 2, &resistances[1], bweights, 0, 0); /* allocate the colortable */ - mappy_colortable = colortable_alloc(machine, 32); + machine->colortable = colortable_alloc(machine, 32); /* create a lookup table for the palette */ for (i = 0; i < 32; i++) @@ -78,7 +76,7 @@ PALETTE_INIT( superpac ) bit1 = (color_prom[i] >> 7) & 0x01; b = combine_2_weights(bweights, bit0, bit1); - colortable_palette_set_color(mappy_colortable, i, MAKE_RGB(r, g, b)); + colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b)); } /* color_prom now points to the beginning of the lookup table */ @@ -88,14 +86,14 @@ PALETTE_INIT( superpac ) for (i = 0; i < 64*4; i++) { UINT8 ctabentry = color_prom[i] & 0x0f; - colortable_entry_set_value(mappy_colortable, i, (ctabentry ^ 15) + 0x10); + colortable_entry_set_value(machine->colortable, i, (ctabentry ^ 15) + 0x10); } /* sprites map to the lower 16 palette entries */ for (i = 64*4; i < 128*4; i++) { UINT8 ctabentry = color_prom[i] & 0x0f; - colortable_entry_set_value(mappy_colortable, i, ctabentry); + colortable_entry_set_value(machine->colortable, i, ctabentry); } } @@ -112,7 +110,7 @@ PALETTE_INIT( mappy ) 2, &resistances[1], bweights, 0, 0); /* allocate the colortable */ - mappy_colortable = colortable_alloc(machine, 32); + machine->colortable = colortable_alloc(machine, 32); /* create a lookup table for the palette */ for (i = 0; i < 32; i++) @@ -137,7 +135,7 @@ PALETTE_INIT( mappy ) bit1 = (color_prom[i] >> 7) & 0x01; b = combine_2_weights(bweights, bit0, bit1); - colortable_palette_set_color(mappy_colortable, i, MAKE_RGB(r, g, b)); + colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b)); } /* color_prom now points to the beginning of the lookup table */ @@ -147,14 +145,14 @@ PALETTE_INIT( mappy ) for (i = 0*4; i < 64*4; i++) { UINT8 ctabentry = color_prom[i] & 0x0f; - colortable_entry_set_value(mappy_colortable, i, ctabentry + 0x10); + colortable_entry_set_value(machine->colortable, i, ctabentry + 0x10); } /* sprites map to the lower 16 palette entries */ for (i = 64*4; i < machine->drv->total_colors; i++) { UINT8 ctabentry = color_prom[i] & 0x0f; - colortable_entry_set_value(mappy_colortable, i, ctabentry); + colortable_entry_set_value(machine->colortable, i, ctabentry); } } @@ -183,7 +181,7 @@ PALETTE_INIT( phozon ) 4, &resistances[0], bweights, 0, 0); /* allocate the colortable */ - mappy_colortable = colortable_alloc(machine, 32); + machine->colortable = colortable_alloc(machine, 32); /* create a lookup table for the palette */ for (i = 0; i < 32; i++) @@ -212,7 +210,7 @@ PALETTE_INIT( phozon ) bit3 = (color_prom[i + 0x200] >> 3) & 0x01; b = combine_4_weights(bweights, bit0, bit1, bit2, bit3); - colortable_palette_set_color(mappy_colortable, i, MAKE_RGB(r, g, b)); + colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b)); } /* color_prom now points to the beginning of the lookup table */ @@ -222,14 +220,14 @@ PALETTE_INIT( phozon ) for (i = 0; i < 64*4; i++) { UINT8 ctabentry = color_prom[i] & 0x0f; - colortable_entry_set_value(mappy_colortable, i, ctabentry); + colortable_entry_set_value(machine->colortable, i, ctabentry); } /* sprites map to the upper 16 palette entries */ for (i = 64*4; i < 128*4; i++) { UINT8 ctabentry = color_prom[i] & 0x0f; - colortable_entry_set_value(mappy_colortable, i, ctabentry + 0x10); + colortable_entry_set_value(machine->colortable, i, ctabentry + 0x10); } } @@ -327,7 +325,7 @@ VIDEO_START( superpac ) bg_tilemap = tilemap_create(superpac_get_tile_info,superpac_tilemap_scan,TILEMAP_TYPE_PEN,8,8,36,28); sprite_bitmap = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format); - colortable_configure_tilemap_groups(mappy_colortable, bg_tilemap, machine->gfx[0], 31); + colortable_configure_tilemap_groups(machine->colortable, bg_tilemap, machine->gfx[0], 31); spriteram = mappy_spriteram + 0x780; spriteram_2 = spriteram + 0x800; @@ -338,7 +336,7 @@ VIDEO_START( phozon ) { bg_tilemap = tilemap_create(phozon_get_tile_info,superpac_tilemap_scan,TILEMAP_TYPE_PEN,8,8,36,28); - colortable_configure_tilemap_groups(mappy_colortable, bg_tilemap, machine->gfx[0], 15); + colortable_configure_tilemap_groups(machine->colortable, bg_tilemap, machine->gfx[0], 15); spriteram = mappy_spriteram + 0x780; spriteram_2 = spriteram + 0x800; @@ -349,7 +347,7 @@ VIDEO_START( mappy ) { bg_tilemap = tilemap_create(mappy_get_tile_info,mappy_tilemap_scan,TILEMAP_TYPE_PEN,8,8,36,60); - colortable_configure_tilemap_groups(mappy_colortable, bg_tilemap, machine->gfx[0], 31); + colortable_configure_tilemap_groups(machine->colortable, bg_tilemap, machine->gfx[0], 31); tilemap_set_scroll_cols(bg_tilemap, 36); spriteram = mappy_spriteram + 0x780; @@ -402,7 +400,7 @@ WRITE8_HANDLER( mappy_scroll_w ) ***************************************************************************/ /* also used by toypop.c */ -void mappy_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int xoffs, int yoffs, colortable *ctable, int transcolor) +void mappy_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int xoffs, int yoffs, int transcolor) { int offs; @@ -448,7 +446,7 @@ void mappy_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rec flipx,flipy, sx + 16*x,sy + 16*y, cliprect,TRANSPARENCY_PENS, - colortable_get_transpen_mask(ctable, machine->gfx[1], color, transcolor)); + colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, transcolor)); } } } @@ -523,7 +521,7 @@ static void phozon_draw_sprites(running_machine *machine, mame_bitmap *bitmap, c flipx,flipy, sx + 8*x,sy + 8*y, cliprect,TRANSPARENCY_PENS, - colortable_get_transpen_mask(mappy_colortable, machine->gfx[1], color, 31)); + colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 31)); } } } @@ -539,7 +537,7 @@ VIDEO_UPDATE( superpac ) tilemap_draw(bitmap,cliprect,bg_tilemap,1|TILEMAP_DRAW_OPAQUE,0); fillbitmap(sprite_bitmap,15,cliprect); - mappy_draw_sprites(machine,sprite_bitmap,cliprect,0,0,mappy_colortable,15); + mappy_draw_sprites(machine,sprite_bitmap,cliprect,0,0,15); copybitmap(bitmap,sprite_bitmap,0,0,0,0,cliprect,TRANSPARENCY_PEN,15); /* Redraw the high priority characters */ @@ -582,7 +580,7 @@ VIDEO_UPDATE( mappy ) tilemap_draw(bitmap,cliprect,bg_tilemap,0|TILEMAP_DRAW_OPAQUE,0); tilemap_draw(bitmap,cliprect,bg_tilemap,1|TILEMAP_DRAW_OPAQUE,0); - mappy_draw_sprites(machine,bitmap,cliprect,0,0,mappy_colortable,15); + mappy_draw_sprites(machine,bitmap,cliprect,0,0,15); /* Redraw the high priority characters */ tilemap_draw(bitmap,cliprect,bg_tilemap,1,0); diff --git a/src/mame/video/namcos22.c b/src/mame/video/namcos22.c index 5a461044269..90e467addec 100644 --- a/src/mame/video/namcos22.c +++ b/src/mame/video/namcos22.c @@ -251,14 +251,14 @@ INLINE unsigned texel( unsigned x, unsigned y ) typedef struct _poly_extra_data poly_extra_data; struct _poly_extra_data { + rgbint fogColor; + rgbint fadeColor; int color; int bn; UINT16 flags; int cmode; int fogFactor; - rgbint fogColor; int fadeFactor; - rgbint fadeColor; const UINT8 *source; /* sprites */ int z; int alpha; diff --git a/src/mame/video/namcos86.c b/src/mame/video/namcos86.c index e0bdeff26df..4961718c7d4 100644 --- a/src/mame/video/namcos86.c +++ b/src/mame/video/namcos86.c @@ -45,17 +45,12 @@ static const UINT8 *tile_address_prom; PALETTE_INIT( namcos86 ) { int i; - int totcolors,totlookup; + rgb_t palette[512]; - - totcolors = machine->drv->total_colors; - totlookup = machine->drv->color_table_len; - - for (i = 0;i < totcolors;i++) + for (i = 0;i < 512;i++) { int bit0,bit1,bit2,bit3,r,g,b; - bit0 = (color_prom[0] >> 0) & 0x01; bit1 = (color_prom[0] >> 1) & 0x01; bit2 = (color_prom[0] >> 2) & 0x01; @@ -66,26 +61,26 @@ PALETTE_INIT( namcos86 ) bit2 = (color_prom[0] >> 6) & 0x01; bit3 = (color_prom[0] >> 7) & 0x01; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - bit0 = (color_prom[totcolors] >> 0) & 0x01; - bit1 = (color_prom[totcolors] >> 1) & 0x01; - bit2 = (color_prom[totcolors] >> 2) & 0x01; - bit3 = (color_prom[totcolors] >> 3) & 0x01; + bit0 = (color_prom[512] >> 0) & 0x01; + bit1 = (color_prom[512] >> 1) & 0x01; + bit2 = (color_prom[512] >> 2) & 0x01; + bit3 = (color_prom[512] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - palette_set_color(machine,i,MAKE_RGB(r,g,b)); + palette[i] = MAKE_RGB(r,g,b); color_prom++; } - color_prom += totcolors; + color_prom += 512; /* color_prom now points to the beginning of the lookup table */ /* tiles lookup table */ - for (i = 0;i < totlookup/2;i++) - *(colortable++) = *color_prom++; + for (i = 0;i < 2048;i++) + palette_set_color(machine, i, palette[*color_prom++]); /* sprites lookup table */ - for (i = 0;i < totlookup/2;i++) - *(colortable++) = *(color_prom++) + totcolors/2; + for (i = 0;i < 2048;i++) + palette_set_color(machine, 2048 + i, palette[256 + *color_prom++]); /* color_prom now points to the beginning of the tile address decode PROM */ diff --git a/src/mame/video/nycaptor.c b/src/mame/video/nycaptor.c index d6eb5106bd7..ed2fb5ac0f0 100644 --- a/src/mame/video/nycaptor.c +++ b/src/mame/video/nycaptor.c @@ -203,7 +203,7 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re #define mKEY_MASK(x,y) if (input_code_pressed_once(x)){nycaptor_mask|=y;tilemap_mark_all_tiles_dirty( bg_tilemap );} -void nycaptor_setmask(void) +static void nycaptor_setmask(void) { mKEY_MASK(KEYCODE_Q,1); /* bg */ mKEY_MASK(KEYCODE_W,2); diff --git a/src/mame/video/pacland.c b/src/mame/video/pacland.c index 36a2c80667f..99fc9297430 100644 --- a/src/mame/video/pacland.c +++ b/src/mame/video/pacland.c @@ -32,7 +32,6 @@ UINT8 *pacland_videoram,*pacland_videoram2,*pacland_spriteram; static UINT8 palette_bank; static const UINT8 *pacland_color_prom; -static colortable *pacland_colortable; static tilemap *bg_tilemap, *fg_tilemap; static mame_bitmap *fg_bitmap; @@ -95,7 +94,7 @@ static void switch_palette(running_machine *machine) color_prom++; - colortable_palette_set_color(pacland_colortable,i,MAKE_RGB(r,g,b)); + colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b)); } } @@ -104,7 +103,7 @@ PALETTE_INIT( pacland ) int i; /* allocate the colortable */ - pacland_colortable = colortable_alloc(machine, 256); + machine->colortable = colortable_alloc(machine, 256); pacland_color_prom = color_prom; /* we'll need this later */ /* skip the palette data, it will be initialized later */ @@ -112,15 +111,15 @@ PALETTE_INIT( pacland ) /* color_prom now points to the beginning of the lookup table */ for (i = 0;i < 0x400;i++) - colortable_entry_set_value(pacland_colortable, machine->gfx[0]->color_base + i, *color_prom++); + colortable_entry_set_value(machine->colortable, machine->gfx[0]->color_base + i, *color_prom++); /* Background */ for (i = 0;i < 0x400;i++) - colortable_entry_set_value(pacland_colortable, machine->gfx[1]->color_base + i, *color_prom++); + colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + i, *color_prom++); /* Sprites */ for (i = 0;i < 0x400;i++) - colortable_entry_set_value(pacland_colortable, machine->gfx[2]->color_base + i, *color_prom++); + colortable_entry_set_value(machine->colortable, machine->gfx[2]->color_base + i, *color_prom++); palette_bank = 0; switch_palette(machine); @@ -139,7 +138,7 @@ PALETTE_INIT( pacland ) /* iterate over all palette entries except the last one */ for (palentry = 0; palentry < 0x100; palentry++) { - UINT32 mask = colortable_get_transpen_mask(pacland_colortable, machine->gfx[2], i, palentry); + UINT32 mask = colortable_get_transpen_mask(machine->colortable, machine->gfx[2], i, palentry); /* transmask[0] is a mask that is used to draw only high priority sprite pixels; thus, pens $00-$7F are opaque, and others are transparent */ @@ -216,8 +215,8 @@ VIDEO_START( pacland ) assert(machine->gfx[0]->total_colors <= TILEMAP_NUM_GROUPS); for (color = 0; color < machine->gfx[0]->total_colors; color++) { - UINT32 mask = colortable_get_transpen_mask(pacland_colortable, machine->gfx[0], color, 0x7f); - mask |= colortable_get_transpen_mask(pacland_colortable, machine->gfx[0], color, 0xff); + UINT32 mask = colortable_get_transpen_mask(machine->colortable, machine->gfx[0], color, 0x7f); + mask |= colortable_get_transpen_mask(machine->colortable, machine->gfx[0], color, 0xff); tilemap_set_transmask(fg_tilemap, color, mask, 0); } diff --git a/src/mame/video/pacman.c b/src/mame/video/pacman.c index bff584f1eb5..05298e29851 100644 --- a/src/mame/video/pacman.c +++ b/src/mame/video/pacman.c @@ -20,7 +20,6 @@ #include "includes/pacman.h" #include "video/resnet.h" -static colortable *pacman_colortable; static tilemap *bg_tilemap; static UINT8 charbank; static UINT8 spritebank; @@ -93,7 +92,7 @@ PALETTE_INIT( pacman ) 2, &resistances[1], bweights, 0, 0); /* allocate the colortable */ - pacman_colortable = colortable_alloc(machine, 32); + machine->colortable = colortable_alloc(machine, 32); /* create a lookup table for the palette */ for (i = 0; i < 32; i++) @@ -118,7 +117,7 @@ PALETTE_INIT( pacman ) bit1 = (color_prom[i] >> 7) & 0x01; b = combine_2_weights(bweights, bit0, bit1); - colortable_palette_set_color(pacman_colortable, i, MAKE_RGB(r, g, b)); + colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b)); } /* color_prom now points to the beginning of the lookup table */ @@ -130,10 +129,10 @@ PALETTE_INIT( pacman ) UINT8 ctabentry = color_prom[i] & 0x0f; /* first palette bank */ - colortable_entry_set_value(pacman_colortable, i, ctabentry); + colortable_entry_set_value(machine->colortable, i, ctabentry); /* second palette bank */ - colortable_entry_set_value(pacman_colortable, i + 64*4, 0x10 + ctabentry); + colortable_entry_set_value(machine->colortable, i + 64*4, 0x10 + ctabentry); } } @@ -247,7 +246,7 @@ VIDEO_UPDATE( pacman ) spriteram[offs] & 1,spriteram[offs] & 2, sx,sy, &spriteclip,TRANSPARENCY_PENS, - colortable_get_transpen_mask(pacman_colortable, machine->gfx[1], color & 0x3f, 0)); + colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color & 0x3f, 0)); /* also plot the sprite with wraparound (tunnel in Crush Roller) */ drawgfx(bitmap,machine->gfx[1], @@ -256,7 +255,7 @@ VIDEO_UPDATE( pacman ) spriteram[offs] & 1,spriteram[offs] & 2, sx - 256,sy, &spriteclip,TRANSPARENCY_PENS, - colortable_get_transpen_mask(pacman_colortable, machine->gfx[1], color & 0x3f, 0)); + colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color & 0x3f, 0)); } /* In the Pac Man based games (NOT Pengo) the first two sprites must be offset */ /* one pixel to the left to get a more correct placement */ @@ -275,7 +274,7 @@ VIDEO_UPDATE( pacman ) spriteram[offs] & 1,spriteram[offs] & 2, sx,sy + xoffsethack, &spriteclip,TRANSPARENCY_PENS, - colortable_get_transpen_mask(pacman_colortable, machine->gfx[1], color & 0x3f, 0)); + colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color & 0x3f, 0)); /* also plot the sprite with wraparound (tunnel in Crush Roller) */ drawgfx(bitmap,machine->gfx[1], @@ -284,7 +283,7 @@ VIDEO_UPDATE( pacman ) spriteram[offs] & 2,spriteram[offs] & 1, sx - 256,sy + xoffsethack, &spriteclip,TRANSPARENCY_PENS, - colortable_get_transpen_mask(pacman_colortable, machine->gfx[1], color & 0x3f, 0)); + colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color & 0x3f, 0)); } } @@ -417,7 +416,7 @@ VIDEO_UPDATE( s2650games ) spriteram[offs] & 1,spriteram[offs] & 2, sx,sy, cliprect,TRANSPARENCY_PENS, - colortable_get_transpen_mask(pacman_colortable, machine->gfx[1], color & 0x3f, 0)); + colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color & 0x3f, 0)); } /* In the Pac Man based games (NOT Pengo) the first two sprites must be offset */ /* one pixel to the left to get a more correct placement */ @@ -438,7 +437,7 @@ VIDEO_UPDATE( s2650games ) spriteram[offs] & 1,spriteram[offs] & 2, sx,sy + xoffsethack, cliprect,TRANSPARENCY_PENS, - colortable_get_transpen_mask(pacman_colortable, machine->gfx[1], color & 0x3f, 0)); + colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color & 0x3f, 0)); } return 0; } diff --git a/src/mame/video/pastelg.c b/src/mame/video/pastelg.c index 8723c6d2256..7657fff1424 100644 --- a/src/mame/video/pastelg.c +++ b/src/mame/video/pastelg.c @@ -116,7 +116,7 @@ WRITE8_HANDLER( pastelg_romsel_w ) ******************************************************************************/ -void pastelg_vramflip(void) +static void pastelg_vramflip(void) { static int pastelg_flipscreen_old = 0; int x, y; @@ -150,7 +150,7 @@ static TIMER_CALLBACK( blitter_timer_callback ) nb1413m3_busyflag = 1; } -void pastelg_gfxdraw(void) +static void pastelg_gfxdraw(void) { UINT8 *GFX = memory_region(REGION_GFX1); diff --git a/src/mame/video/polepos.c b/src/mame/video/polepos.c index ff89c0c01b4..ef028adc2aa 100644 --- a/src/mame/video/polepos.c +++ b/src/mame/video/polepos.c @@ -15,7 +15,6 @@ static UINT16 polepos_vertical_position_modifier[256]; static UINT16 road16_vscroll; -static colortable *polepos_colortable; static tilemap *bg_tilemap,*tx_tilemap; static int polepos_chacl; @@ -41,7 +40,7 @@ PALETTE_INIT( polepos ) int i, j; /* allocate the colortable */ - polepos_colortable = colortable_alloc(machine, 128); + machine->colortable = colortable_alloc(machine, 128); /******************************************************* * Color PROMs @@ -87,7 +86,7 @@ PALETTE_INIT( polepos ) bit3 = (color_prom[0x200 + i] >> 3) & 1; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - colortable_palette_set_color(polepos_colortable,i,MAKE_RGB(r,g,b)); + colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b)); } /******************************************************* @@ -98,8 +97,8 @@ PALETTE_INIT( polepos ) for (i = 0; i < 64*4; i++) { int color = color_prom[0x300 + i]; - colortable_entry_set_value(polepos_colortable, 0x0000 + i, (color != 15) ? (0x020 + color) : 0x2f); - colortable_entry_set_value(polepos_colortable, 0x0100 + i, (color != 15) ? (0x060 + color) : 0x2f); + colortable_entry_set_value(machine->colortable, 0x0000 + i, (color != 15) ? (0x020 + color) : 0x2f); + colortable_entry_set_value(machine->colortable, 0x0100 + i, (color != 15) ? (0x060 + color) : 0x2f); } /******************************************************* @@ -111,7 +110,7 @@ PALETTE_INIT( polepos ) for (i = 0; i < 64*4; i++) { int color = color_prom[0x400 + i]; - colortable_entry_set_value(polepos_colortable, 0x0200 + i, 0x000 + color); + colortable_entry_set_value(machine->colortable, 0x0200 + i, 0x000 + color); } /******************************************************* @@ -122,8 +121,8 @@ PALETTE_INIT( polepos ) for (i = 0; i < 64*16; i++) { int color = color_prom[0xc00 + i]; - colortable_entry_set_value(polepos_colortable, 0x0300 + i, (color != 15) ? (0x010 + color) : 0x1f); - colortable_entry_set_value(polepos_colortable, 0x0700 + i, (color != 15) ? (0x050 + color) : 0x1f); + colortable_entry_set_value(machine->colortable, 0x0300 + i, (color != 15) ? (0x010 + color) : 0x1f); + colortable_entry_set_value(machine->colortable, 0x0700 + i, (color != 15) ? (0x050 + color) : 0x1f); } /******************************************************* @@ -135,7 +134,7 @@ PALETTE_INIT( polepos ) for (i = 0; i < 64*16; i++) { int color = color_prom[0x800 + i]; - colortable_entry_set_value(polepos_colortable, 0x0b00 + i, 0x040 + color); + colortable_entry_set_value(machine->colortable, 0x0b00 + i, 0x040 + color); } /* 136014-142, 136014-143, 136014-144 Vertical position modifiers */ @@ -205,7 +204,7 @@ VIDEO_START( polepos ) bg_tilemap = tilemap_create(bg_get_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,8,8,64,16); tx_tilemap = tilemap_create(tx_get_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32); - colortable_configure_tilemap_groups(polepos_colortable, tx_tilemap, machine->gfx[0], 0x2f); + colortable_configure_tilemap_groups(machine->colortable, tx_tilemap, machine->gfx[0], 0x2f); } @@ -434,7 +433,7 @@ static void zoom_sprite(running_machine *machine, mame_bitmap *bitmap,int big, const gfx_element *gfx = machine->gfx[big ? 3 : 2]; UINT8 *gfxdata = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo; UINT8 *scaling_rom = memory_region(REGION_GFX6); - UINT32 transmask = colortable_get_transpen_mask(polepos_colortable, gfx, color, 0x1f); + UINT32 transmask = colortable_get_transpen_mask(machine->colortable, gfx, color, 0x1f); int coloroffs = gfx->color_base + color * gfx->color_granularity; int x,y; diff --git a/src/mame/video/segasyse.c b/src/mame/video/segasyse.c index 023a885ed54..cb0f6864d6a 100644 --- a/src/mame/video/segasyse.c +++ b/src/mame/video/segasyse.c @@ -334,7 +334,7 @@ static void vdp_setregister(UINT8 chip, UINT16 cmd) *******************************************************************************/ -void segae_drawscanline(int line, int chips, int blank) +static void segae_drawscanline(int line, int chips, int blank) { UINT8* dest; diff --git a/src/mame/video/slapfght.c b/src/mame/video/slapfght.c index 777d0989020..d40bb248821 100644 --- a/src/mame/video/slapfght.c +++ b/src/mame/video/slapfght.c @@ -132,7 +132,7 @@ WRITE8_HANDLER( slapfight_palette_bank_w ) } #ifdef MAME_DEBUG -void slapfght_log_vram(void) +static void slapfght_log_vram(void) { if ( input_code_pressed_once(KEYCODE_B) ) { diff --git a/src/mame/video/toaplan1.c b/src/mame/video/toaplan1.c index 8de69a24f43..6d82e17d3da 100644 --- a/src/mame/video/toaplan1.c +++ b/src/mame/video/toaplan1.c @@ -751,7 +751,7 @@ WRITE16_HANDLER( toaplan1_scroll_regs_w ) #ifdef MAME_DEBUG -void toaplan1_log_vram(void) +static void toaplan1_log_vram(void) { if ( input_code_pressed(KEYCODE_M) ) { diff --git a/src/mame/video/toaplan2.c b/src/mame/video/toaplan2.c index 8c66ee2e45b..d8d77ac1407 100644 --- a/src/mame/video/toaplan2.c +++ b/src/mame/video/toaplan2.c @@ -1092,7 +1092,7 @@ WRITE16_HANDLER( pipibibi_spriteram16_w ) #ifdef MAME_DEBUG -void toaplan2_log_vram(void) +static void toaplan2_log_vram(void) { offs_t sprite_voffs, tile_voffs; int vid_controllers = 1; diff --git a/src/mame/video/toypop.c b/src/mame/video/toypop.c index 4eeb6b96f97..a256f8c9810 100644 --- a/src/mame/video/toypop.c +++ b/src/mame/video/toypop.c @@ -16,8 +16,6 @@ static tilemap *bg_tilemap; UINT16 *toypop_bg_image; static int bitmapflip,palettebank; -static colortable *toypop_colortable; - /*************************************************************************** @@ -33,7 +31,7 @@ PALETTE_INIT( toypop ) int i; /* allocate the colortable */ - toypop_colortable = colortable_alloc(machine, 256); + machine->colortable = colortable_alloc(machine, 256); for (i = 0;i < 256;i++) { @@ -58,7 +56,7 @@ PALETTE_INIT( toypop ) bit3 = (color_prom[i+0x200] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - colortable_palette_set_color(toypop_colortable, i, MAKE_RGB(r,g,b)); + colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r,g,b)); } for (i = 0;i < 256;i++) @@ -66,17 +64,17 @@ PALETTE_INIT( toypop ) UINT8 entry; // characters - colortable_entry_set_value(toypop_colortable, i + 0*256, (color_prom[i + 0x300] & 0x0f) | 0x70); - colortable_entry_set_value(toypop_colortable, i + 1*256, (color_prom[i + 0x300] & 0x0f) | 0xf0); + colortable_entry_set_value(machine->colortable, i + 0*256, (color_prom[i + 0x300] & 0x0f) | 0x70); + colortable_entry_set_value(machine->colortable, i + 1*256, (color_prom[i + 0x300] & 0x0f) | 0xf0); // sprites entry = color_prom[i + 0x500]; - colortable_entry_set_value(toypop_colortable, i + 2*256, entry); + colortable_entry_set_value(machine->colortable, i + 2*256, entry); } for (i = 0;i < 16;i++) { // background - colortable_entry_set_value(toypop_colortable, i + 3*256 + 0*16, 0x60 + i); - colortable_entry_set_value(toypop_colortable, i + 3*256 + 1*16, 0xe0 + i); + colortable_entry_set_value(machine->colortable, i + 3*256 + 0*16, 0x60 + i); + colortable_entry_set_value(machine->colortable, i + 3*256 + 1*16, 0xe0 + i); } } @@ -223,7 +221,7 @@ static void draw_background(mame_bitmap *bitmap) ***************************************************************************/ /* from mappy.c */ -void mappy_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int xoffs, int yoffs, colortable *ctable, int transcolor); +void mappy_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int xoffs, int yoffs, int transcolor); VIDEO_UPDATE( toypop ) @@ -231,6 +229,6 @@ VIDEO_UPDATE( toypop ) draw_background(bitmap); tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); - mappy_draw_sprites(machine, bitmap, cliprect, -31, -8, toypop_colortable, 0xff); + mappy_draw_sprites(machine, bitmap, cliprect, -31, -8, 0xff); return 0; } diff --git a/src/mame/video/twincobr.c b/src/mame/video/twincobr.c index d60e7cdc19a..e4dfc87aaf6 100644 --- a/src/mame/video/twincobr.c +++ b/src/mame/video/twincobr.c @@ -412,7 +412,7 @@ static void wardner_sprite_priority_hack(void) #ifdef MAME_DEBUG -void twincobr_log_vram(void) +static void twincobr_log_vram(void) { if ( input_code_pressed(KEYCODE_M) ) { diff --git a/src/mame/video/vulgus.c b/src/mame/video/vulgus.c index 1a1cac04abb..c21f15d8e75 100644 --- a/src/mame/video/vulgus.c +++ b/src/mame/video/vulgus.c @@ -13,7 +13,6 @@ UINT8 *vulgus_scroll_low,*vulgus_scroll_high; static int vulgus_palette_bank; static tilemap *fg_tilemap, *bg_tilemap; -static colortable *vulgus_colortable; /*************************************************************************** @@ -26,7 +25,7 @@ PALETTE_INIT( vulgus ) { int i; - vulgus_colortable = colortable_alloc(machine, 256); + machine->colortable = colortable_alloc(machine, 256); for (i = 0;i < 256;i++) { @@ -48,7 +47,7 @@ PALETTE_INIT( vulgus ) bit3 = (color_prom[2*256] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - colortable_palette_set_color(vulgus_colortable,i,MAKE_RGB(r,g,b)); + colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b)); color_prom++; } @@ -58,19 +57,19 @@ PALETTE_INIT( vulgus ) /* characters use colors 32-47 (?) */ for (i = 0;i < machine->gfx[0]->total_colors * machine->gfx[0]->color_granularity;i++) - colortable_entry_set_value(vulgus_colortable, machine->gfx[0]->color_base + i, 32 + *color_prom++); + colortable_entry_set_value(machine->colortable, machine->gfx[0]->color_base + i, 32 + *color_prom++); /* sprites use colors 16-31 */ for (i = 0;i < machine->gfx[2]->total_colors * machine->gfx[2]->color_granularity;i++) - colortable_entry_set_value(vulgus_colortable, machine->gfx[2]->color_base + i, 16 + *color_prom++); + colortable_entry_set_value(machine->colortable, machine->gfx[2]->color_base + i, 16 + *color_prom++); /* background tiles use colors 0-15, 64-79, 128-143, 192-207 in four banks */ for (i = 0;i < machine->gfx[1]->total_colors * machine->gfx[1]->color_granularity / 4;i++) { - colortable_entry_set_value(vulgus_colortable, machine->gfx[1]->color_base + 0*32*8 + i, *color_prom); - colortable_entry_set_value(vulgus_colortable, machine->gfx[1]->color_base + 1*32*8 + i, *color_prom + 64); - colortable_entry_set_value(vulgus_colortable, machine->gfx[1]->color_base + 2*32*8 + i, *color_prom + 128); - colortable_entry_set_value(vulgus_colortable, machine->gfx[1]->color_base + 3*32*8 + i, *color_prom + 192); + colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + 0*32*8 + i, *color_prom); + colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + 1*32*8 + i, *color_prom + 64); + colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + 2*32*8 + i, *color_prom + 128); + colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + 3*32*8 + i, *color_prom + 192); color_prom++; } } @@ -121,7 +120,7 @@ VIDEO_START( vulgus ) fg_tilemap = tilemap_create(get_fg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8,32,32); bg_tilemap = tilemap_create(get_bg_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,16,16,32,32); - colortable_configure_tilemap_groups(vulgus_colortable, fg_tilemap, machine->gfx[0], 47); + colortable_configure_tilemap_groups(machine->colortable, fg_tilemap, machine->gfx[0], 47); } diff --git a/src/mame/video/xevious.c b/src/mame/video/xevious.c index 45bbd4ae1b0..ec068424978 100644 --- a/src/mame/video/xevious.c +++ b/src/mame/video/xevious.c @@ -17,8 +17,6 @@ UINT8 *xevious_sr1,*xevious_sr2,*xevious_sr3; static tilemap *fg_tilemap,*bg_tilemap; static INT32 xevious_bs[2]; -static colortable *xevious_colortable; - /*************************************************************************** Convert the color PROMs into a more useable format. @@ -39,7 +37,7 @@ PALETTE_INIT( xevious ) int i; #define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity) - xevious_colortable = colortable_alloc(machine, 128+1); + machine->colortable = colortable_alloc(machine, 128+1); for (i = 0;i < 128;i++) { @@ -64,12 +62,12 @@ PALETTE_INIT( xevious ) bit3 = (color_prom[2*256] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - colortable_palette_set_color(xevious_colortable,i,MAKE_RGB(r,g,b)); + colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b)); color_prom++; } /* color 0x80 is used by sprites to mark transparency */ - colortable_palette_set_color(xevious_colortable,0x80,MAKE_RGB(0,0,0)); + colortable_palette_set_color(machine->colortable,0x80,MAKE_RGB(0,0,0)); color_prom += 128; /* the bottom part of the PROM is unused */ color_prom += 2*256; @@ -78,7 +76,7 @@ PALETTE_INIT( xevious ) /* background tiles */ for (i = 0;i < TOTAL_COLORS(1);i++) { - colortable_entry_set_value(xevious_colortable, machine->gfx[1]->color_base + i, + colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + i, (color_prom[0] & 0x0f) | ((color_prom[TOTAL_COLORS(1)] & 0x0f) << 4)); color_prom++; @@ -90,7 +88,7 @@ PALETTE_INIT( xevious ) { int c = (color_prom[0] & 0x0f) | ((color_prom[TOTAL_COLORS(2)] & 0x0f) << 4); - colortable_entry_set_value(xevious_colortable, machine->gfx[2]->color_base + i, + colortable_entry_set_value(machine->colortable, machine->gfx[2]->color_base + i, (c & 0x80) ? (c & 0x7f) : 0x80); color_prom++; @@ -100,7 +98,7 @@ PALETTE_INIT( xevious ) /* foreground characters */ for (i = 0;i < TOTAL_COLORS(0);i++) { - colortable_entry_set_value(xevious_colortable, machine->gfx[0]->color_base + i, + colortable_entry_set_value(machine->colortable, machine->gfx[0]->color_base + i, (i % 2 != 0) ? (i / 2) : 0x80); } } @@ -111,7 +109,7 @@ PALETTE_INIT( battles ) { int i; - xevious_colortable = colortable_alloc(machine, 128+1); + machine->colortable = colortable_alloc(machine, 128+1); for (i = 0;i < 128;i++) { @@ -136,12 +134,12 @@ PALETTE_INIT( battles ) bit3 = (color_prom[2*256] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - colortable_palette_set_color(xevious_colortable,i,MAKE_RGB(r,g,b)); + colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b)); color_prom++; } /* color 0x80 is used by sprites to mark transparency */ - colortable_palette_set_color(xevious_colortable,0x80,MAKE_RGB(0,0,0)); + colortable_palette_set_color(machine->colortable,0x80,MAKE_RGB(0,0,0)); color_prom += 128; /* the bottom part of the PROM is unused */ color_prom += 2*256; @@ -150,7 +148,7 @@ PALETTE_INIT( battles ) /* background tiles */ for (i = 0;i < TOTAL_COLORS(1);i++) { - colortable_entry_set_value(xevious_colortable, machine->gfx[1]->color_base + i, + colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + i, (color_prom[0] & 0x0f) | ((color_prom[0x400] & 0x0f) << 4)); color_prom++; @@ -162,7 +160,7 @@ PALETTE_INIT( battles ) { int c = (color_prom[0] & 0x0f) | ((color_prom[0x400] & 0x0f) << 4); - colortable_entry_set_value(xevious_colortable, machine->gfx[2]->color_base + i, + colortable_entry_set_value(machine->colortable, machine->gfx[2]->color_base + i, (c & 0x80) ? (c & 0x7f) : 0x80); color_prom++; @@ -171,7 +169,7 @@ PALETTE_INIT( battles ) /* foreground characters */ for (i = 0;i < TOTAL_COLORS(0);i++) { - colortable_entry_set_value(xevious_colortable, machine->gfx[0]->color_base + i, + colortable_entry_set_value(machine->colortable, machine->gfx[0]->color_base + i, (i % 2 != 0) ? (i / 2) : 0x80); } } @@ -460,7 +458,7 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rec sx = spriteram_2[offs + 1] - 40 + 0x100*(spriteram_3[offs + 1] & 1); sy = 28*8-spriteram_2[offs]-1; - transmask = colortable_get_transpen_mask(xevious_colortable, machine->gfx[bank], color, 0x80); + transmask = colortable_get_transpen_mask(machine->colortable, machine->gfx[bank], color, 0x80); if (spriteram_3[offs] & 2) /* double height (?) */ { diff --git a/src/osd/windows/eivc.h b/src/osd/windows/eivc.h new file mode 100644 index 00000000000..b8a9ce320ba --- /dev/null +++ b/src/osd/windows/eivc.h @@ -0,0 +1,158 @@ +//============================================================ +// +// eivc.h +// +// Inline implementations for MSVC compiler. +// +// Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team. +// Visit http://mamedev.org for licensing and usage restrictions. +// +//============================================================ + +#ifndef __EIVC__ +#define __EIVC__ + +#ifdef PTR64 +#include <intrin.h> +#pragma intrinsic(_BitScanReverse) +#else +#pragma intrinsic(_InterlockedCompareExchange) +#pragma intrinsic(_InterlockedExchange) +#pragma intrinsic(_InterlockedExchangeAdd) +#endif + + +/*************************************************************************** + INLINE BIT MANIPULATION FUNCTIONS +***************************************************************************/ + +/*------------------------------------------------- + count_leading_zeros - return the number of + leading zero bits in a 32-bit value +-------------------------------------------------*/ + +#ifndef count_leading_zeros +#define count_leading_zeros _count_leading_zeros +INLINE UINT8 _count_leading_zeros(UINT32 value) +{ + UINT32 index; + return _BitScanReverse(&index, value) ? (index ^ 31) : 32; +} +#endif + + +/*------------------------------------------------- + count_leading_ones - return the number of + leading one bits in a 32-bit value +-------------------------------------------------*/ + +#ifndef count_leading_ones +#define count_leading_ones _count_leading_ones +INLINE UINT8 _count_leading_ones(UINT32 value) +{ + UINT32 index; + return _BitScanReverse(&index, ~value) ? (index ^ 31) : 32; +} +#endif + + + +/*************************************************************************** + INLINE SYNCHRONIZATION FUNCTIONS +***************************************************************************/ + +/*------------------------------------------------- + compare_exchange32 - compare the 'compare' + value against the memory at 'ptr'; if equal, + swap in the 'exchange' value. Regardless, + return the previous value at 'ptr'. +-------------------------------------------------*/ + +#ifndef compare_exchange32 +#define compare_exchange32 _compare_exchange32 +INLINE INT32 _compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange) +{ + return _InterlockedCompareExchange(ptr, exchange, compare); +} +#endif + + +/*------------------------------------------------- + compare_exchange64 - compare the 'compare' + value against the memory at 'ptr'; if equal, + swap in the 'exchange' value. Regardless, + return the previous value at 'ptr'. +-------------------------------------------------*/ + +#ifdef PTR64 +#ifndef compare_exchange64 +#define compare_exchange64 _compare_exchange64 +INLINE INT64 _compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange) +{ + return _InterlockedCompareExchange64(ptr, exchange, compare); +} +#endif +#endif + + +/*------------------------------------------------- + atomic_exchange32 - atomically exchange the + exchange value with the memory at 'ptr', + returning the original value. +-------------------------------------------------*/ + +#ifndef atomic_exchange32 +#define atomic_exchange32 _atomic_exchange32 +INLINE INT32 _atomic_exchange32(INT32 volatile *ptr, INT32 exchange) +{ + return _InterlockedExchange(ptr, exchange); +} +#endif + + +/*------------------------------------------------- + atomic_add32 - atomically add the delta value + to the memory at 'ptr', returning the final + result. +-------------------------------------------------*/ + +#ifndef atomic_add32 +#define atomic_add32 _atomic_add32 +INLINE INT32 _atomic_add32(INT32 volatile *ptr, INT32 delta) +{ + return _InterlockedExchangeAdd(ptr, delta) + delta; +} +#endif + + +/*------------------------------------------------- + atomic_increment32 - atomically increment the + 32-bit value in memory at 'ptr', returning the + final result. +-------------------------------------------------*/ + +#ifndef atomic_increment32 +#define atomic_increment32 _atomic_increment32 +INLINE INT32 _atomic_increment32(INT32 volatile *ptr) +{ + return _InterlockedIncrement(ptr); +} +#endif + + +/*------------------------------------------------- + atomic_decrement32 - atomically decrement the + 32-bit value in memory at 'ptr', returning the + final result. +-------------------------------------------------*/ + +#ifndef atomic_decrement32 +#define atomic_decrement32 _atomic_decrement32 +INLINE INT32 _atomic_decrement32(INT32 volatile *ptr) +{ + return _InterlockedDecrement(ptr); +} +#endif + + +#endif /* __EIVC__ */ diff --git a/src/osd/windows/eivcx86.h b/src/osd/windows/eivcx86.h new file mode 100644 index 00000000000..fb40091dd9a --- /dev/null +++ b/src/osd/windows/eivcx86.h @@ -0,0 +1,463 @@ +//============================================================ +// +// eivcx86.h +// +// x86 inline implementations for MSVC compiler. +// +// Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team. +// Visit http://mamedev.org for licensing and usage restrictions. +// +//============================================================ + +#ifndef __EIVCX86__ +#define __EIVCX86__ + +#ifdef PTR64 +#include <emmintrin.h> +#endif + + +/*************************************************************************** + INLINE MATH FUNCTIONS +***************************************************************************/ + +/*------------------------------------------------- + mul_32x32 - perform a signed 32 bit x 32 bit + multiply and return the full 64 bit result +-------------------------------------------------*/ + +#ifndef PTR64 +#define mul_32x32 _mul_32x32 +INLINE INT64 _mul_32x32(INT32 a, INT32 b) +{ + // in theory this should work, but it is untested + __asm + { + mov eax,a + imul b + // leave results in edx:eax + } +} +#endif + + +/*------------------------------------------------- + mulu_32x32 - perform an unsigned 32 bit x + 32 bit multiply and return the full 64 bit + result +-------------------------------------------------*/ + +#ifndef PTR64 +#define mulu_32x32 _mulu_32x32 +INLINE UINT64 _mulu_32x32(UINT32 a, UINT32 b) +{ + // in theory this should work, but it is untested + __asm + { + mov eax,a + mul b + // leave results in edx:eax + } +} +#endif + + +/*------------------------------------------------- + mul_32x32_hi - perform a signed 32 bit x 32 bit + multiply and return the upper 32 bits of the + result +-------------------------------------------------*/ + +#ifndef PTR64 +#define mul_32x32_hi _mul_32x32_hi +INLINE INT32 _mul_32x32_hi(INT32 a, INT32 b) +{ + INT32 result; + + __asm + { + mov eax,a + imul b + mov result,edx + } + + return result; +} +#endif + + +/*------------------------------------------------- + mulu_32x32_hi - perform an unsigned 32 bit x + 32 bit multiply and return the upper 32 bits + of the result +-------------------------------------------------*/ + +#ifndef PTR64 +#define mulu_32x32_hi _mulu_32x32_hi +INLINE UINT32 _mulu_32x32_hi(UINT32 a, UINT32 b) +{ + INT32 result; + + __asm + { + mov eax,a + mul b + mov result,edx + } + + return result; +} +#endif + + +/*------------------------------------------------- + mul_32x32_shift - perform a signed 32 bit x + 32 bit multiply and shift the result by the + given number of bits before truncating the + result to 32 bits +-------------------------------------------------*/ + +#ifndef PTR64 +#define mul_32x32_shift _mul_32x32_shift +INLINE INT32 _mul_32x32_shift(INT32 a, INT32 b, UINT8 shift) +{ + INT32 result; + + __asm + { + mov eax,a + imul b + mov cl,shift + shrd eax,edx,cl + mov result,eax + } + + return result; +} +#endif + + +/*------------------------------------------------- + mulu_32x32_shift - perform an unsigned 32 bit x + 32 bit multiply and shift the result by the + given number of bits before truncating the + result to 32 bits +-------------------------------------------------*/ + +#ifndef PTR64 +#define mulu_32x32_shift _mulu_32x32_shift +INLINE UINT32 _mulu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift) +{ + INT32 result; + + __asm + { + mov eax,a + mul b + mov cl,shift + shrd eax,edx,cl + mov result,eax + } + + return result; +} +#endif + + +/*------------------------------------------------- + div_64x32 - perform a signed 64 bit x 32 bit + divide and return the 32 bit quotient +-------------------------------------------------*/ + +#ifndef PTR64 +#define div_64x32 _div_64x32 +INLINE INT32 _div_64x32(INT64 a, INT32 b) +{ + INT32 result; + INT32 alow = a; + INT32 ahigh = a >> 32; + + __asm + { + mov eax,alow + mov edx,ahigh + idiv b + mov result,eax + } + + return result; +} +#endif + + +/*------------------------------------------------- + divu_64x32 - perform an unsigned 64 bit x 32 bit + divide and return the 32 bit quotient +-------------------------------------------------*/ + +#ifndef PTR64 +#define divu_64x32 _divu_64x32 +INLINE UINT32 _divu_64x32(UINT64 a, UINT32 b) +{ + UINT32 result; + UINT32 alow = a; + UINT32 ahigh = a >> 32; + + __asm + { + mov eax,alow + mov edx,ahigh + div b + mov result,eax + } + + return result; +} +#endif + + +/*------------------------------------------------- + div_64x32_rem - perform a signed 64 bit x 32 + bit divide and return the 32 bit quotient and + 32 bit remainder +-------------------------------------------------*/ + +#ifndef PTR64 +#define div_64x32_rem _div_64x32_rem +INLINE INT32 _div_64x32_rem(INT64 a, INT32 b, INT32 *remainder) +{ + INT32 result; + INT32 alow = a; + INT32 ahigh = a >> 32; + INT32 rem; + + __asm + { + mov eax,alow + mov edx,ahigh + idiv b + mov result,eax + mov rem,edx + } + + *remainder = rem; + return result; +} +#endif + + +/*------------------------------------------------- + divu_64x32_rem - perform an unsigned 64 bit x + 32 bit divide and return the 32 bit quotient + and 32 bit remainder +-------------------------------------------------*/ + +#ifndef PTR64 +#define divu_64x32_rem _divu_64x32_rem +INLINE UINT32 _divu_64x32_rem(UINT64 a, UINT32 b, UINT32 *remainder) +{ + UINT32 result; + UINT32 alow = a; + UINT32 ahigh = a >> 32; + UINT32 rem; + + __asm + { + mov eax,alow + mov edx,ahigh + div b + mov result,eax + mov rem,edx + } + + *remainder = rem; + return result; +} +#endif + + +/*------------------------------------------------- + div_32x32_shift - perform a signed divide of + two 32 bit values, shifting the first before + division, and returning the 32 bit quotient +-------------------------------------------------*/ + +#ifndef PTR64 +#define div_32x32_shift _div_32x32_shift +INLINE INT32 _div_32x32_shift(INT32 a, INT32 b, UINT8 shift) +{ + INT32 result; + + __asm + { + mov eax,a + cdq + mov cl,shift + shld edx,eax,cl + shl eax,cl + idiv b + mov result,eax + } + + return result; +} +#endif + + +/*------------------------------------------------- + divu_32x32_shift - perform an unsigned divide of + two 32 bit values, shifting the first before + division, and returning the 32 bit quotient +-------------------------------------------------*/ + +#ifndef PTR64 +#define divu_32x32_shift _divu_32x32_shift +INLINE UINT32 _divu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift) +{ + UINT32 result; + + __asm + { + mov eax,a + xor edx,edx + mov cl,shift + shld edx,eax,cl + shl eax,cl + div b + mov result,eax + } + + return result; +} +#endif + + +/*------------------------------------------------- + mod_64x32 - perform a signed 64 bit x 32 bit + divide and return the 32 bit remainder +-------------------------------------------------*/ + +#ifndef PTR64 +#define mod_64x32 _mod_64x32 +INLINE INT32 _mod_64x32(INT64 a, INT32 b) +{ + INT32 result; + INT32 alow = a; + INT32 ahigh = a >> 32; + + __asm + { + mov eax,alow + mov edx,ahigh + idiv b + mov result,edx + } + + return result; +} +#endif + + +/*------------------------------------------------- + modu_64x32 - perform an unsigned 64 bit x 32 bit + divide and return the 32 bit remainder +-------------------------------------------------*/ + +#ifndef PTR64 +#define modu_64x32 _modu_64x32 +INLINE UINT32 _modu_64x32(UINT64 a, UINT32 b) +{ + UINT32 result; + UINT32 alow = a; + UINT32 ahigh = a >> 32; + + __asm + { + mov eax,alow + mov edx,ahigh + div b + mov result,edx + } + + return result; +} +#endif + + +/*------------------------------------------------- + recip_approx - compute an approximate floating + point reciprocal +-------------------------------------------------*/ + +#ifdef PTR64 +#define recip_approx _recip_approx +INLINE float _recip_approx(float z) +{ + __m128 mz = _mm_set_ss(z); + __m128 mooz = _mm_rcp_ss(mz); + float ooz; + _mm_store_ss(&ooz, mooz); + return ooz; +} +#endif + + + +/*************************************************************************** + INLINE BIT MANIPULATION FUNCTIONS +***************************************************************************/ + +/*------------------------------------------------- + count_leading_zeros - return the number of + leading zero bits in a 32-bit value +-------------------------------------------------*/ + +#ifndef PTR64 +#define count_leading_zeros _count_leading_zeros +INLINE UINT8 _count_leading_zeros(UINT32 value) +{ + INT32 result; + + __asm + { + bsr eax,value + jnz skip + mov eax,63 + skip: + xor eax,31 + mov result,eax + } + + return result; +} +#endif + + +/*------------------------------------------------- + count_leading_ones - return the number of + leading one bits in a 32-bit value +-------------------------------------------------*/ + +#ifndef PTR64 +#define count_leading_ones _count_leading_ones +INLINE UINT8 _count_leading_ones(UINT32 value) +{ + INT32 result; + + __asm + { + mov eax,value + not eax + bsr eax,eax + jnz skip + mov eax,63 + skip: + xor eax,31 + mov result,eax + } + + return result; +} +#endif + +#endif /* __EIVCX86__ */ diff --git a/src/osd/windows/osinline.h b/src/osd/windows/osinline.h index e6131724886..6839638a7a9 100644 --- a/src/osd/windows/osinline.h +++ b/src/osd/windows/osinline.h @@ -2,7 +2,7 @@ // // osinline.h // -// x86 inline implementations for MSVC compiler. +// Inline implementations for non-GCC Win32 compilers // // Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. @@ -12,551 +12,41 @@ #ifndef __OSINLINE__ #define __OSINLINE__ -#ifdef PTR64 -#include <intrin.h> -#pragma intrinsic(_BitScanReverse) -#else -#pragma intrinsic(_InterlockedCompareExchange) -#pragma intrinsic(_InterlockedExchange) -#pragma intrinsic(_InterlockedExchangeAdd) -#endif - - -/*************************************************************************** - INLINE MATH FUNCTIONS -***************************************************************************/ - -/*------------------------------------------------- - mul_32x32 - perform a signed 32 bit x 32 bit - multiply and return the full 64 bit result --------------------------------------------------*/ - -#ifndef PTR64 -#define mul_32x32 _mul_32x32 -INLINE INT64 _mul_32x32(INT32 a, INT32 b) -{ - // in theory this should work, but it is untested - __asm - { - mov eax,a - imul b - // leave results in edx:eax - } -} -#endif - - -/*------------------------------------------------- - mulu_32x32 - perform an unsigned 32 bit x - 32 bit multiply and return the full 64 bit - result --------------------------------------------------*/ - -#ifndef PTR64 -#define mulu_32x32 _mulu_32x32 -INLINE UINT64 _mulu_32x32(UINT32 a, UINT32 b) -{ - // in theory this should work, but it is untested - __asm - { - mov eax,a - mul b - // leave results in edx:eax - } -} -#endif - - -/*------------------------------------------------- - mul_32x32_hi - perform a signed 32 bit x 32 bit - multiply and return the upper 32 bits of the - result --------------------------------------------------*/ - -#ifndef PTR64 -#define mul_32x32_hi _mul_32x32_hi -INLINE INT32 _mul_32x32_hi(INT32 a, INT32 b) -{ - INT32 result; - - __asm - { - mov eax,a - imul b - mov result,edx - } - - return result; -} -#endif - - -/*------------------------------------------------- - mulu_32x32_hi - perform an unsigned 32 bit x - 32 bit multiply and return the upper 32 bits - of the result --------------------------------------------------*/ - -#ifndef PTR64 -#define mulu_32x32_hi _mulu_32x32_hi -INLINE UINT32 _mulu_32x32_hi(UINT32 a, UINT32 b) -{ - INT32 result; - - __asm - { - mov eax,a - mul b - mov result,edx - } - - return result; -} -#endif - - -/*------------------------------------------------- - mul_32x32_shift - perform a signed 32 bit x - 32 bit multiply and shift the result by the - given number of bits before truncating the - result to 32 bits --------------------------------------------------*/ - -#ifndef PTR64 -#define mul_32x32_shift _mul_32x32_shift -INLINE INT32 _mul_32x32_shift(INT32 a, INT32 b, UINT8 shift) -{ - INT32 result; - - __asm - { - mov eax,a - imul b - mov cl,shift - shrd eax,edx,cl - mov result,eax - } - - return result; -} +#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) +#include "eivcx86.h" #endif - -/*------------------------------------------------- - mulu_32x32_shift - perform an unsigned 32 bit x - 32 bit multiply and shift the result by the - given number of bits before truncating the - result to 32 bits --------------------------------------------------*/ - -#ifndef PTR64 -#define mulu_32x32_shift _mulu_32x32_shift -INLINE UINT32 _mulu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift) -{ - INT32 result; - - __asm - { - mov eax,a - mul b - mov cl,shift - shrd eax,edx,cl - mov result,eax - } - - return result; -} -#endif - - -/*------------------------------------------------- - div_64x32 - perform a signed 64 bit x 32 bit - divide and return the 32 bit quotient --------------------------------------------------*/ - -#ifndef PTR64 -#define div_64x32 _div_64x32 -INLINE INT32 _div_64x32(INT64 a, INT32 b) -{ - INT32 result; - INT32 alow = a; - INT32 ahigh = a >> 32; - - __asm - { - mov eax,alow - mov edx,ahigh - idiv b - mov result,eax - } - - return result; -} -#endif - - -/*------------------------------------------------- - divu_64x32 - perform an unsigned 64 bit x 32 bit - divide and return the 32 bit quotient --------------------------------------------------*/ - -#ifndef PTR64 -#define divu_64x32 _divu_64x32 -INLINE UINT32 _divu_64x32(UINT64 a, UINT32 b) -{ - UINT32 result; - UINT32 alow = a; - UINT32 ahigh = a >> 32; - - __asm - { - mov eax,alow - mov edx,ahigh - div b - mov result,eax - } - - return result; -} -#endif - - -/*------------------------------------------------- - div_64x32_rem - perform a signed 64 bit x 32 - bit divide and return the 32 bit quotient and - 32 bit remainder --------------------------------------------------*/ - -#ifndef PTR64 -#define div_64x32_rem _div_64x32_rem -INLINE INT32 _div_64x32_rem(INT64 a, INT32 b, INT32 *remainder) -{ - INT32 result; - INT32 alow = a; - INT32 ahigh = a >> 32; - INT32 rem; - - __asm - { - mov eax,alow - mov edx,ahigh - idiv b - mov result,eax - mov rem,edx - } - - *remainder = rem; - return result; -} -#endif - - -/*------------------------------------------------- - divu_64x32_rem - perform an unsigned 64 bit x - 32 bit divide and return the 32 bit quotient - and 32 bit remainder --------------------------------------------------*/ - -#ifndef PTR64 -#define divu_64x32_rem _divu_64x32_rem -INLINE UINT32 _divu_64x32_rem(UINT64 a, UINT32 b, UINT32 *remainder) -{ - UINT32 result; - UINT32 alow = a; - UINT32 ahigh = a >> 32; - UINT32 rem; - - __asm - { - mov eax,alow - mov edx,ahigh - div b - mov result,eax - mov rem,edx - } - - *remainder = rem; - return result; -} +#if defined(_MSC_VER) +#include "eivc.h" #endif - -/*------------------------------------------------- - div_32x32_shift - perform a signed divide of - two 32 bit values, shifting the first before - division, and returning the 32 bit quotient --------------------------------------------------*/ - -#ifndef PTR64 -#define div_32x32_shift _div_32x32_shift -INLINE INT32 _div_32x32_shift(INT32 a, INT32 b, UINT8 shift) -{ - INT32 result; - - __asm - { - mov eax,a - cdq - mov cl,shift - shld edx,eax,cl - shl eax,cl - idiv b - mov result,eax - } - - return result; -} -#endif - - -/*------------------------------------------------- - divu_32x32_shift - perform an unsigned divide of - two 32 bit values, shifting the first before - division, and returning the 32 bit quotient --------------------------------------------------*/ - -#ifndef PTR64 -#define divu_32x32_shift _divu_32x32_shift -INLINE UINT32 _divu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift) -{ - UINT32 result; - - __asm - { - mov eax,a - xor edx,edx - mov cl,shift - shld edx,eax,cl - shl eax,cl - div b - mov result,eax - } - - return result; -} -#endif - - -/*------------------------------------------------- - mod_64x32 - perform a signed 64 bit x 32 bit - divide and return the 32 bit remainder --------------------------------------------------*/ - -#ifndef PTR64 -#define mod_64x32 _mod_64x32 -INLINE INT32 _mod_64x32(INT64 a, INT32 b) -{ - INT32 result; - INT32 alow = a; - INT32 ahigh = a >> 32; - - __asm - { - mov eax,alow - mov edx,ahigh - idiv b - mov result,edx - } - - return result; -} -#endif - - -/*------------------------------------------------- - modu_64x32 - perform an unsigned 64 bit x 32 bit - divide and return the 32 bit remainder --------------------------------------------------*/ - -#ifndef PTR64 -#define modu_64x32 _modu_64x32 -INLINE UINT32 _modu_64x32(UINT64 a, UINT32 b) -{ - UINT32 result; - UINT32 alow = a; - UINT32 ahigh = a >> 32; - - __asm - { - mov eax,alow - mov edx,ahigh - div b - mov result,edx - } - - return result; -} -#endif - - -/*------------------------------------------------- - recip_approx - compute an approximate floating - point reciprocal --------------------------------------------------*/ +INT32 win_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange); +INT32 win_atomic_exchange32(INT32 volatile *ptr, INT32 exchange); +INT32 win_atomic_add32(INT32 volatile *ptr, INT32 delta); #ifdef PTR64 -#define recip_approx _recip_approx -INLINE float _recip_approx(float z) -{ - __m128 mz = _mm_set_ss(z); - __m128 mooz = _mm_rcp_ss(mz); - float ooz; - _mm_store_ss(&ooz, mooz); - return ooz; -} +INT64 win_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange); #endif +#ifndef compare_exchange32 +#define compare_exchange32 win_compare_exchange32 +#endif /* compare_exchange32 */ -/*************************************************************************** - INLINE BIT MANIPULATION FUNCTIONS -***************************************************************************/ - -/*------------------------------------------------- - count_leading_zeros - return the number of - leading zero bits in a 32-bit value --------------------------------------------------*/ - -#define count_leading_zeros _count_leading_zeros -INLINE UINT8 _count_leading_zeros(UINT32 value) -{ #ifdef PTR64 - UINT32 index; - return _BitScanReverse(&index, value) ? (index ^ 31) : 32; -#else - INT32 result; - - __asm - { - bsr eax,value - jnz skip - mov eax,63 - skip: - xor eax,31 - mov result,eax - } - - return result; -#endif -} - - -/*------------------------------------------------- - count_leading_ones - return the number of - leading one bits in a 32-bit value --------------------------------------------------*/ - -#define count_leading_ones _count_leading_ones -INLINE UINT8 _count_leading_ones(UINT32 value) -{ -#ifdef PTR64 - UINT32 index; - return _BitScanReverse(&index, ~value) ? (index ^ 31) : 32; -#else - INT32 result; - - __asm - { - mov eax,value - not eax - bsr eax,eax - jnz skip - mov eax,63 - skip: - xor eax,31 - mov result,eax - } - - return result; +#ifndef compare_exchange64 +#define compare_exchange64 win_compare_exchange64 +#endif /* compare_exchange64 */ #endif -} - - - -/*************************************************************************** - INLINE SYNCHRONIZATION FUNCTIONS -***************************************************************************/ - -/*------------------------------------------------- - compare_exchange32 - compare the 'compare' - value against the memory at 'ptr'; if equal, - swap in the 'exchange' value. Regardless, - return the previous value at 'ptr'. --------------------------------------------------*/ - -#define compare_exchange32 _compare_exchange32 -INLINE INT32 _compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange) -{ - return _InterlockedCompareExchange(ptr, exchange, compare); -} - - -/*------------------------------------------------- - compare_exchange64 - compare the 'compare' - value against the memory at 'ptr'; if equal, - swap in the 'exchange' value. Regardless, - return the previous value at 'ptr'. --------------------------------------------------*/ - -#ifdef PTR64 -#define compare_exchange64 _compare_exchange64 -INLINE INT64 _compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange) -{ - return _InterlockedCompareExchange64(ptr, exchange, compare); -} -#endif - - -/*------------------------------------------------- - atomic_exchange32 - atomically exchange the - exchange value with the memory at 'ptr', - returning the original value. --------------------------------------------------*/ - -#define atomic_exchange32 _atomic_exchange32 -INLINE INT32 _atomic_exchange32(INT32 volatile *ptr, INT32 exchange) -{ - return _InterlockedExchange(ptr, exchange); -} - - -/*------------------------------------------------- - atomic_add32 - atomically add the delta value - to the memory at 'ptr', returning the final - result. --------------------------------------------------*/ - -#define atomic_add32 _atomic_add32 -INLINE INT32 _atomic_add32(INT32 volatile *ptr, INT32 delta) -{ - return _InterlockedExchangeAdd(ptr, delta) + delta; -} - - -/*------------------------------------------------- - atomic_increment32 - atomically increment the - 32-bit value in memory at 'ptr', returning the - final result. --------------------------------------------------*/ - -#define atomic_increment32 _atomic_increment32 -INLINE INT32 _atomic_increment32(INT32 volatile *ptr) -{ - return _InterlockedIncrement(ptr); -} +#ifndef atomic_exchange32 +#define atomic_exchange32 win_atomic_exchange32 +#endif /* atomic_exchange32 */ -/*------------------------------------------------- - atomic_decrement32 - atomically decrement the - 32-bit value in memory at 'ptr', returning the - final result. --------------------------------------------------*/ -#define atomic_decrement32 _atomic_decrement32 -INLINE INT32 _atomic_decrement32(INT32 volatile *ptr) -{ - return _InterlockedDecrement(ptr); -} +#ifndef atomic_add32 +#define atomic_add32 win_atomic_add32 +#endif /* atomic_add32 */ #endif /* __OSINLINE__ */ diff --git a/src/osd/windows/vconv.c b/src/osd/windows/vconv.c index 2f034f2d369..039dcb082f3 100644 --- a/src/osd/windows/vconv.c +++ b/src/osd/windows/vconv.c @@ -74,13 +74,15 @@ static const translation_info gcc_translate[] = { 0, "-W*", "" }, { VS2005, "-march=*", "" }, // deprecated in VS2005 { 0, "-march=pentium", "/G5" }, - { 0, "-march=athlon", "/G7" }, { 0, "-march=pentiumpro", "/G6" }, + { 0, "-march=pentium3", "/G6" }, + { 0, "-march=pentium-m", "/G6" }, + { 0, "-march=athlon", "/G7" }, { 0, "-march=pentium4", "/G7" }, { 0, "-march=athlon64", "/G7" }, - { 0, "-march=pentium3", "/G6" }, { VS71, "-msse2", "/arch:SSE2" }, { 0, "-msse2", "" }, + { 0, "-msse3", "" }, { 0, "-mwindows", "" }, { 0, "-mno-cygwin", "" }, { 0, "-std=gnu89", "" }, diff --git a/src/osd/windows/winalloc.c b/src/osd/windows/winalloc.c index a355ebca3c8..c54eda5e768 100644 --- a/src/osd/windows/winalloc.c +++ b/src/osd/windows/winalloc.c @@ -30,9 +30,6 @@ #define PAGE_SIZE 4096 #define COOKIE_VAL 0x11335577 -// set this to 0 to not use guard pages -#define USE_GUARD_PAGES 1 - // set this to 1 to align memory blocks to the start of a page; // otherwise, they are aligned to the end, thus catching array // overruns @@ -188,6 +185,20 @@ INLINE void free_entry(memory_entry *entry) } +INLINE int use_malloc_tracking(void) +{ +#ifdef MESS + extern BOOL win_is_gui_application(void); + return !win_is_gui_application(); +#elif defined(WINUI) + return FALSE; +#else + return TRUE; +#endif + +} + + //============================================================ // IMPLEMENTATION @@ -195,12 +206,15 @@ INLINE void free_entry(memory_entry *entry) void *malloc_file_line(size_t size, const char *file, int line) { - UINT8 *page_base, *block_base; - size_t rounded_size; - memory_entry *entry; + UINT8 *block_base; + int id = current_id++; - if (USE_GUARD_PAGES) + if (use_malloc_tracking()) { + UINT8 *page_base; + size_t rounded_size; + memory_entry *entry; + // round the size up to a page boundary rounded_size = ((size + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE; @@ -219,29 +233,27 @@ void *malloc_file_line(size_t size, const char *file, int line) block_base = page_base; else block_base = page_base + rounded_size - size; + + // fill in the entry + entry = allocate_entry(); + entry->size = size; + entry->base = block_base; + entry->file = file; + entry->line = line; + entry->id = id; } else { block_base = (UINT8 *)GlobalAlloc(GMEM_FIXED, size); } - // fill in the entry - entry = allocate_entry(); - entry->size = size; - entry->base = block_base; - entry->file = file; - entry->line = line; - entry->id = current_id++; - -//if (entry->size == 72 && IsDebuggerPresent()) DebugBreak(); - #if LOG_CALLS // logging - if (entry->file) - logerror("malloc #%06d size = %d (%s:%d)\n", entry->size, entry->file, entry->line); + if (file != NULL) + logerror("malloc #%06d size = %d (%s:%d)\n", id, size, file, line); else - logerror("malloc #%06d size = %d\n", entry->id, entry->size); -#endif + logerror("malloc #%06d size = %d\n", id, size); +#endif // LOG_CALLS return block_base; } @@ -283,34 +295,41 @@ void *realloc_file_line(void *memory, size_t size, const char *file, int line) { void *newmemory = NULL; - // if size is non-zero, we need to reallocate memory - if (size != 0) + if (use_malloc_tracking()) { - // allocate space for the new amount - newmemory = malloc_file_line(size, file, line); - if (newmemory == NULL) - return NULL; - - // if we have an old pointer, copy it - if (memory != NULL) + // if size is non-zero, we need to reallocate memory + if (size != 0) { - memory_entry *entry = find_entry(memory); - if (entry == NULL) + // allocate space for the new amount + newmemory = malloc_file_line(size, file, line); + if (newmemory == NULL) + return NULL; + + // if we have an old pointer, copy it + if (memory != NULL) { - if (winalloc_in_main_code) + memory_entry *entry = find_entry(memory); + if (entry == NULL) { - fprintf(stderr, "Error: realloc a non-existant block (%s:%d)\n", file, line); - osd_break_into_debugger("Error: realloc a non-existant block\n"); + if (winalloc_in_main_code) + { + fprintf(stderr, "Error: realloc a non-existant block (%s:%d)\n", file, line); + osd_break_into_debugger("Error: realloc a non-existant block\n"); + } } + else + memcpy(newmemory, memory, (size < entry->size) ? size : entry->size); } - else - memcpy(newmemory, memory, (size < entry->size) ? size : entry->size); } - } - // if we have an original pointer, free it - if (memory != NULL) - free(memory); + // if we have an original pointer, free it + if (memory != NULL) + free(memory); + } + else + { + newmemory = (void *) GlobalReAlloc(memory, size, GMEM_MOVEABLE); + } return newmemory; } @@ -330,28 +349,32 @@ void CLIB_DECL free(void *memory) if (memory == NULL) return; - // error if no entry found - entry = find_entry(memory); - if (entry == NULL) + if (use_malloc_tracking()) { - if (winalloc_in_main_code) + // error if no entry found + entry = find_entry(memory); + if (entry == NULL) { - fprintf(stderr, "Error: free a non-existant block\n"); - osd_break_into_debugger("Error: free a non-existant block"); + if (winalloc_in_main_code) + { + fprintf(stderr, "Error: free a non-existant block\n"); + osd_break_into_debugger("Error: free a non-existant block"); + } + return; } - return; - } - free_entry(entry); + free_entry(entry); - // free the memory - if (USE_GUARD_PAGES) + // free the memory VirtualFree((UINT8 *)memory - ((size_t)memory & (PAGE_SIZE-1)) - PAGE_SIZE, 0, MEM_RELEASE); - else - GlobalFree(memory); #if LOG_CALLS - logerror("free #%06d size = %d\n", entry->id, entry->size); -#endif + logerror("free #%06d size = %d\n", entry->id, entry->size); +#endif // LOG_CALLS + } + else + { + GlobalFree(memory); + } } @@ -376,20 +399,23 @@ void check_unfreed_mem(void) memory_entry *entry; int total = 0; - memory_lock_acquire(); + if (use_malloc_tracking()) + { + memory_lock_acquire(); - // check for leaked memory - for (entry = alloc_list; entry; entry = entry->next) - if (entry->file != NULL) - { - if (total == 0) - fprintf(stderr, "--- memory leak warning ---\n"); - total += entry->size; - fprintf(stderr, "allocation #%06d, %d bytes (%s:%d)\n", entry->id, entry->size, entry->file, entry->line); - } + // check for leaked memory + for (entry = alloc_list; entry; entry = entry->next) + if (entry->file != NULL) + { + if (total == 0) + fprintf(stderr, "--- memory leak warning ---\n"); + total += entry->size; + fprintf(stderr, "allocation #%06d, %d bytes (%s:%d)\n", entry->id, entry->size, entry->file, entry->line); + } - memory_lock_release(); + memory_lock_release(); - if (total > 0) - fprintf(stderr, "a total of %d bytes were not free()'d\n", total); + if (total > 0) + fprintf(stderr, "a total of %d bytes were not free()'d\n", total); + } } diff --git a/src/osd/windows/windows.mak b/src/osd/windows/windows.mak index be5bc9c4948..d969bc490aa 100644 --- a/src/osd/windows/windows.mak +++ b/src/osd/windows/windows.mak @@ -152,11 +152,9 @@ DEFS += -Dmain=utf8_main # debug build: enable guard pages on all memory allocations ifdef DEBUG -ifndef WINUI DEFS += -DMALLOC_DEBUG LDFLAGS += -Wl,--allow-multiple-definition endif -endif # enable UNICODE flags for unicode builds ifdef UNICODE diff --git a/src/osd/windows/winsync.c b/src/osd/windows/winsync.c index 4d86d2ef061..ac84373e43d 100644 --- a/src/osd/windows/winsync.c +++ b/src/osd/windows/winsync.c @@ -132,26 +132,43 @@ void osd_lock_free(osd_lock *lock) //============================================================ -// osd_compare_exchange32 +// win_compare_exchange32 //============================================================ -#ifndef osd_compare_exchange32 -INT32 osd_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange) +INT32 win_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange) { return InterlockedCompareExchange((LPLONG)ptr, (LONG)exchange, (LONG)compare); } -#endif //============================================================ -// osd_compare_exchange64 +// win_compare_exchange64 //============================================================ #ifdef PTR64 -#ifndef osd_compare_exchange64 -INT64 osd_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange) +INT64 win_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange) { return InterlockedCompareExchange64((LONGLONG*)ptr, (LONGLONG)exchange, (LONGLONG)compare); } #endif -#endif + + +//============================================================ +// win_atomic_exchange32 +//============================================================ + +INT32 win_atomic_exchange32(INT32 volatile *ptr, INT32 exchange) +{ + return InterlockedExchange((LONG *) ptr, exchange); +} + + +//============================================================ +// win_atomic_add32 +//============================================================ + +INT32 win_atomic_add32(INT32 volatile *ptr, INT32 delta) +{ + return InterlockedExchangeAdd((LONG *) ptr, delta) + delta; +} + diff --git a/src/version.c b/src/version.c index 3986e082bbc..d780ea24ab1 100644 --- a/src/version.c +++ b/src/version.c @@ -9,4 +9,4 @@ ***************************************************************************/ -char build_version[] = "0.121 ("__DATE__")"; +char build_version[] = "0.121u1 ("__DATE__")"; |