diff --git a/src/emu/cpu/adsp2100/adsp2100.c b/src/emu/cpu/adsp2100/adsp2100.c index f6fb8aea7db..94cbc14f7b8 100644 --- a/src/emu/cpu/adsp2100/adsp2100.c +++ b/src/emu/cpu/adsp2100/adsp2100.c @@ -319,7 +319,7 @@ INLINE void WWORD_PGM(UINT32 addr, UINT32 data) program_write_dword_32le(addr << 2, data & 0xffffff); } -#define ROPCODE(a) cpu_readop32((a)->pc << 2) +#define ROPCODE(a) program_decrypted_read_dword((a)->pc << 2) #define CHANGEPC(a) change_pc((a)->pc << 2) diff --git a/src/emu/cpu/alph8201/alph8201.h b/src/emu/cpu/alph8201/alph8201.h index 34940f3b184..21f52072c2c 100644 --- a/src/emu/cpu/alph8201/alph8201.h +++ b/src/emu/cpu/alph8201/alph8201.h @@ -59,14 +59,14 @@ extern CPU_GET_INFO( alpha8301 ); * opcodes. In case of system with memory mapped I/O, this function can be * used to greatly speed up emulation */ -#define ALPHA8201_RDOP(A) ((unsigned)cpu_readop(A)) +#define ALPHA8201_RDOP(A) ((unsigned)program_decrypted_read_byte(A)) /* * ALPHA8201_RDOP_ARG() is identical to ALPHA8201_RDOP() except it is used for reading * opcode arguments. This difference can be used to support systems that * use different encoding mechanisms for opcodes and opcode arguments */ -#define ALPHA8201_RDOP_ARG(A) ((unsigned)cpu_readop_arg(A)) +#define ALPHA8201_RDOP_ARG(A) ((unsigned)program_raw_read_byte(A)) CPU_DISASSEMBLE( ALPHA8201 ); diff --git a/src/emu/cpu/arm/arm.c b/src/emu/cpu/arm/arm.c index 53a1ecc1c27..fbf37c31e82 100644 --- a/src/emu/cpu/arm/arm.c +++ b/src/emu/cpu/arm/arm.c @@ -329,7 +329,7 @@ static CPU_EXECUTE( arm ) /* load instruction */ pc = R15; - insn = cpu_readop32( pc & ADDRESS_MASK ); + insn = program_decrypted_read_dword( pc & ADDRESS_MASK ); switch (insn >> INSN_COND_SHIFT) { diff --git a/src/emu/cpu/arm7/arm7exec.c b/src/emu/cpu/arm7/arm7exec.c index 9e5af22cd00..56a864fbe0e 100644 --- a/src/emu/cpu/arm7/arm7exec.c +++ b/src/emu/cpu/arm7/arm7exec.c @@ -58,7 +58,7 @@ INT32 offs; pc = R15; - insn = cpu_readop16(pc & (~1)); + insn = program_decrypted_read_word(pc & (~1)); ARM7_ICOUNT -= (3 - thumbCycles[insn >> 8]); switch ((insn & THUMB_INSN_TYPE) >> THUMB_INSN_TYPE_SHIFT) { @@ -1168,7 +1168,7 @@ /* load 32 bit instruction */ pc = R15; - insn = cpu_readop32(pc); + insn = program_decrypted_read_dword(pc); /* process condition codes for this instruction */ switch (insn >> INSN_COND_SHIFT) diff --git a/src/emu/cpu/asap/asap.c b/src/emu/cpu/asap/asap.c index 5d9267230fe..07e61865ad6 100644 --- a/src/emu/cpu/asap/asap.c +++ b/src/emu/cpu/asap/asap.c @@ -267,7 +267,7 @@ static void (*const conditiontable[16])(void) = MEMORY ACCESSORS ***************************************************************************/ -#define ROPCODE(pc) cpu_readop32(pc) +#define ROPCODE(pc) program_decrypted_read_dword(pc) #define UPDATEPC() change_pc(asap.pc) diff --git a/src/emu/cpu/asap/asapdasm.c b/src/emu/cpu/asap/asapdasm.c index 6d27d6f20c8..85aba5d7d22 100644 --- a/src/emu/cpu/asap/asapdasm.c +++ b/src/emu/cpu/asap/asapdasm.c @@ -32,7 +32,7 @@ static const char *const condition[16] = MEMORY ACCESSORS ***************************************************************************/ -#define ROPCODE(pc) cpu_readop32(pc) +#define ROPCODE(pc) program_decrypted_read_dword(pc) /*************************************************************************** diff --git a/src/emu/cpu/ccpu/ccpu.c b/src/emu/cpu/ccpu/ccpu.c index 5940a0dd1f7..14c83f1c825 100644 --- a/src/emu/cpu/ccpu/ccpu.c +++ b/src/emu/cpu/ccpu/ccpu.c @@ -55,7 +55,7 @@ static int ccpu_icount; MACROS ***************************************************************************/ -#define READOP(a) (cpu_readop(a)) +#define READOP(a) (program_decrypted_read_byte(a)) #define RDMEM(a) (data_read_word_16be((a) * 2) & 0xfff) #define WRMEM(a,v) (data_write_word_16be((a) * 2, (v))) diff --git a/src/emu/cpu/cdp1802/cdp1802.c b/src/emu/cpu/cdp1802/cdp1802.c index 1abfd5e78b3..4da8b6068d0 100644 --- a/src/emu/cpu/cdp1802/cdp1802.c +++ b/src/emu/cpu/cdp1802/cdp1802.c @@ -128,7 +128,7 @@ INLINE void cdp1802_short_branch(int taken) { if (taken) { - R[P] = (R[P] & 0xff00) | cpu_readop(R[P]); + R[P] = (R[P] & 0xff00) | program_decrypted_read_byte(R[P]); } else { @@ -142,12 +142,12 @@ INLINE void cdp1802_long_branch(int taken) { // S1#1 - B = cpu_readop(R[P]); + B = program_decrypted_read_byte(R[P]); R[P] = R[P] + 1; // S1#2 - R[P] = (B << 8) | cpu_readop(R[P]); + R[P] = (B << 8) | program_decrypted_read_byte(R[P]); } else { @@ -263,7 +263,7 @@ static void cdp1802_run(running_machine *machine) case CDP1802_STATE_0_FETCH: { - UINT8 opcode = cpu_readop(R[P]); + UINT8 opcode = program_decrypted_read_byte(R[P]); I = opcode >> 4; N = opcode & 0x0f; diff --git a/src/emu/cpu/cop400/410ops.c b/src/emu/cpu/cop400/410ops.c index f8a900db71c..32a18b185a8 100644 --- a/src/emu/cpu/cop400/410ops.c +++ b/src/emu/cpu/cop400/410ops.c @@ -11,7 +11,7 @@ #define INSTRUCTION(mnemonic) INLINE void (mnemonic)(UINT8 opcode) -#define ROM(addr) cpu_readop(addr) +#define ROM(addr) program_decrypted_read_byte(addr) #define RAM_W(addr, value) (data_write_byte_8le(addr, value)) #define RAM_R(addr) (data_read_byte_8le(addr)) diff --git a/src/emu/cpu/cubeqcpu/cubeqcpu.c b/src/emu/cpu/cubeqcpu/cubeqcpu.c index ba2b92f21e1..e198011fc3a 100644 --- a/src/emu/cpu/cubeqcpu/cubeqcpu.c +++ b/src/emu/cpu/cubeqcpu/cubeqcpu.c @@ -549,7 +549,7 @@ static CPU_EXECUTE( cquestsnd ) do { /* Decode the instruction */ - UINT64 inst = cpu_readop64(SND_PC << 3); + UINT64 inst = program_decrypted_read_qword(SND_PC << 3); UINT32 inslow = inst & 0xffffffff; UINT32 inshig = inst >> 32; @@ -883,7 +883,7 @@ static CPU_EXECUTE( cquestrot ) do { /* Decode the instruction */ - UINT64 inst = cpu_readop64(ROT_PC << 3); + UINT64 inst = program_decrypted_read_qword(ROT_PC << 3); UINT32 inslow = inst & 0xffffffff; UINT32 inshig = inst >> 32; @@ -1405,7 +1405,7 @@ static CPU_EXECUTE( cquestlin ) /* Are we executing the foreground or backgroud program? */ int prog = (cquestlin.clkcnt & 3) ? BACKGROUND : FOREGROUND; - UINT64 inst = cpu_readop64(LINE_PC << 3); + UINT64 inst = program_decrypted_read_qword(LINE_PC << 3); UINT32 inslow = inst & 0xffffffff; UINT32 inshig = inst >> 32; diff --git a/src/emu/cpu/drcfe.c b/src/emu/cpu/drcfe.c index 296bcdf9179..ff68068aaed 100644 --- a/src/emu/cpu/drcfe.c +++ b/src/emu/cpu/drcfe.c @@ -57,6 +57,7 @@ struct _drcfe_state /* CPU parameters */ const device_config *device; /* CPU device object */ + const address_space *program; /* program address space for this CPU */ offs_t pageshift; /* shift to convert address to a page index */ cpu_translate_func translate; /* pointer to translation function */ offs_t codexor; /* XOR to reach code */ @@ -144,6 +145,7 @@ drcfe_state *drcfe_init(const device_config *cpu, const drcfe_config *config, vo /* initialize the state */ drcfe->device = cpu; + drcfe->program = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM); drcfe->pageshift = cpu_get_page_shift(cpu, ADDRESS_SPACE_PROGRAM); drcfe->translate = (cpu_translate_func)cpu_get_info_fct(cpu, CPUINFO_PTR_TRANSLATE); #ifdef LSB_FIRST @@ -299,8 +301,8 @@ static opcode_desc *describe_one(drcfe_state *drcfe, offs_t curpc, const opcode_ } /* get a pointer to the physical address */ - memory_set_opbase(desc->physpc); - desc->opptr.v = cpu_opptr(desc->physpc ^ drcfe->codexor); + memory_set_direct_region(drcfe->program, desc->physpc); + desc->opptr.v = program_decrypted_read_ptr(desc->physpc ^ drcfe->codexor); assert(desc->opptr.v != NULL); if (desc->opptr.v == NULL) { diff --git a/src/emu/cpu/dsp32/dsp32.c b/src/emu/cpu/dsp32/dsp32.c index 0a342e26229..1c2ae8f3dcc 100644 --- a/src/emu/cpu/dsp32/dsp32.c +++ b/src/emu/cpu/dsp32/dsp32.c @@ -186,6 +186,7 @@ typedef struct int interrupt_cycles; void (*output_pins_changed)(UINT32 pins); const device_config *device; + const address_space *program; } dsp32_regs; @@ -211,7 +212,7 @@ static int dsp32_icount; MEMORY ACCESSORS ***************************************************************************/ -#define ROPCODE(pc) cpu_readop32(pc) +#define ROPCODE(pc) program_decrypted_read_dword(pc) #define RBYTE(addr) program_read_byte_32le(addr) #define WBYTE(addr,data) program_write_byte_32le((addr), data) @@ -335,7 +336,7 @@ static CPU_SET_CONTEXT( dsp32c ) /* copy the context */ if (src) dsp32 = *(dsp32_regs *)src; - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); /* check for IRQs */ check_irqs(); @@ -356,6 +357,7 @@ static CPU_INIT( dsp32c ) dsp32.output_pins_changed = configdata->output_pins_changed; dsp32.device = device; + dsp32.program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM); } @@ -363,7 +365,7 @@ static CPU_RESET( dsp32c ) { /* reset goes to 0 */ dsp32.PC = 0; - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); /* clear some registers */ dsp32.pcw &= 0x03ff; diff --git a/src/emu/cpu/dsp32/dsp32dis.c b/src/emu/cpu/dsp32/dsp32dis.c index d748df49f95..db612939929 100644 --- a/src/emu/cpu/dsp32/dsp32dis.c +++ b/src/emu/cpu/dsp32/dsp32dis.c @@ -13,7 +13,7 @@ MEMORY ACCESSORS ***************************************************************************/ -#define ROPCODE(pc) cpu_readop32(pc) +#define ROPCODE(pc) program_decrypted_read_dword(pc) #define ABS(x) (((x) >= 0) ? (x) : -(x)) diff --git a/src/emu/cpu/dsp32/dsp32ops.c b/src/emu/cpu/dsp32/dsp32ops.c index 8932ff9bb8d..88ae50da3f0 100644 --- a/src/emu/cpu/dsp32/dsp32ops.c +++ b/src/emu/cpu/dsp32/dsp32ops.c @@ -692,7 +692,7 @@ static void nop(void) return; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } @@ -702,7 +702,7 @@ static void goto_t(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } @@ -713,7 +713,7 @@ static void goto_pl(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -725,7 +725,7 @@ static void goto_mi(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -737,7 +737,7 @@ static void goto_ne(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -749,7 +749,7 @@ static void goto_eq(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -761,7 +761,7 @@ static void goto_vc(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -773,7 +773,7 @@ static void goto_vs(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -785,7 +785,7 @@ static void goto_cc(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -797,7 +797,7 @@ static void goto_cs(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -809,7 +809,7 @@ static void goto_ge(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -821,7 +821,7 @@ static void goto_lt(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -833,7 +833,7 @@ static void goto_gt(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -845,7 +845,7 @@ static void goto_le(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -857,7 +857,7 @@ static void goto_hi(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -869,7 +869,7 @@ static void goto_ls(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -881,7 +881,7 @@ static void goto_auc(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -893,7 +893,7 @@ static void goto_aus(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -905,7 +905,7 @@ static void goto_age(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -917,7 +917,7 @@ static void goto_alt(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -929,7 +929,7 @@ static void goto_ane(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -941,7 +941,7 @@ static void goto_aeq(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -953,7 +953,7 @@ static void goto_avc(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -965,7 +965,7 @@ static void goto_avs(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -977,7 +977,7 @@ static void goto_agt(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -989,7 +989,7 @@ static void goto_ale(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -1100,7 +1100,7 @@ static void dec_goto(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } } @@ -1113,7 +1113,7 @@ static void call(void) dsp32.r[mr] = dsp32.PC + 4; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (INT16)op); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } @@ -1122,7 +1122,7 @@ static void goto24(void) UINT32 op = OP; execute_one(); dsp32.PC = TRUNCATE24(REG24((op >> 16) & 0x1f) + (op & 0xffff) + ((op >> 5) & 0xff0000)); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } @@ -1134,7 +1134,7 @@ static void call24(void) dsp32.r[mr] = dsp32.PC + 4; execute_one(); dsp32.PC = (op & 0xffff) + ((op >> 5) & 0xff0000); - memory_set_opbase(dsp32.PC); + memory_set_direct_region(dsp32.program, dsp32.PC); } diff --git a/src/emu/cpu/dsp56k/dsp56k.c b/src/emu/cpu/dsp56k/dsp56k.c index c61ed5c18c0..5a9768b6c21 100644 --- a/src/emu/cpu/dsp56k/dsp56k.c +++ b/src/emu/cpu/dsp56k/dsp56k.c @@ -249,7 +249,7 @@ static int dsp56k_icount; /*************************************************************************** MEMORY ACCESSORS ***************************************************************************/ -#define ROPCODE(pc) cpu_readop16(pc) +#define ROPCODE(pc) program_decrypted_read_word(pc) /*************************************************************************** diff --git a/src/emu/cpu/e132xs/e132xs.h b/src/emu/cpu/e132xs/e132xs.h index 0726e58a62d..2dedbf065b7 100644 --- a/src/emu/cpu/e132xs/e132xs.h +++ b/src/emu/cpu/e132xs/e132xs.h @@ -106,7 +106,7 @@ extern int hyp_type_16bit; #define IO_WRITE_W(addr, data) ((*hyp_cpu_write_io_word)(((addr) >> 11) & 0x7ffc, data)) -#define READ_OP(addr) (cpu_readop16(hyp_type_16bit ? addr: WORD_XOR_BE(addr))) +#define READ_OP(addr) (program_decrypted_read_word(hyp_type_16bit ? addr: WORD_XOR_BE(addr))) /* Registers Number */ diff --git a/src/emu/cpu/f8/f8.c b/src/emu/cpu/f8/f8.c index 824f35e7150..24f3fcf6036 100644 --- a/src/emu/cpu/f8/f8.c +++ b/src/emu/cpu/f8/f8.c @@ -109,7 +109,7 @@ static void ROMC_00(int insttim) /* SKR - added parameter to tell if */ * of PC0. */ - f8.dbus = cpu_readop(f8.pc0); + f8.dbus = program_decrypted_read_byte(f8.pc0); f8.pc0 += 1; f8_icount -= insttim; /* SKR - ROMC00 is usually short, not short+long, */ /* but DS is long */ @@ -123,7 +123,7 @@ static void ROMC_01(void) * location addressed by PC0; then all devices add the 8-bit value * on the data bus as signed binary number to PC0. */ - f8.dbus = cpu_readop_arg(f8.pc0); + f8.dbus = program_raw_read_byte(f8.pc0); f8.pc0 += (INT8)f8.dbus; f8_icount -= cL; } @@ -147,7 +147,7 @@ static void ROMC_03(int insttim) /* SKR - added parameter to tell if */ * Similiar to 0x00, except that it is used for immediate operands * fetches (using PC0) instead of instruction fetches. */ - f8.dbus = f8.io = cpu_readop_arg(f8.pc0); + f8.dbus = f8.io = program_raw_read_byte(f8.pc0); f8.pc0 += 1; f8_icount -= insttim; } @@ -241,7 +241,7 @@ static void ROMC_0C(void) * by PC0 into the data bus; then all devices move the value that * has just been placed on the data bus into the low order byte of PC0. */ - f8.dbus = cpu_readop_arg(f8.pc0); + f8.dbus = program_raw_read_byte(f8.pc0); f8.pc0 = (f8.pc0 & 0xff00) | f8.dbus; f8_icount -= cL; } @@ -264,7 +264,7 @@ static void ROMC_0E(void) * The value on the data bus is then moved to the low order byte * of DC0 by all devices. */ - f8.dbus = cpu_readop_arg(f8.pc0); + f8.dbus = program_raw_read_byte(f8.pc0); f8.dc0 = (f8.dc0 & 0xff00) | f8.dbus; f8_icount -= cL; } @@ -304,7 +304,7 @@ static void ROMC_11(void) * data bus. All devices must then move the contents of the * data bus to the upper byte of DC0. */ - f8.dbus = cpu_readop_arg(f8.pc0); + f8.dbus = program_raw_read_byte(f8.pc0); f8.dc0 = (f8.dc0 & 0x00ff) | (f8.dbus << 8); f8_icount -= cL; } @@ -1908,14 +1908,14 @@ static CPU_SET_INFO( f8 ) case CPUINFO_INT_SP: f8.pc1 = info->i; break; case CPUINFO_INT_PC: f8.pc0 = info->i; - f8.dbus = cpu_readop(f8.pc0); + f8.dbus = program_decrypted_read_byte(f8.pc0); f8.pc0 += 1; break; case CPUINFO_INT_PREVIOUSPC: break; /* TODO? */ case CPUINFO_INT_INPUT_STATE: f8.irq_request = info->i; break; case CPUINFO_INT_REGISTER + F8_PC0: f8.pc0 = info->i; - f8.dbus = cpu_readop(f8.pc0); + f8.dbus = program_decrypted_read_byte(f8.pc0); f8.pc0 += 1; break; case CPUINFO_INT_REGISTER + F8_PC1: f8.pc1 = info->i; break; diff --git a/src/emu/cpu/h6280/h6280ops.h b/src/emu/cpu/h6280/h6280ops.h index de34b46bf03..46a7e763676 100644 --- a/src/emu/cpu/h6280/h6280ops.h +++ b/src/emu/cpu/h6280/h6280ops.h @@ -182,13 +182,13 @@ INLINE void WRMEM(offs_t addr, UINT8 data) { * RDOP read an opcode ***************************************************************/ #define RDOP() \ - cpu_readop(TRANSLATED(PCW)) + program_decrypted_read_byte(TRANSLATED(PCW)) /*************************************************************** * RDOPARG read an opcode argument ***************************************************************/ #define RDOPARG() \ - cpu_readop_arg(TRANSLATED(PCW)) + program_raw_read_byte(TRANSLATED(PCW)) /*************************************************************** * BRA branch relative diff --git a/src/emu/cpu/h83002/h83002.c b/src/emu/cpu/h83002/h83002.c index bf2d14db2df..086db93dac2 100644 --- a/src/emu/cpu/h83002/h83002.c +++ b/src/emu/cpu/h83002/h83002.c @@ -475,7 +475,7 @@ static CPU_EXECUTE( h8 ) debugger_instruction_hook(device->machine, h8.pc); - opcode = cpu_readop16(h8.pc); + opcode = program_decrypted_read_word(h8.pc); // mame_printf_debug("[%06x]: %04x => %x\n", h8.pc, opcode, (opcode>>12)&0xf); h8.pc += 2; diff --git a/src/emu/cpu/hd6309/hd6309.h b/src/emu/cpu/hd6309/hd6309.h index c1d8e0979f7..fd61c0d0660 100644 --- a/src/emu/cpu/hd6309/hd6309.h +++ b/src/emu/cpu/hd6309/hd6309.h @@ -36,14 +36,14 @@ CPU_GET_INFO( hd6309 ); /* opcodes. In case of system with memory mapped I/O, this function can be */ /* used to greatly speed up emulation */ /****************************************************************************/ -#define HD6309_RDOP(Addr) ((unsigned)cpu_readop(Addr)) +#define HD6309_RDOP(Addr) ((unsigned)program_decrypted_read_byte(Addr)) /****************************************************************************/ /* Z80_RDOP_ARG() is identical to Z80_RDOP() except it is used for reading */ /* opcode arguments. This difference can be used to support systems that */ /* use different encoding mechanisms for opcodes and opcode arguments */ /****************************************************************************/ -#define HD6309_RDOP_ARG(Addr) ((unsigned)cpu_readop_arg(Addr)) +#define HD6309_RDOP_ARG(Addr) ((unsigned)program_raw_read_byte(Addr)) #ifndef FALSE # define FALSE 0 diff --git a/src/emu/cpu/i386/i386.h b/src/emu/cpu/i386/i386.h index bbddc4b2024..3cb3c34743f 100644 --- a/src/emu/cpu/i386/i386.h +++ b/src/emu/cpu/i386/i386.h @@ -410,7 +410,7 @@ INLINE UINT8 FETCH(void) translate_address(&address); } - value = cpu_readop(address & I.a20_mask); + value = program_decrypted_read_byte(address & I.a20_mask); I.eip++; I.pc++; return value; @@ -427,11 +427,11 @@ INLINE UINT16 FETCH16(void) if( address & 0x1 ) { /* Unaligned read */ address &= I.a20_mask; - value = (cpu_readop(address+0) << 0) | - (cpu_readop(address+1) << 8); + value = (program_decrypted_read_byte(address+0) << 0) | + (program_decrypted_read_byte(address+1) << 8); } else { address &= I.a20_mask; - value = cpu_readop16(address); + value = program_decrypted_read_word(address); } I.eip += 2; I.pc += 2; @@ -449,13 +449,13 @@ INLINE UINT32 FETCH32(void) if( I.pc & 0x3 ) { /* Unaligned read */ address &= I.a20_mask; - value = (cpu_readop(address+0) << 0) | - (cpu_readop(address+1) << 8) | - (cpu_readop(address+2) << 16) | - (cpu_readop(address+3) << 24); + value = (program_decrypted_read_byte(address+0) << 0) | + (program_decrypted_read_byte(address+1) << 8) | + (program_decrypted_read_byte(address+2) << 16) | + (program_decrypted_read_byte(address+3) << 24); } else { address &= I.a20_mask; - value = cpu_readop32(address); + value = program_decrypted_read_dword(address); } I.eip += 4; I.pc += 4; diff --git a/src/emu/cpu/i8085/i8085.c b/src/emu/cpu/i8085/i8085.c index 2f46ff19b25..75c6844e9df 100644 --- a/src/emu/cpu/i8085/i8085.c +++ b/src/emu/cpu/i8085/i8085.c @@ -162,20 +162,20 @@ static UINT8 RIM_IEN = 0; //AT: IEN status latch used by the RIM instruction static UINT8 ROP(void) { I.STATUS = 0xa2; // instruction fetch - return cpu_readop(I.PC.w.l++); + return program_decrypted_read_byte(I.PC.w.l++); } static UINT8 ARG(void) { - return cpu_readop_arg(I.PC.w.l++); + return program_raw_read_byte(I.PC.w.l++); } static UINT16 ARG16(void) { UINT16 w; - w = cpu_readop_arg(I.PC.d); + w = program_raw_read_byte(I.PC.d); I.PC.w.l++; - w += cpu_readop_arg(I.PC.d) << 8; + w += program_raw_read_byte(I.PC.d) << 8; I.PC.w.l++; return w; } diff --git a/src/emu/cpu/i86/i86.h b/src/emu/cpu/i86/i86.h index d78e4bfd224..a13081431c3 100644 --- a/src/emu/cpu/i86/i86.h +++ b/src/emu/cpu/i86/i86.h @@ -99,10 +99,10 @@ typedef enum { AH,AL,CH,CL,DH,DL,BH,BL,SPH,SPL,BPH,BPL,SIH,SIL,DIH,DIL } BREGS; #define WriteWord(ea,val) write_word((ea) & AMASK, val); #define FETCH_XOR(a) ((a) ^ I.mem.fetch_xor) -#define FETCH (cpu_readop_arg(FETCH_XOR(I.pc++))) -#define FETCHOP (cpu_readop(FETCH_XOR(I.pc++))) -#define PEEKOP(addr) (cpu_readop(FETCH_XOR(addr))) -#define FETCHWORD(var) { var = cpu_readop_arg(FETCH_XOR(I.pc)); var += (cpu_readop_arg(FETCH_XOR(I.pc + 1)) << 8); I.pc += 2; } +#define FETCH (program_raw_read_byte(FETCH_XOR(I.pc++))) +#define FETCHOP (program_decrypted_read_byte(FETCH_XOR(I.pc++))) +#define PEEKOP(addr) (program_decrypted_read_byte(FETCH_XOR(addr))) +#define FETCHWORD(var) { var = program_raw_read_byte(FETCH_XOR(I.pc)); var += (program_raw_read_byte(FETCH_XOR(I.pc + 1)) << 8); I.pc += 2; } #define CHANGE_PC(addr) change_pc(addr) #define PUSH(val) { I.regs.w[SP] -= 2; WriteWord(((I.base[SS] + I.regs.w[SP]) & AMASK), val); } #define POP(var) { var = ReadWord(((I.base[SS] + I.regs.w[SP]) & AMASK)); I.regs.w[SP] += 2; } diff --git a/src/emu/cpu/i8x41/i8x41.c b/src/emu/cpu/i8x41/i8x41.c index 4a9a0039d52..fca049bac43 100644 --- a/src/emu/cpu/i8x41/i8x41.c +++ b/src/emu/cpu/i8x41/i8x41.c @@ -148,8 +148,8 @@ struct _upi41_state_t { #define RP(a) io_read_byte_8le(a) #define WP(a,v) io_write_byte_8le(a,v) -#define ROP(pc) cpu_readop(pc) -#define ROP_ARG(pc) cpu_readop_arg(pc) +#define ROP(pc) program_decrypted_read_byte(pc) +#define ROP_ARG(pc) program_raw_read_byte(pc) /* PC vectors */ #define V_RESET 0x000 /* power on address */ @@ -919,7 +919,7 @@ static CPU_EXECUTE( i8x41 ) do { - UINT8 op = cpu_readop(PC); + UINT8 op = program_decrypted_read_byte(PC); PPC = PC; diff --git a/src/emu/cpu/i960/i960.c b/src/emu/cpu/i960/i960.c index d2fed18b72e..7206178326e 100644 --- a/src/emu/cpu/i960/i960.c +++ b/src/emu/cpu/i960/i960.c @@ -128,22 +128,22 @@ INLINE UINT32 get_ea(i960_state_t *i960_state, UINT32 opcode) return i960_state->r[abase] + (i960_state->r[index] << scale); case 0xc: - ret = cpu_readop32(i960_state->IP); + ret = program_decrypted_read_dword(i960_state->IP); i960_state->IP += 4; return ret; case 0xd: - ret = cpu_readop32(i960_state->IP) + i960_state->r[abase]; + ret = program_decrypted_read_dword(i960_state->IP) + i960_state->r[abase]; i960_state->IP += 4; return ret; case 0xe: - ret = cpu_readop32(i960_state->IP) + (i960_state->r[index] << scale); + ret = program_decrypted_read_dword(i960_state->IP) + (i960_state->r[index] << scale); i960_state->IP += 4; return ret; case 0xf: - ret = cpu_readop32(i960_state->IP) + i960_state->r[abase] + (i960_state->r[index] << scale); + ret = program_decrypted_read_dword(i960_state->IP) + i960_state->r[abase] + (i960_state->r[index] << scale); i960_state->IP += 4; return ret; @@ -1962,7 +1962,7 @@ static CPU_EXECUTE( i960 ) i960_state->bursting = 0; - opcode = cpu_readop32(i960_state->IP); + opcode = program_decrypted_read_dword(i960_state->IP); i960_state->IP += 4; execute_op(i960_state, opcode); diff --git a/src/emu/cpu/jaguar/jaguar.c b/src/emu/cpu/jaguar/jaguar.c index 0e5ad40ba7b..465698d2d43 100644 --- a/src/emu/cpu/jaguar/jaguar.c +++ b/src/emu/cpu/jaguar/jaguar.c @@ -246,7 +246,7 @@ static void (*const dsp_op_table[64])(void) = MEMORY ACCESSORS ***************************************************************************/ -#define ROPCODE(pc) (cpu_readop16(WORD_XOR_BE((UINT32)(pc)))) +#define ROPCODE(pc) (program_decrypted_read_word(WORD_XOR_BE((UINT32)(pc)))) diff --git a/src/emu/cpu/konami/konami.h b/src/emu/cpu/konami/konami.h index 71637e16201..3c05cc1e296 100644 --- a/src/emu/cpu/konami/konami.h +++ b/src/emu/cpu/konami/konami.h @@ -39,14 +39,14 @@ CPU_GET_INFO( konami ); /* opcodes. In case of system with memory mapped I/O, this function can be */ /* used to greatly speed up emulation */ /****************************************************************************/ -#define KONAMI_RDOP(Addr) ((unsigned)cpu_readop(Addr)) +#define KONAMI_RDOP(Addr) ((unsigned)program_decrypted_read_byte(Addr)) /****************************************************************************/ /* Z80_RDOP_ARG() is identical to Z80_RDOP() except it is used for reading */ /* opcode arguments. This difference can be used to support systems that */ /* use different encoding mechanisms for opcodes and opcode arguments */ /****************************************************************************/ -#define KONAMI_RDOP_ARG(Addr) ((unsigned)cpu_readop_arg(Addr)) +#define KONAMI_RDOP_ARG(Addr) ((unsigned)program_raw_read_byte(Addr)) #ifndef FALSE # define FALSE 0 diff --git a/src/emu/cpu/lh5801/5801tbl.c b/src/emu/cpu/lh5801/5801tbl.c index b1861d6104c..b73cc148a19 100644 --- a/src/emu/cpu/lh5801/5801tbl.c +++ b/src/emu/cpu/lh5801/5801tbl.c @@ -24,8 +24,8 @@ INLINE UINT8 lh5801_add_generic(int left, int right, int carry) INLINE UINT16 lh5801_readop_word(void) { UINT16 r; - r=cpu_readop(P++)<<8; - r|=cpu_readop(P++); + r=program_decrypted_read_byte(P++)<<8; + r|=program_decrypted_read_byte(P++); return r; } @@ -222,7 +222,7 @@ INLINE void lh5801_jmp(UINT16 adr) INLINE void lh5801_branch_plus(int doit) { - UINT8 t=cpu_readop(P++); + UINT8 t=program_decrypted_read_byte(P++); if (doit) { lh5801_icount-=3; P+=t; @@ -232,7 +232,7 @@ INLINE void lh5801_branch_plus(int doit) INLINE void lh5801_branch_minus(int doit) { - UINT8 t=cpu_readop(P++); + UINT8 t=program_decrypted_read_byte(P++); if (doit) { lh5801_icount-=3; P-=t; @@ -242,7 +242,7 @@ INLINE void lh5801_branch_minus(int doit) INLINE void lh5801_lop(void) { - UINT8 t=cpu_readop(P++); + UINT8 t=program_decrypted_read_byte(P++); lh5801_icount-=8; if (UL--) { lh5801_icount-=3; @@ -357,7 +357,7 @@ static void lh5801_instruction_fd(void) int oper; int adr; - oper=cpu_readop(P++); + oper=program_decrypted_read_byte(P++); switch (oper) { case 0x01: lh5801_sbc(program_read_byte(0x10000|X)); lh5801_icount-=11;break; case 0x03: lh5801_adc(program_read_byte(0x10000|X)); lh5801_icount-=11;break; @@ -398,29 +398,29 @@ static void lh5801_instruction_fd(void) case 0x40: lh5801_inc(&XH);lh5801_icount-=9;break; case 0x42: lh5801_dec(&XH);lh5801_icount-=9;break; case 0x48: X=S;lh5801_icount-=11;break; - case 0x49: lh5801_and_mem(0x10000|X, cpu_readop(P++)); lh5801_icount-=17;break; + case 0x49: lh5801_and_mem(0x10000|X, program_decrypted_read_byte(P++)); lh5801_icount-=17;break; case 0x4a: X=X;lh5801_icount-=11;break; //!!! - case 0x4b: lh5801_ora_mem(0x10000|X, cpu_readop(P++)); lh5801_icount-=17;break; + case 0x4b: lh5801_ora_mem(0x10000|X, program_decrypted_read_byte(P++)); lh5801_icount-=17;break; case 0x4c: lh5801.bf=0;/*off !*/ lh5801_icount-=8;break; - case 0x4d: lh5801_bit(program_read_byte(X|0x10000), cpu_readop(P++));lh5801_icount-=14;break; + case 0x4d: lh5801_bit(program_read_byte(X|0x10000), program_decrypted_read_byte(P++));lh5801_icount-=14;break; case 0x4e: S=X;lh5801_icount-=11;break; - case 0x4f: lh5801_add_mem(0x10000|X, cpu_readop(P++)); lh5801_icount-=17;break; + case 0x4f: lh5801_add_mem(0x10000|X, program_decrypted_read_byte(P++)); lh5801_icount-=17;break; case 0x50: lh5801_inc(&YH);lh5801_icount-=9;break; case 0x52: lh5801_dec(&YH);lh5801_icount-=9;break; case 0x58: X=P;lh5801_icount-=11;break; - case 0x59: lh5801_and_mem(0x10000|Y, cpu_readop(P++)); lh5801_icount-=17;break; + case 0x59: lh5801_and_mem(0x10000|Y, program_decrypted_read_byte(P++)); lh5801_icount-=17;break; case 0x5a: Y=X;lh5801_icount-=11;break; - case 0x5b: lh5801_ora_mem(0x10000|Y, cpu_readop(P++)); lh5801_icount-=17;break; - case 0x5d: lh5801_bit(program_read_byte(Y|0x10000), cpu_readop(P++));lh5801_icount-=14;break; + case 0x5b: lh5801_ora_mem(0x10000|Y, program_decrypted_read_byte(P++)); lh5801_icount-=17;break; + case 0x5d: lh5801_bit(program_read_byte(Y|0x10000), program_decrypted_read_byte(P++));lh5801_icount-=14;break; case 0x5e: lh5801_jmp(X);lh5801_icount-=11;break; // P=X - case 0x5f: lh5801_add_mem(0x10000|Y, cpu_readop(P++)); lh5801_icount-=17;break; + case 0x5f: lh5801_add_mem(0x10000|Y, program_decrypted_read_byte(P++)); lh5801_icount-=17;break; case 0x60: lh5801_inc(&UH);lh5801_icount-=9;break; case 0x62: lh5801_dec(&UH);lh5801_icount-=9;break; - case 0x69: lh5801_and_mem(0x10000|U, cpu_readop(P++)); lh5801_icount-=17;break; + case 0x69: lh5801_and_mem(0x10000|U, program_decrypted_read_byte(P++)); lh5801_icount-=17;break; case 0x6a: U=X;lh5801_icount-=11;break; - case 0x6b: lh5801_ora_mem(0x10000|U, cpu_readop(P++)); lh5801_icount-=17;break; - case 0x6d: lh5801_bit(program_read_byte(X|0x10000), cpu_readop(P++));lh5801_icount-=14;break; - case 0x6f: lh5801_add_mem(0x10000|U, cpu_readop(P++)); lh5801_icount-=17;break; + case 0x6b: lh5801_ora_mem(0x10000|U, program_decrypted_read_byte(P++)); lh5801_icount-=17;break; + case 0x6d: lh5801_bit(program_read_byte(X|0x10000), program_decrypted_read_byte(P++));lh5801_icount-=14;break; + case 0x6f: lh5801_add_mem(0x10000|U, program_decrypted_read_byte(P++)); lh5801_icount-=17;break; case 0x81: lh5801.t|=IE; /*sie !*/lh5801_icount-=8;break; case 0x88: lh5801_push_word(X); lh5801_icount-=14;break; case 0x8a: lh5801_pop(); lh5801_icount-=12; break; @@ -456,19 +456,19 @@ static void lh5801_instruction_fd(void) case 0xea: lh5801_adr(&lh5801.u);lh5801_icount-=11;break; case 0xe9: adr=lh5801_readop_word()|0x10000; - lh5801_and_mem(adr, cpu_readop(P++)); lh5801_icount-=23; + lh5801_and_mem(adr, program_decrypted_read_byte(P++)); lh5801_icount-=23; break; case 0xeb: adr=lh5801_readop_word()|0x10000; - lh5801_ora_mem(adr, cpu_readop(P++)); lh5801_icount-=23; + lh5801_ora_mem(adr, program_decrypted_read_byte(P++)); lh5801_icount-=23; break; case 0xec: lh5801.t=lh5801.a; lh5801_icount-=9;break; case 0xed: - adr=lh5801_readop_word()|0x10000;lh5801_bit(program_read_byte(adr), cpu_readop(P++)); + adr=lh5801_readop_word()|0x10000;lh5801_bit(program_read_byte(adr), program_decrypted_read_byte(P++)); lh5801_icount-=20;break; case 0xef: adr=lh5801_readop_word()|0x10000; - lh5801_add_mem(adr, cpu_readop(P++)); lh5801_icount-=23; + lh5801_add_mem(adr, program_decrypted_read_byte(P++)); lh5801_icount-=23; break; default: @@ -481,7 +481,7 @@ static void lh5801_instruction(void) int oper; int adr; - oper=cpu_readop(P++); + oper=program_decrypted_read_byte(P++); switch (oper) { case 0x00: lh5801_sbc(XL); lh5801_icount-=6;break; case 0x01: lh5801_sbc(program_read_byte(X)); lh5801_icount-=7;break; @@ -540,14 +540,14 @@ static void lh5801_instruction(void) case 0x45: lh5801_lin(&lh5801.x);lh5801_icount-=6;break; case 0x46: X--;lh5801_icount-=5;break; case 0x47: lh5801_lde(&lh5801.x);lh5801_icount-=6;break; - case 0x48: XH=cpu_readop(P++);lh5801_icount-=6;break; - case 0x49: lh5801_and_mem(X, cpu_readop(P++)); lh5801_icount-=13;break; - case 0x4a: XL=cpu_readop(P++);lh5801_icount-=6;break; - case 0x4b: lh5801_ora_mem(X, cpu_readop(P++)); lh5801_icount-=13;break; - case 0x4c: lh5801_cpa(XH, cpu_readop(P++)); lh5801_icount-=7;break; - case 0x4d: lh5801_bit(program_read_byte(X), cpu_readop(P++));lh5801_icount-=10;break; - case 0x4e: lh5801_cpa(XL, cpu_readop(P++)); lh5801_icount-=7;break; - case 0x4f: lh5801_add_mem(X, cpu_readop(P++)); lh5801_icount-=13;break; + case 0x48: XH=program_decrypted_read_byte(P++);lh5801_icount-=6;break; + case 0x49: lh5801_and_mem(X, program_decrypted_read_byte(P++)); lh5801_icount-=13;break; + case 0x4a: XL=program_decrypted_read_byte(P++);lh5801_icount-=6;break; + case 0x4b: lh5801_ora_mem(X, program_decrypted_read_byte(P++)); lh5801_icount-=13;break; + case 0x4c: lh5801_cpa(XH, program_decrypted_read_byte(P++)); lh5801_icount-=7;break; + case 0x4d: lh5801_bit(program_read_byte(X), program_decrypted_read_byte(P++));lh5801_icount-=10;break; + case 0x4e: lh5801_cpa(XL, program_decrypted_read_byte(P++)); lh5801_icount-=7;break; + case 0x4f: lh5801_add_mem(X, program_decrypted_read_byte(P++)); lh5801_icount-=13;break; case 0x50: lh5801_inc(&YL);lh5801_icount-=5;break; case 0x51: lh5801_sin(&lh5801.y); lh5801_icount-=6;break; case 0x52: lh5801_dec(&YL);lh5801_icount-=5;break; @@ -556,14 +556,14 @@ static void lh5801_instruction(void) case 0x55: lh5801_lin(&lh5801.y);lh5801_icount-=6;break; case 0x56: Y--;lh5801_icount-=5;break; case 0x57: lh5801_lde(&lh5801.y);lh5801_icount-=6;break; - case 0x58: YH=cpu_readop(P++);lh5801_icount-=6;break; - case 0x59: lh5801_and_mem(Y, cpu_readop(P++)); lh5801_icount-=13;break; - case 0x5a: YL=cpu_readop(P++);lh5801_icount-=6;break; - case 0x5b: lh5801_ora_mem(Y, cpu_readop(P++)); lh5801_icount-=13;break; - case 0x5c: lh5801_cpa(YH, cpu_readop(P++)); lh5801_icount-=7;break; - case 0x5d: lh5801_bit(program_read_byte(Y), cpu_readop(P++));lh5801_icount-=10;break; - case 0x5e: lh5801_cpa(YL, cpu_readop(P++)); lh5801_icount-=7;break; - case 0x5f: lh5801_add_mem(Y, cpu_readop(P++)); lh5801_icount-=13;break; + case 0x58: YH=program_decrypted_read_byte(P++);lh5801_icount-=6;break; + case 0x59: lh5801_and_mem(Y, program_decrypted_read_byte(P++)); lh5801_icount-=13;break; + case 0x5a: YL=program_decrypted_read_byte(P++);lh5801_icount-=6;break; + case 0x5b: lh5801_ora_mem(Y, program_decrypted_read_byte(P++)); lh5801_icount-=13;break; + case 0x5c: lh5801_cpa(YH, program_decrypted_read_byte(P++)); lh5801_icount-=7;break; + case 0x5d: lh5801_bit(program_read_byte(Y), program_decrypted_read_byte(P++));lh5801_icount-=10;break; + case 0x5e: lh5801_cpa(YL, program_decrypted_read_byte(P++)); lh5801_icount-=7;break; + case 0x5f: lh5801_add_mem(Y, program_decrypted_read_byte(P++)); lh5801_icount-=13;break; case 0x60: lh5801_inc(&UL);lh5801_icount-=5;break; case 0x61: lh5801_sin(&lh5801.u); lh5801_icount-=6;break; case 0x62: lh5801_dec(&UL);lh5801_icount-=5;break; @@ -572,14 +572,14 @@ static void lh5801_instruction(void) case 0x65: lh5801_lin(&lh5801.u);lh5801_icount-=6;break; case 0x66: U--;lh5801_icount-=5;break; case 0x67: lh5801_lde(&lh5801.u);lh5801_icount-=6;break; - case 0x68: UH=cpu_readop(P++);lh5801_icount-=6;break; - case 0x69: lh5801_and_mem(U, cpu_readop(P++)); lh5801_icount-=13;break; - case 0x6a: UL=cpu_readop(P++);lh5801_icount-=6;break; - case 0x6b: lh5801_ora_mem(U, cpu_readop(P++)); lh5801_icount-=13;break; - case 0x6c: lh5801_cpa(UH, cpu_readop(P++)); lh5801_icount-=7;break; - case 0x6d: lh5801_bit(program_read_byte(U), cpu_readop(P++));lh5801_icount-=10;break; - case 0x6e: lh5801_cpa(UL, cpu_readop(P++)); lh5801_icount-=7;break; - case 0x6f: lh5801_add_mem(U, cpu_readop(P++)); lh5801_icount-=13;break; + case 0x68: UH=program_decrypted_read_byte(P++);lh5801_icount-=6;break; + case 0x69: lh5801_and_mem(U, program_decrypted_read_byte(P++)); lh5801_icount-=13;break; + case 0x6a: UL=program_decrypted_read_byte(P++);lh5801_icount-=6;break; + case 0x6b: lh5801_ora_mem(U, program_decrypted_read_byte(P++)); lh5801_icount-=13;break; + case 0x6c: lh5801_cpa(UH, program_decrypted_read_byte(P++)); lh5801_icount-=7;break; + case 0x6d: lh5801_bit(program_read_byte(U), program_decrypted_read_byte(P++));lh5801_icount-=10;break; + case 0x6e: lh5801_cpa(UL, program_decrypted_read_byte(P++)); lh5801_icount-=7;break; + case 0x6f: lh5801_add_mem(U, program_decrypted_read_byte(P++)); lh5801_icount-=13;break; case 0x80: lh5801_sbc(XH); lh5801_icount-=6;break; case 0x81: lh5801_branch_plus(!(lh5801.t&C)); lh5801_icount-=8; break; case 0x82: lh5801_adc(XH); lh5801_icount-=6;break; @@ -627,25 +627,25 @@ static void lh5801_instruction(void) case 0xad: lh5801_eor(program_read_byte(lh5801_readop_word())); lh5801_icount-=13;break; case 0xae: program_write_byte(lh5801_readop_word(),lh5801.a); lh5801_icount-=12;break; case 0xaf: lh5801_bit(program_read_byte(lh5801_readop_word()),lh5801.a); lh5801_icount-=13;break; - case 0xb1: lh5801_sbc(cpu_readop(P++)); lh5801_icount-=7;break; - case 0xb3: lh5801_adc(cpu_readop(P++)); lh5801_icount-=7;break; - case 0xb5: lh5801_lda(cpu_readop(P++)); lh5801_icount-=6;break; - case 0xb7: lh5801_cpa(lh5801.a, cpu_readop(P++)); lh5801_icount-=7;break; + case 0xb1: lh5801_sbc(program_decrypted_read_byte(P++)); lh5801_icount-=7;break; + case 0xb3: lh5801_adc(program_decrypted_read_byte(P++)); lh5801_icount-=7;break; + case 0xb5: lh5801_lda(program_decrypted_read_byte(P++)); lh5801_icount-=6;break; + case 0xb7: lh5801_cpa(lh5801.a, program_decrypted_read_byte(P++)); lh5801_icount-=7;break; case 0xb8: lh5801.pv=0;/*rpv!*/ lh5801_icount-=4; break; - case 0xb9: lh5801_and(cpu_readop(P++)); lh5801_icount-=7;break; + case 0xb9: lh5801_and(program_decrypted_read_byte(P++)); lh5801_icount-=7;break; case 0xba: lh5801_jmp(lh5801_readop_word()); lh5801_icount-=12;break; - case 0xbb: lh5801_ora(cpu_readop(P++)); lh5801_icount-=7;break; - case 0xbd: lh5801_eor(cpu_readop(P++)); lh5801_icount-=7;break; + case 0xbb: lh5801_ora(program_decrypted_read_byte(P++)); lh5801_icount-=7;break; + case 0xbd: lh5801_eor(program_decrypted_read_byte(P++)); lh5801_icount-=7;break; case 0xbe: lh5801_sjp(); lh5801_icount-=19; break; - case 0xbf: lh5801_bit(lh5801.a, cpu_readop(P++));lh5801_icount-=7;break; - case 0xc1: lh5801_vector(!(lh5801.t&C), cpu_readop(P++)); lh5801_icount-=8;break; - case 0xc3: lh5801_vector(lh5801.t&C, cpu_readop(P++)); lh5801_icount-=8;break; - case 0xc5: lh5801_vector(!(lh5801.t&H), cpu_readop(P++)); lh5801_icount-=8;break; - case 0xc7: lh5801_vector(lh5801.t&H, cpu_readop(P++)); lh5801_icount-=8;break; - case 0xc9: lh5801_vector(!(lh5801.t&Z), cpu_readop(P++)); lh5801_icount-=8;break; - case 0xcb: lh5801_vector(lh5801.t&Z, cpu_readop(P++)); lh5801_icount-=8;break; - case 0xcd: lh5801_vector(1, cpu_readop(P++)); lh5801_icount-=7;break; - case 0xcf: lh5801_vector(lh5801.t&V, cpu_readop(P++)); lh5801_icount-=8;break; + case 0xbf: lh5801_bit(lh5801.a, program_decrypted_read_byte(P++));lh5801_icount-=7;break; + case 0xc1: lh5801_vector(!(lh5801.t&C), program_decrypted_read_byte(P++)); lh5801_icount-=8;break; + case 0xc3: lh5801_vector(lh5801.t&C, program_decrypted_read_byte(P++)); lh5801_icount-=8;break; + case 0xc5: lh5801_vector(!(lh5801.t&H), program_decrypted_read_byte(P++)); lh5801_icount-=8;break; + case 0xc7: lh5801_vector(lh5801.t&H, program_decrypted_read_byte(P++)); lh5801_icount-=8;break; + case 0xc9: lh5801_vector(!(lh5801.t&Z), program_decrypted_read_byte(P++)); lh5801_icount-=8;break; + case 0xcb: lh5801_vector(lh5801.t&Z, program_decrypted_read_byte(P++)); lh5801_icount-=8;break; + case 0xcd: lh5801_vector(1, program_decrypted_read_byte(P++)); lh5801_icount-=7;break; + case 0xcf: lh5801_vector(lh5801.t&V, program_decrypted_read_byte(P++)); lh5801_icount-=8;break; case 0xd1: lh5801_ror(); lh5801_icount-=6; break; case 0xd3: lh5801_drr(X); lh5801_icount-=12; break; case 0xd5: lh5801_shr(); lh5801_icount-=6; break; @@ -657,17 +657,17 @@ static void lh5801_instruction(void) case 0xe1: lh5801.pu=1;/*spu!*/ lh5801_icount-=4; break; case 0xe3: lh5801.pu=0;/*rpu!*/ lh5801_icount-=4; break; case 0xe9: - adr=lh5801_readop_word();lh5801_and_mem(adr, cpu_readop(P++)); + adr=lh5801_readop_word();lh5801_and_mem(adr, program_decrypted_read_byte(P++)); lh5801_icount-=19;break; case 0xeb: - adr=lh5801_readop_word();lh5801_ora_mem(adr, cpu_readop(P++)); + adr=lh5801_readop_word();lh5801_ora_mem(adr, program_decrypted_read_byte(P++)); lh5801_icount-=19;break; case 0xed: - adr=lh5801_readop_word();lh5801_bit(program_read_byte(adr), cpu_readop(P++)); + adr=lh5801_readop_word();lh5801_bit(program_read_byte(adr), program_decrypted_read_byte(P++)); lh5801_icount-=16;break; case 0xef: adr=lh5801_readop_word(); - lh5801_add_mem(adr, cpu_readop(P++)); lh5801_icount-=19; + lh5801_add_mem(adr, program_decrypted_read_byte(P++)); lh5801_icount-=19; break; case 0xf1: lh5801_aex(); lh5801_icount-=6; break; case 0xf5: program_write_byte(Y++, program_read_byte(X++)); lh5801_icount-=7; break; //tin diff --git a/src/emu/cpu/m6502/ill02.h b/src/emu/cpu/m6502/ill02.h index 8b1e52741e8..b8dc90ac7d9 100644 --- a/src/emu/cpu/m6502/ill02.h +++ b/src/emu/cpu/m6502/ill02.h @@ -235,7 +235,7 @@ #if 0 #define SSH \ tmp = S = A & X; \ - tmp &= (UINT8)(cpu_readop_arg((PCW + 1) & 0xffff) + 1) + tmp &= (UINT8)(program_raw_read_byte((PCW + 1) & 0xffff) + 1) #endif /* 6510 ******************************************************** @@ -264,7 +264,7 @@ #define KIL \ PCW--; \ logerror("M6510 KILL opcode %04x: %02x\n", \ - PCW, cpu_readop(PCW)) + PCW, program_decrypted_read_byte(PCW)) /* N2A03 ******************************************************* * ARR logical and, rotate right - no decimal mode diff --git a/src/emu/cpu/m6502/m4510.c b/src/emu/cpu/m6502/m4510.c index d6022ce32e4..5274d97c580 100644 --- a/src/emu/cpu/m6502/m4510.c +++ b/src/emu/cpu/m6502/m4510.c @@ -164,13 +164,13 @@ static void *token; INLINE int m4510_cpu_readop(m4510_Regs *m4510) { register UINT16 t=m4510->pc.w.l++; - return cpu_readop(M4510_MEM(t)); + return program_decrypted_read_byte(M4510_MEM(t)); } INLINE int m4510_cpu_readop_arg(m4510_Regs *m4510) { register UINT16 t=m4510->pc.w.l++; - return cpu_readop_arg(M4510_MEM(t)); + return program_raw_read_byte(M4510_MEM(t)); } #define M4510 diff --git a/src/emu/cpu/m6502/minc4510.h b/src/emu/cpu/m6502/minc4510.h index 30c63636300..a0929bd4187 100644 --- a/src/emu/cpu/m6502/minc4510.h +++ b/src/emu/cpu/m6502/minc4510.h @@ -54,7 +54,7 @@ #define CHANGE_PC change_pc(M4510_MEM(PCD)) -#define PEEK_OP() cpu_readop(M4510_MEM(PCW)) +#define PEEK_OP() program_decrypted_read_byte(M4510_MEM(PCW)) #define RDMEM(addr) program_read_byte_8le(M4510_MEM(addr)); m4510->icount -= 1 #define WRMEM(addr,data) program_write_byte_8le(M4510_MEM(addr),data); m4510->icount -= 1 diff --git a/src/emu/cpu/m6502/mincce02.h b/src/emu/cpu/m6502/mincce02.h index 314252663a0..a401f489dba 100644 --- a/src/emu/cpu/m6502/mincce02.h +++ b/src/emu/cpu/m6502/mincce02.h @@ -58,14 +58,14 @@ /*************************************************************** * RDOP read an opcode ***************************************************************/ -#define RDOP() cpu_readop(PCW++); m65ce02->icount -= 1 +#define RDOP() program_decrypted_read_byte(PCW++); m65ce02->icount -= 1 /*************************************************************** * RDOPARG read an opcode argument ***************************************************************/ -#define RDOPARG() cpu_readop_arg(PCW++); m65ce02->icount -= 1 +#define RDOPARG() program_raw_read_byte(PCW++); m65ce02->icount -= 1 -#define PEEK_OP() cpu_readop(PCW) +#define PEEK_OP() program_decrypted_read_byte(PCW) #define RDMEM(addr) program_read_byte_8le(addr); m65ce02->icount -= 1 #define WRMEM(addr,data) program_write_byte_8le(addr,data); m65ce02->icount -= 1 diff --git a/src/emu/cpu/m6502/ops02.h b/src/emu/cpu/m6502/ops02.h index bd1d7d437d9..e3572c50a4b 100644 --- a/src/emu/cpu/m6502/ops02.h +++ b/src/emu/cpu/m6502/ops02.h @@ -72,12 +72,12 @@ /*************************************************************** * RDOP read an opcode ***************************************************************/ -#define RDOP() cpu_readop(PCW++); m6502->icount -= 1 +#define RDOP() program_decrypted_read_byte(PCW++); m6502->icount -= 1 /*************************************************************** * RDOPARG read an opcode argument ***************************************************************/ -#define RDOPARG() cpu_readop_arg(PCW++); m6502->icount -= 1 +#define RDOPARG() program_raw_read_byte(PCW++); m6502->icount -= 1 /*************************************************************** * RDMEM read memory @@ -508,7 +508,7 @@ * ILL Illegal opcode ***************************************************************/ #define ILL \ - logerror("M6502 illegal opcode %04x: %02x\n",(PCW-1)&0xffff, cpu_readop((PCW-1)&0xffff)) + logerror("M6502 illegal opcode %04x: %02x\n",(PCW-1)&0xffff, program_decrypted_read_byte((PCW-1)&0xffff)) /* 6502 ******************************************************** * INC Increment memory diff --git a/src/emu/cpu/m6502/ops09.h b/src/emu/cpu/m6502/ops09.h index 2f2a7d7e44d..0832875bf94 100644 --- a/src/emu/cpu/m6502/ops09.h +++ b/src/emu/cpu/m6502/ops09.h @@ -37,13 +37,13 @@ * RDOP read an opcode ***************************************************************/ #undef RDOP -#define RDOP() cpu_readop((PCW++)|PB); m6502->icount -= 1 +#define RDOP() program_decrypted_read_byte((PCW++)|PB); m6502->icount -= 1 /*************************************************************** * RDOPARG read an opcode argument ***************************************************************/ #undef RDOPARG -#define RDOPARG() cpu_readop_arg((PCW++)|PB); m6502->icount -= 1 +#define RDOPARG() program_raw_read_byte((PCW++)|PB); m6502->icount -= 1 /*************************************************************** * RDMEM read memory @@ -208,4 +208,4 @@ #undef KIL #define KIL \ PCW--; \ - logerror("M6509 KILL opcode %05x: %02x\n", PCD, cpu_readop(PCD)) + logerror("M6509 KILL opcode %05x: %02x\n", PCD, program_decrypted_read_byte(PCD)) diff --git a/src/emu/cpu/m6800/m6800.c b/src/emu/cpu/m6800/m6800.c index e8f55377567..ad56520d622 100644 --- a/src/emu/cpu/m6800/m6800.c +++ b/src/emu/cpu/m6800/m6800.c @@ -201,14 +201,14 @@ static UINT32 timer_next; /* opcodes. In case of system with memory mapped I/O, this function can be */ /* used to greatly speed up emulation */ /****************************************************************************/ -#define M_RDOP(Addr) ((unsigned)cpu_readop(Addr)) +#define M_RDOP(Addr) ((unsigned)program_decrypted_read_byte(Addr)) /****************************************************************************/ /* M6800_RDOP_ARG() is identical to M6800_RDOP() but it's used for reading */ /* opcode arguments. This difference can be used to support systems that */ /* use different encoding mechanisms for opcodes and opcode arguments */ /****************************************************************************/ -#define M_RDOP_ARG(Addr) ((unsigned)cpu_readop_arg(Addr)) +#define M_RDOP_ARG(Addr) ((unsigned)program_raw_read_byte(Addr)) /* macros to access memory */ #define IMMBYTE(b) b = M_RDOP_ARG(PCD); PC++ diff --git a/src/emu/cpu/m68000/m68kcpu.c b/src/emu/cpu/m68000/m68kcpu.c index d55842237ac..caa3cc6f452 100644 --- a/src/emu/cpu/m68000/m68kcpu.c +++ b/src/emu/cpu/m68000/m68kcpu.c @@ -790,7 +790,7 @@ void m68k_set_encrypted_opcode_range(const device_config *device, offs_t start, static UINT16 m68008_read_immediate_16(const address_space *space, offs_t address) { offs_t addr = address; - return (cpu_readop(addr) << 8) | (cpu_readop(addr + 1)); + return (program_decrypted_read_byte(addr) << 8) | (program_decrypted_read_byte(addr + 1)); } /* interface for 20/22-bit address bus, 8-bit data bus (68008) */ @@ -813,12 +813,12 @@ static const m68k_memory_interface interface_d8 = static UINT16 read_immediate_16(const address_space *space, offs_t address) { m68ki_cpu_core *m68k = space->cpu->token; - return cpu_readop16((address) ^ m68k->memory.opcode_xor); + return program_decrypted_read_word((address) ^ m68k->memory.opcode_xor); } static UINT16 simple_read_immediate_16(const address_space *space, offs_t address) { - return cpu_readop16(address); + return program_decrypted_read_word(address); } /* interface for 24-bit address bus, 16-bit data bus (68000, 68010) */ diff --git a/src/emu/cpu/m6805/m6805.h b/src/emu/cpu/m6805/m6805.h index 6e50ab02c6e..7649bafc3dd 100644 --- a/src/emu/cpu/m6805/m6805.h +++ b/src/emu/cpu/m6805/m6805.h @@ -75,14 +75,14 @@ extern CPU_GET_INFO( hd63705 ); /* opcodes. In case of system with memory mapped I/O, this function can be */ /* used to greatly speed up emulation */ /****************************************************************************/ -#define M6805_RDOP(Addr) ((unsigned)cpu_readop(Addr)) +#define M6805_RDOP(Addr) ((unsigned)program_decrypted_read_byte(Addr)) /****************************************************************************/ /* M6805_RDOP_ARG() is identical to M6805_RDOP() but it's used for reading */ /* opcode arguments. This difference can be used to support systems that */ /* use different encoding mechanisms for opcodes and opcode arguments */ /****************************************************************************/ -#define M6805_RDOP_ARG(Addr) ((unsigned)cpu_readop_arg(Addr)) +#define M6805_RDOP_ARG(Addr) ((unsigned)program_raw_read_byte(Addr)) CPU_DISASSEMBLE( m6805 ); diff --git a/src/emu/cpu/m6809/m6809.h b/src/emu/cpu/m6809/m6809.h index 89839769cb6..56d7ed1129f 100644 --- a/src/emu/cpu/m6809/m6809.h +++ b/src/emu/cpu/m6809/m6809.h @@ -37,14 +37,14 @@ CPU_GET_INFO( m6809e ); /* opcodes. In case of system with memory mapped I/O, this function can be */ /* used to greatly speed up emulation */ /****************************************************************************/ -#define M6809_RDOP(Addr) ((unsigned)cpu_readop(Addr)) +#define M6809_RDOP(Addr) ((unsigned)program_decrypted_read_byte(Addr)) /****************************************************************************/ /* Z80_RDOP_ARG() is identical to Z80_RDOP() except it is used for reading */ /* opcode arguments. This difference can be used to support systems that */ /* use different encoding mechanisms for opcodes and opcode arguments */ /****************************************************************************/ -#define M6809_RDOP_ARG(Addr) ((unsigned)cpu_readop_arg(Addr)) +#define M6809_RDOP_ARG(Addr) ((unsigned)program_raw_read_byte(Addr)) #ifndef FALSE # define FALSE 0 diff --git a/src/emu/cpu/mb86233/mb86233.c b/src/emu/cpu/mb86233/mb86233.c index 07b647255c1..bb403246aa7 100644 --- a/src/emu/cpu/mb86233/mb86233.c +++ b/src/emu/cpu/mb86233/mb86233.c @@ -87,7 +87,7 @@ static int mb86233_icount; #define ALU(a) mb86233_alu(a) #define GETREPCNT() mb86233.repcnt -#define ROPCODE(a) cpu_readop32(a<<2) +#define ROPCODE(a) program_decrypted_read_dword(a<<2) #define RDMEM(a) program_read_dword_32le((a<<2)) #define WRMEM(a,v) program_write_dword_32le((a<<2),v) diff --git a/src/emu/cpu/mb88xx/mb88xx.c b/src/emu/cpu/mb88xx/mb88xx.c index c72a735e782..592745bc7cb 100644 --- a/src/emu/cpu/mb88xx/mb88xx.c +++ b/src/emu/cpu/mb88xx/mb88xx.c @@ -66,7 +66,7 @@ static int mb88_icount; MACROS ***************************************************************************/ -#define READOP(a) (cpu_readop(a)) +#define READOP(a) (program_decrypted_read_byte(a)) #define RDMEM(a) (data_read_byte_8be(a)) #define WRMEM(a,v) (data_write_byte_8be((a), (v))) diff --git a/src/emu/cpu/mc68hc11/mc68hc11.c b/src/emu/cpu/mc68hc11/mc68hc11.c index 3b77e548d01..86a1ec79720 100644 --- a/src/emu/cpu/mc68hc11/mc68hc11.c +++ b/src/emu/cpu/mc68hc11/mc68hc11.c @@ -253,13 +253,13 @@ static void hc11_regs_w(UINT32 address, UINT8 value) INLINE UINT8 FETCH(void) { - return cpu_readop(hc11.pc++); + return program_decrypted_read_byte(hc11.pc++); } INLINE UINT16 FETCH16(void) { UINT16 w; - w = (cpu_readop(hc11.pc) << 8) | (cpu_readop(hc11.pc+1)); + w = (program_decrypted_read_byte(hc11.pc) << 8) | (program_decrypted_read_byte(hc11.pc+1)); hc11.pc += 2; return w; } diff --git a/src/emu/cpu/mcs48/mcs48.c b/src/emu/cpu/mcs48/mcs48.c index fbeb33ead4b..5470a6148a2 100644 --- a/src/emu/cpu/mcs48/mcs48.c +++ b/src/emu/cpu/mcs48/mcs48.c @@ -187,7 +187,7 @@ static void check_irqs( mcs48_state *mcs48); INLINE UINT8 opcode_fetch(offs_t address) { - return cpu_readop(address); + return program_decrypted_read_byte(address); } @@ -198,7 +198,7 @@ INLINE UINT8 opcode_fetch(offs_t address) INLINE UINT8 argument_fetch(offs_t address) { - return cpu_readop_arg(address); + return program_raw_read_byte(address); } diff --git a/src/emu/cpu/mcs51/mcs51.c b/src/emu/cpu/mcs51/mcs51.c index 72f43ea77ff..8b2fd9aa7db 100644 --- a/src/emu/cpu/mcs51/mcs51.c +++ b/src/emu/cpu/mcs51/mcs51.c @@ -307,8 +307,8 @@ struct _mcs51_state_t #define change_pc(x) /* Read Opcode/Opcode Arguments from Program Code */ -#define ROP(pc) cpu_readop(pc) -#define ROP_ARG(pc) cpu_readop_arg(pc) +#define ROP(pc) program_decrypted_read_byte(pc) +#define ROP_ARG(pc) program_raw_read_byte(pc) /* Read a byte from External Code Memory (Usually Program Rom(s) Space) */ #define CODEMEM_R(a) (UINT8)program_read_byte_8le(a) @@ -1941,7 +1941,7 @@ static CPU_EXECUTE( mcs51 ) /* Read next opcode */ PPC = PC; debugger_instruction_hook(device->machine, PC); - op = cpu_readop(PC++); + op = program_decrypted_read_byte(PC++); /* process opcode and count cycles */ mcs51_state->inst_cycles = mcs51_cycles[op]; diff --git a/src/emu/cpu/mips/mips3.c b/src/emu/cpu/mips/mips3.c index de6e97bae35..4bbcc57b6ac 100644 --- a/src/emu/cpu/mips/mips3.c +++ b/src/emu/cpu/mips/mips3.c @@ -150,7 +150,7 @@ static mips3_regs mips3; MEMORY ACCESSORS ***************************************************************************/ -#define ROPCODE(pc) cpu_readop32(pc) +#define ROPCODE(pc) program_decrypted_read_dword(pc) diff --git a/src/emu/cpu/mips/psx.c b/src/emu/cpu/mips/psx.c index 62d5b0c125a..d0afc2918f0 100644 --- a/src/emu/cpu/mips/psx.c +++ b/src/emu/cpu/mips/psx.c @@ -1292,7 +1292,7 @@ INLINE void mips_set_cp0r( int reg, UINT32 value ) ( mipscpu.cp0r[ CP0_SR ] & SR_IEC ) != 0 && ( mipscpu.cp0r[ CP0_SR ] & mipscpu.cp0r[ CP0_CAUSE ] & CAUSE_IP ) != 0 ) { - mipscpu.op = cpu_readop32( mipscpu.pc ); + mipscpu.op = program_decrypted_read_dword( mipscpu.pc ); mips_execute_unstoppable_instructions( 1 ); mips_exception( EXC_INT ); } @@ -1327,12 +1327,12 @@ static void mips_fetch_next_op( void ) UINT32 safepc = mipscpu.delayv & ~mipscpu.bad_word_address_mask; change_pc( safepc ); - mipscpu.op = cpu_readop32( safepc ); + mipscpu.op = program_decrypted_read_dword( safepc ); change_pc( mipscpu.pc ); } else { - mipscpu.op = cpu_readop32( mipscpu.pc + 4 ); + mipscpu.op = program_decrypted_read_dword( mipscpu.pc + 4 ); } } @@ -1798,7 +1798,7 @@ static CPU_EXECUTE( mips ) if (LOG_BIOSCALL) log_bioscall(); debugger_instruction_hook(device->machine, mipscpu.pc ); - mipscpu.op = cpu_readop32( mipscpu.pc ); + mipscpu.op = program_decrypted_read_dword( mipscpu.pc ); switch( INS_OP( mipscpu.op ) ) { case OP_SPECIAL: diff --git a/src/emu/cpu/mips/r3000.c b/src/emu/cpu/mips/r3000.c index 92f3e6ba1ef..42dad394637 100644 --- a/src/emu/cpu/mips/r3000.c +++ b/src/emu/cpu/mips/r3000.c @@ -238,7 +238,7 @@ static const memory_accessors le_cache = MEMORY ACCESSORS ***************************************************************************/ -#define ROPCODE(pc) cpu_readop32(pc) +#define ROPCODE(pc) program_decrypted_read_dword(pc) diff --git a/src/emu/cpu/mips/r3kdasm.c b/src/emu/cpu/mips/r3kdasm.c index 62c8f250ca4..73a5886ea55 100644 --- a/src/emu/cpu/mips/r3kdasm.c +++ b/src/emu/cpu/mips/r3kdasm.c @@ -80,7 +80,7 @@ static const char *const ccreg[4][32] = MEMORY ACCESSORS ***************************************************************************/ -#define ROPCODE(pc) cpu_readop32(pc) +#define ROPCODE(pc) program_decrypted_read_dword(pc) /*************************************************************************** diff --git a/src/emu/cpu/nec/nec.c b/src/emu/cpu/nec/nec.c index 90e4153f5e8..11f301d85ed 100644 --- a/src/emu/cpu/nec/nec.c +++ b/src/emu/cpu/nec/nec.c @@ -237,7 +237,7 @@ static void do_prefetch(int previous_ICount) INLINE UINT8 fetch(void) { prefetch(); - return cpu_readop_arg(FETCH_XOR((I.sregs[PS]<<4)+I.ip++)); + return program_raw_read_byte(FETCH_XOR((I.sregs[PS]<<4)+I.ip++)); } INLINE UINT16 fetchword(void) @@ -260,7 +260,7 @@ static UINT8 fetchop(void) UINT8 ret; prefetch(); - ret = cpu_readop( FETCH_XOR( ( I.sregs[PS]<<4)+I.ip++)); + ret = program_decrypted_read_byte( FETCH_XOR( ( I.sregs[PS]<<4)+I.ip++)); if (I.MF == 1) if (I.config->v25v35_decryptiontable) diff --git a/src/emu/cpu/pic16c5x/pic16c5x.h b/src/emu/cpu/pic16c5x/pic16c5x.h index 7bbbabe4210..f1835412350 100644 --- a/src/emu/cpu/pic16c5x/pic16c5x.h +++ b/src/emu/cpu/pic16c5x/pic16c5x.h @@ -89,7 +89,7 @@ void pic16c5x_config(int data); * can be used to greatly speed up emulation */ -#define PIC16C5x_RDOP(A) (cpu_readop16((A)<<1)) +#define PIC16C5x_RDOP(A) (program_decrypted_read_word((A)<<1)) /**************************************************************************** @@ -98,7 +98,7 @@ void pic16c5x_config(int data); * that use different encoding mechanisms for opcodes and opcode arguments */ -#define PIC16C5x_RDOP_ARG(A) (cpu_readop_arg16((A)<<1)) +#define PIC16C5x_RDOP_ARG(A) (program_raw_read_word((A)<<1)) diff --git a/src/emu/cpu/powerpc/ppc.c b/src/emu/cpu/powerpc/ppc.c index b52fa1f05d3..e1ede5e4806 100644 --- a/src/emu/cpu/powerpc/ppc.c +++ b/src/emu/cpu/powerpc/ppc.c @@ -380,8 +380,8 @@ static int bus_freq_multiplier = 1; static PPC_REGS ppc; static UINT32 ppc_rotate_mask[32][32]; -#define ROPCODE(pc) cpu_readop32(pc) -#define ROPCODE64(pc) cpu_readop64(DWORD_XOR_BE(pc)) +#define ROPCODE(pc) program_decrypted_read_dword(pc) +#define ROPCODE64(pc) program_decrypted_read_qword(DWORD_XOR_BE(pc)) /*********************************************************************/ diff --git a/src/emu/cpu/rsp/rsp.c b/src/emu/cpu/rsp/rsp.c index 593b15f66e8..459fdf9ebc3 100644 --- a/src/emu/cpu/rsp/rsp.c +++ b/src/emu/cpu/rsp/rsp.c @@ -150,7 +150,7 @@ typedef struct static RSP_REGS rsp; static int rsp_icount; -#define ROPCODE(pc) cpu_readop32(pc) +#define ROPCODE(pc) program_decrypted_read_dword(pc) INLINE UINT8 READ8(UINT32 address) { diff --git a/src/emu/cpu/s2650/s2650.c b/src/emu/cpu/s2650/s2650.c index 4d3273d8812..4bd60432ccd 100644 --- a/src/emu/cpu/s2650/s2650.c +++ b/src/emu/cpu/s2650/s2650.c @@ -171,7 +171,7 @@ static void s2650_set_sense(int state); ***************************************************************/ INLINE UINT8 ROP(void) { - UINT8 result = cpu_readop(S.page + S.iar); + UINT8 result = program_decrypted_read_byte(S.page + S.iar); S.iar = (S.iar + 1) & PMSK; return result; } @@ -182,7 +182,7 @@ INLINE UINT8 ROP(void) ***************************************************************/ INLINE UINT8 ARG(void) { - UINT8 result = cpu_readop_arg(S.page + S.iar); + UINT8 result = program_raw_read_byte(S.page + S.iar); S.iar = (S.iar + 1) & PMSK; return result; } diff --git a/src/emu/cpu/saturn/satops.c b/src/emu/cpu/saturn/satops.c index 7032f7f4ce5..655fa99eccb 100644 --- a/src/emu/cpu/saturn/satops.c +++ b/src/emu/cpu/saturn/satops.c @@ -7,7 +7,7 @@ INLINE int READ_OP(void) { UINT8 data; saturn_ICount-=3; - data=cpu_readop(saturn.pc); + data=program_decrypted_read_byte(saturn.pc); saturn_assert(data<0x10); saturn.pc=(saturn.pc+1)&0xfffff; return data; @@ -17,7 +17,7 @@ INLINE int READ_OP_ARG(void) { UINT8 data; saturn_ICount-=3; - data=cpu_readop_arg(saturn.pc); + data=program_raw_read_byte(saturn.pc); saturn_assert(data<0x10); saturn.pc=(saturn.pc+1)&0xfffff; return data; diff --git a/src/emu/cpu/sc61860/sc.h b/src/emu/cpu/sc61860/sc.h index 1b00af1c65b..61f55e331c9 100644 --- a/src/emu/cpu/sc61860/sc.h +++ b/src/emu/cpu/sc61860/sc.h @@ -31,4 +31,4 @@ enum // SC61860_IRQ_STATE }; -#define PEEK_OP(pc) cpu_readop(pc) +#define PEEK_OP(pc) program_decrypted_read_byte(pc) diff --git a/src/emu/cpu/sc61860/scops.c b/src/emu/cpu/sc61860/scops.c index 7ae3b5e1237..9c0670b23cc 100644 --- a/src/emu/cpu/sc61860/scops.c +++ b/src/emu/cpu/sc61860/scops.c @@ -28,18 +28,18 @@ INLINE UINT8 READ_OP(void) { - return cpu_readop(sc61860.pc++); + return program_decrypted_read_byte(sc61860.pc++); } INLINE UINT8 READ_OP_ARG(void) { - return cpu_readop_arg(sc61860.pc++); + return program_raw_read_byte(sc61860.pc++); } INLINE UINT16 READ_OP_ARG_WORD(void) { - UINT16 t=cpu_readop(sc61860.pc++)<<8; - t|=cpu_readop(sc61860.pc++); + UINT16 t=program_decrypted_read_byte(sc61860.pc++)<<8; + t|=program_decrypted_read_byte(sc61860.pc++); return t; } diff --git a/src/emu/cpu/se3208/se3208.c b/src/emu/cpu/se3208/se3208.c index 9aa2afc7c54..641ded41139 100644 --- a/src/emu/cpu/se3208/se3208.c +++ b/src/emu/cpu/se3208/se3208.c @@ -1769,7 +1769,7 @@ static CPU_EXECUTE( SE3208 ) SE3208_ICount=cycles; do { - UINT16 Opcode=cpu_readop16(WORD_XOR_LE(Context.PC)); + UINT16 Opcode=program_decrypted_read_word(WORD_XOR_LE(Context.PC)); debugger_instruction_hook(device->machine, Context.PC); diff --git a/src/emu/cpu/sh2/sh2.c b/src/emu/cpu/sh2/sh2.c index 9e2bedb751c..11b664d72ca 100644 --- a/src/emu/cpu/sh2/sh2.c +++ b/src/emu/cpu/sh2/sh2.c @@ -28,7 +28,7 @@ /***************************************************************************** Changes 20051129 Mariusz Wojcieszek - - introduced cpu_readop16() for opcode fetching + - introduced program_decrypted_read_word() for opcode fetching 20050813 Mariusz Wojcieszek - fixed 64 bit / 32 bit division in division unit @@ -2205,12 +2205,12 @@ static CPU_EXECUTE( sh2 ) if (sh2->delay) { - opcode = cpu_readop16(WORD_XOR_BE((UINT32)(sh2->delay & AM))); + opcode = program_decrypted_read_word(WORD_XOR_BE((UINT32)(sh2->delay & AM))); change_pc(sh2->pc & AM); sh2->pc -= 2; } else - opcode = cpu_readop16(WORD_XOR_BE((UINT32)(sh2->pc & AM))); + opcode = program_decrypted_read_word(WORD_XOR_BE((UINT32)(sh2->pc & AM))); debugger_instruction_hook(device->machine, sh2->pc); diff --git a/src/emu/cpu/sh4/sh4.c b/src/emu/cpu/sh4/sh4.c index d78b10b448c..56ab13ed9de 100644 --- a/src/emu/cpu/sh4/sh4.c +++ b/src/emu/cpu/sh4/sh4.c @@ -3328,12 +3328,12 @@ static CPU_EXECUTE( sh4 ) if (sh4.delay) { - opcode = cpu_readop16(WORD2_XOR_LE((UINT32)(sh4.delay & AM))); + opcode = program_decrypted_read_word(WORD2_XOR_LE((UINT32)(sh4.delay & AM))); change_pc(sh4.pc & AM); sh4.pc -= 2; } else - opcode = cpu_readop16(WORD2_XOR_LE((UINT32)(sh4.pc & AM))); + opcode = program_decrypted_read_word(WORD2_XOR_LE((UINT32)(sh4.pc & AM))); debugger_instruction_hook(device->machine, sh4.pc & AM); diff --git a/src/emu/cpu/spc700/spc700.h b/src/emu/cpu/spc700/spc700.h index 7b3e5426bc8..177d84ae726 100644 --- a/src/emu/cpu/spc700/spc700.h +++ b/src/emu/cpu/spc700/spc700.h @@ -137,8 +137,8 @@ extern CPU_GET_INFO( spc700 ); #define spc700_read_8_direct(A) spc700_read_8(A) #define spc700_write_8_direct(A, V) spc700_write_8(A, V) -//#define spc700_read_instruction(A) cpu_readop(A) -//#define spc700_read_8_immediate(A) cpu_readop_arg(A) +//#define spc700_read_instruction(A) program_decrypted_read_byte(A) +//#define spc700_read_8_immediate(A) program_raw_read_byte(A) #define spc700_read_instruction(A) program_read_byte_8le(A) #define spc700_read_8_immediate(A) program_read_byte_8le(A) #define spc700_jumping(A) change_pc(A) diff --git a/src/emu/cpu/ssp1601/ssp1601.c b/src/emu/cpu/ssp1601/ssp1601.c index bea127462c5..9a1dd92e351 100644 --- a/src/emu/cpu/ssp1601/ssp1601.c +++ b/src/emu/cpu/ssp1601/ssp1601.c @@ -69,7 +69,7 @@ static int g_cycles; #define PPC ssp1601.ppc.w.h -#define FETCH() cpu_readop16(rPC++ << 1) +#define FETCH() program_decrypted_read_word(rPC++ << 1) #define PROGRAM_WORD(a) program_read_word((a) << 1) #define GET_PPC_OFFS() PPC #define CHANGEPC() change_pc(rPC << 1) diff --git a/src/emu/cpu/t11/t11.c b/src/emu/cpu/t11/t11.c index 3a1f511583a..67098ac46f9 100644 --- a/src/emu/cpu/t11/t11.c +++ b/src/emu/cpu/t11/t11.c @@ -77,7 +77,7 @@ static int t11_ICount; INLINE int ROPCODE(void) { - int val = cpu_readop16(PC); + int val = program_decrypted_read_word(PC); PC += 2; return val; } diff --git a/src/emu/cpu/tms32010/tms32010.h b/src/emu/cpu/tms32010/tms32010.h index ad5d1b88cb3..0a282e39bc6 100644 --- a/src/emu/cpu/tms32010/tms32010.h +++ b/src/emu/cpu/tms32010/tms32010.h @@ -113,7 +113,7 @@ CPU_GET_INFO( tms32010 ); * used to greatly speed up emulation */ -#define TMS32010_RDOP(A) (cpu_readop16((A)<<1)) +#define TMS32010_RDOP(A) (program_decrypted_read_word((A)<<1)) /**************************************************************************** @@ -122,7 +122,7 @@ CPU_GET_INFO( tms32010 ); * that use different encoding mechanisms for opcodes and opcode arguments */ -#define TMS32010_RDOP_ARG(A) (cpu_readop_arg16((A)<<1)) +#define TMS32010_RDOP_ARG(A) (program_raw_read_word((A)<<1)) diff --git a/src/emu/cpu/tms32025/32025dsm.c b/src/emu/cpu/tms32025/32025dsm.c index 8d5aee11805..d5c406b5a93 100644 --- a/src/emu/cpu/tms32025/32025dsm.c +++ b/src/emu/cpu/tms32025/32025dsm.c @@ -36,10 +36,10 @@ #include "tms32025.h" #include "debugger.h" extern UINT16 *tms32025_pgmmap[0x200]; -//#define READOP16(A) (cpu_readop16((A) | (TMS32025_PGM_OFFSET << 1))) -//#define READARG16(A) (cpu_readop_arg16((A) | (TMS32025_PGM_OFFSET << 1))) -#define READOP16(A) ((tms32025_pgmmap[(A) >> 7]) ? (tms32025_pgmmap[(A) >> 7][(A) & 0x7f]) : cpu_readop16((A)<<1)) -#define READARG16(A) ((tms32025_pgmmap[(A) >> 7]) ? (tms32025_pgmmap[(A) >> 7][(A) & 0x7f]) : cpu_readop16((A)<<1)) +//#define READOP16(A) (program_decrypted_read_word((A) | (TMS32025_PGM_OFFSET << 1))) +//#define READARG16(A) (program_raw_read_word((A) | (TMS32025_PGM_OFFSET << 1))) +#define READOP16(A) ((tms32025_pgmmap[(A) >> 7]) ? (tms32025_pgmmap[(A) >> 7][(A) & 0x7f]) : program_decrypted_read_word((A)<<1)) +#define READARG16(A) ((tms32025_pgmmap[(A) >> 7]) ? (tms32025_pgmmap[(A) >> 7][(A) & 0x7f]) : program_decrypted_read_word((A)<<1)) diff --git a/src/emu/cpu/tms32025/tms32025.c b/src/emu/cpu/tms32025/tms32025.c index 22cac92ed95..9f446bebc7e 100644 --- a/src/emu/cpu/tms32025/tms32025.c +++ b/src/emu/cpu/tms32025/tms32025.c @@ -176,8 +176,8 @@ INLINE void M_WRTRAM(offs_t addr, UINT16 data) #define S_IN(A) (io_read_word_16be((A)<<1)) #define S_OUT(A,V) (io_write_word_16be(((A)<<1),(V))) -#define M_RDOP(A) ((tms32025_pgmmap[(A) >> 7]) ? (tms32025_pgmmap[(A) >> 7][(A) & 0x7f]) : cpu_readop16((A)<<1)) -#define M_RDOP_ARG(A) ((tms32025_pgmmap[(A) >> 7]) ? (tms32025_pgmmap[(A) >> 7][(A) & 0x7f]) : cpu_readop16((A)<<1)) +#define M_RDOP(A) ((tms32025_pgmmap[(A) >> 7]) ? (tms32025_pgmmap[(A) >> 7][(A) & 0x7f]) : program_decrypted_read_word((A)<<1)) +#define M_RDOP_ARG(A) ((tms32025_pgmmap[(A) >> 7]) ? (tms32025_pgmmap[(A) >> 7][(A) & 0x7f]) : program_decrypted_read_word((A)<<1)) diff --git a/src/emu/cpu/tms32031/tms32031.c b/src/emu/cpu/tms32031/tms32031.c index b1c1fa2f22c..11c04ad03e1 100644 --- a/src/emu/cpu/tms32031/tms32031.c +++ b/src/emu/cpu/tms32031/tms32031.c @@ -144,7 +144,7 @@ static tms32031_regs tms32031; MEMORY ACCESSORS ***************************************************************************/ -#define ROPCODE(pc) cpu_readop32((pc) << 2) +#define ROPCODE(pc) program_decrypted_read_dword((pc) << 2) #define OP tms32031.op #define RMEM(addr) program_read_dword_32le((addr) << 2) diff --git a/src/emu/cpu/tms32051/tms32051.c b/src/emu/cpu/tms32051/tms32051.c index 615f54919ff..7b646a63c80 100644 --- a/src/emu/cpu/tms32051/tms32051.c +++ b/src/emu/cpu/tms32051/tms32051.c @@ -154,7 +154,7 @@ static int tms_icount; #define CYCLES(x) (tms_icount -= x) -#define ROPCODE() cpu_readop16((tms.pc++) << 1) +#define ROPCODE() program_decrypted_read_word((tms.pc++) << 1) INLINE void CHANGE_PC(UINT16 new_pc) { diff --git a/src/emu/cpu/tms34010/34010ops.c b/src/emu/cpu/tms34010/34010ops.c index 4e500d23e8d..daca86acd09 100644 --- a/src/emu/cpu/tms34010/34010ops.c +++ b/src/emu/cpu/tms34010/34010ops.c @@ -78,13 +78,13 @@ static void unimpl(tms34010_state *tms, UINT16 op) { /* kludge for Super High Impact -- this doesn't seem to cause */ /* an illegal opcode exception */ - if (cpu_readop16(TOBYTE(tms->pc - 0x10)) == 0x0007) + if (program_decrypted_read_word(TOBYTE(tms->pc - 0x10)) == 0x0007) return; /* 9 Ball Shootout calls to FFDF7468, expecting it */ /* to execute the next instruction from FFDF7470 */ /* but the instruction at FFDF7460 is an 0x0001 */ - if (cpu_readop16(TOBYTE(tms->pc - 0x10)) == 0x0001) + if (program_decrypted_read_word(TOBYTE(tms->pc - 0x10)) == 0x0001) return; PUSH(tms, tms->pc); @@ -95,7 +95,7 @@ static void unimpl(tms34010_state *tms, UINT16 op) COUNT_UNKNOWN_CYCLES(tms,16); /* extra check to prevent bad things */ - if (tms->pc == 0 || opcode_table[cpu_readop16(TOBYTE(tms->pc)) >> 4] == unimpl) + if (tms->pc == 0 || opcode_table[program_decrypted_read_word(TOBYTE(tms->pc)) >> 4] == unimpl) { cpu_set_input_line(tms->device, INPUT_LINE_HALT, ASSERT_LINE); debugger_break(tms->device->machine); diff --git a/src/emu/cpu/tms34010/tms34010.c b/src/emu/cpu/tms34010/tms34010.c index 14d23c125a9..efa1fe16815 100644 --- a/src/emu/cpu/tms34010/tms34010.c +++ b/src/emu/cpu/tms34010/tms34010.c @@ -215,32 +215,32 @@ INLINE UINT32 ROPCODE(tms34010_state *tms) { UINT32 pc = TOBYTE(tms->pc); tms->pc += 2 << 3; - return cpu_readop16(pc); + return program_decrypted_read_word(pc); } INLINE INT16 PARAM_WORD(tms34010_state *tms) { UINT32 pc = TOBYTE(tms->pc); tms->pc += 2 << 3; - return cpu_readop_arg16(pc); + return program_raw_read_word(pc); } INLINE INT32 PARAM_LONG(tms34010_state *tms) { UINT32 pc = TOBYTE(tms->pc); tms->pc += 4 << 3; - return (UINT16)cpu_readop_arg16(pc) | (cpu_readop_arg16(pc + 2) << 16); + return (UINT16)program_raw_read_word(pc) | (program_raw_read_word(pc + 2) << 16); } INLINE INT16 PARAM_WORD_NO_INC(tms34010_state *tms) { - return cpu_readop_arg16(TOBYTE(tms->pc)); + return program_raw_read_word(TOBYTE(tms->pc)); } INLINE INT32 PARAM_LONG_NO_INC(tms34010_state *tms) { UINT32 pc = TOBYTE(tms->pc); - return (UINT16)cpu_readop_arg16(pc) | (cpu_readop_arg16(pc + 2) << 16); + return (UINT16)program_raw_read_word(pc) | (program_raw_read_word(pc + 2) << 16); } /* read memory byte */ @@ -1634,7 +1634,6 @@ void tms34010_host_w(const device_config *cpu, int reg, int data) /* swap back */ cpu_pop_context(); - memory_set_opbase(cpu_get_physical_pc_byte(tms->device)); } diff --git a/src/emu/cpu/tms7000/7000dasm.c b/src/emu/cpu/tms7000/7000dasm.c index b86843aac8b..b80909a90fe 100644 --- a/src/emu/cpu/tms7000/7000dasm.c +++ b/src/emu/cpu/tms7000/7000dasm.c @@ -431,7 +431,7 @@ CPU_DISASSEMBLE( tms7000 ) break; case TRAP: vector = 0xffff - ((0xff - opcode) * 2); - c = (UINT16)((cpu_readop( vector-1 ) << 8) + cpu_readop( vector )); + c = (UINT16)((program_decrypted_read_byte( vector-1 ) << 8) + program_decrypted_read_byte( vector )); break; } } diff --git a/src/emu/cpu/tms7000/tms7000.c b/src/emu/cpu/tms7000/tms7000.c index cf3cbd051e5..68b8de37fb8 100644 --- a/src/emu/cpu/tms7000/tms7000.c +++ b/src/emu/cpu/tms7000/tms7000.c @@ -89,9 +89,9 @@ INLINE void WRF16( UINT32 mAddr, PAIR p ) /*Write register file (16 bit) */ WM( mAddr, p.b.l ); } -#define IMMBYTE(b) b = ((unsigned)cpu_readop_arg(pPC)); pPC++ -#define SIMMBYTE(b) b = ((signed)cpu_readop_arg(pPC)); pPC++ -#define IMMWORD(w) w.b.h = (unsigned)cpu_readop_arg(pPC++); w.b.l = (unsigned)cpu_readop_arg(pPC++) +#define IMMBYTE(b) b = ((unsigned)program_raw_read_byte(pPC)); pPC++ +#define SIMMBYTE(b) b = ((signed)program_raw_read_byte(pPC)); pPC++ +#define IMMWORD(w) w.b.h = (unsigned)program_raw_read_byte(pPC++); w.b.l = (unsigned)program_raw_read_byte(pPC++) #define PUSHBYTE(b) pSP++; WM(pSP,b) #define PUSHWORD(w) pSP++; WM(pSP,w.b.h); pSP++; WM(pSP,w.b.l) @@ -474,7 +474,7 @@ static CPU_EXECUTE( tms7000 ) if( tms7000.idle_state == 0 ) { - op = cpu_readop(pPC++); + op = program_decrypted_read_byte(pPC++); opfn[op](); } @@ -514,7 +514,7 @@ static CPU_EXECUTE( tms7000_exl ) if( tms7000.idle_state == 0 ) { - op = cpu_readop(pPC++); + op = program_decrypted_read_byte(pPC++); opfn_exl[op](); } diff --git a/src/emu/cpu/upd7810/upd7810.c b/src/emu/cpu/upd7810/upd7810.c index d095fd975c2..d16acdc1011 100644 --- a/src/emu/cpu/upd7810/upd7810.c +++ b/src/emu/cpu/upd7810/upd7810.c @@ -536,8 +536,8 @@ struct opcode_s { UINT8 mask_l0_l1; }; -#define RDOP(O) O = cpu_readop(PCD); PC++ -#define RDOPARG(A) A = cpu_readop_arg(PCD); PC++ +#define RDOP(O) O = program_decrypted_read_byte(PCD); PC++ +#define RDOPARG(A) A = program_raw_read_byte(PCD); PC++ #define RM(A) program_read_byte_8le(A) #define WM(A,V) program_write_byte_8le(A,V) diff --git a/src/emu/cpu/v30mz/v30mz.h b/src/emu/cpu/v30mz/v30mz.h index c9dbb2ac04c..7e51862d773 100644 --- a/src/emu/cpu/v30mz/v30mz.h +++ b/src/emu/cpu/v30mz/v30mz.h @@ -85,15 +85,15 @@ typedef enum { AH,AL,CH,CL,DH,DL,BH,BL,SPH,SPL,BPH,BPL,IXH,IXL,IYH,IYL } BREGS; #define read_port(port) io_read_byte_8le(port) #define write_port(port,val) io_write_byte_8le(port,val) -#define FETCH (cpu_readop_arg((I.sregs[CS]<<4)+I.ip++)) -#define FETCHOP (cpu_readop((I.sregs[CS]<<4)+I.ip++)) -#define FETCHWORD(var) { var=cpu_readop_arg((((I.sregs[CS]<<4)+I.ip)))+(cpu_readop_arg((((I.sregs[CS]<<4)+I.ip+1)))<<8); I.ip+=2; } +#define FETCH (program_raw_read_byte((I.sregs[CS]<<4)+I.ip++)) +#define FETCHOP (program_decrypted_read_byte((I.sregs[CS]<<4)+I.ip++)) +#define FETCHWORD(var) { var=program_raw_read_byte((((I.sregs[CS]<<4)+I.ip)))+(program_raw_read_byte((((I.sregs[CS]<<4)+I.ip+1)))<<8); I.ip+=2; } #define PUSH(val) { I.regs.w[SP]-=2; WriteWord((((I.sregs[SS]<<4)+I.regs.w[SP])),val); } #define POP(var) { var = ReadWord((((I.sregs[SS]<<4)+I.regs.w[SP]))); I.regs.w[SP]+=2; } -#define PEEK(addr) ((BYTE)cpu_readop_arg(addr)) -#define PEEKOP(addr) ((BYTE)cpu_readop(addr)) +#define PEEK(addr) ((BYTE)program_raw_read_byte(addr)) +#define PEEKOP(addr) ((BYTE)program_decrypted_read_byte(addr)) -#define GetModRM UINT32 ModRM=cpu_readop_arg((I.sregs[CS]<<4)+I.ip++) +#define GetModRM UINT32 ModRM=program_raw_read_byte((I.sregs[CS]<<4)+I.ip++) /* Cycle count macros: CLK - cycle count is the same on all processors diff --git a/src/emu/cpu/v60/v60mem.c b/src/emu/cpu/v60/v60mem.c index 2f283e31fe0..03d0ac81ec2 100644 --- a/src/emu/cpu/v60/v60mem.c +++ b/src/emu/cpu/v60/v60mem.c @@ -151,18 +151,18 @@ static void PortWrite32_16(offs_t address, UINT32 data) static UINT8 OpRead8_16(offs_t address) { - return cpu_readop(BYTE_XOR_LE(address)); + return program_decrypted_read_byte(BYTE_XOR_LE(address)); } static UINT16 OpRead16_16(offs_t address) { - return cpu_readop(BYTE_XOR_LE(address)) | (cpu_readop(BYTE_XOR_LE(address+1)) << 8); + return program_decrypted_read_byte(BYTE_XOR_LE(address)) | (program_decrypted_read_byte(BYTE_XOR_LE(address+1)) << 8); } static UINT32 OpRead32_16(offs_t address) { - return cpu_readop(BYTE_XOR_LE(address)) | (cpu_readop(BYTE_XOR_LE(address+1)) << 8) | - (cpu_readop(BYTE_XOR_LE(address+2)) << 16) | (cpu_readop(BYTE_XOR_LE(address+3)) << 24); + return program_decrypted_read_byte(BYTE_XOR_LE(address)) | (program_decrypted_read_byte(BYTE_XOR_LE(address+1)) << 8) | + (program_decrypted_read_byte(BYTE_XOR_LE(address+2)) << 16) | (program_decrypted_read_byte(BYTE_XOR_LE(address+3)) << 24); } static void ChangePC_16(offs_t pc) @@ -312,18 +312,18 @@ static void PortWrite32_32(offs_t address, UINT32 data) static UINT8 OpRead8_32(offs_t address) { - return cpu_readop(BYTE4_XOR_LE(address)); + return program_decrypted_read_byte(BYTE4_XOR_LE(address)); } static UINT16 OpRead16_32(offs_t address) { - return cpu_readop(BYTE4_XOR_LE(address)) | (cpu_readop(BYTE4_XOR_LE(address+1)) << 8); + return program_decrypted_read_byte(BYTE4_XOR_LE(address)) | (program_decrypted_read_byte(BYTE4_XOR_LE(address+1)) << 8); } static UINT32 OpRead32_32(offs_t address) { - return cpu_readop(BYTE4_XOR_LE(address)) | (cpu_readop(BYTE4_XOR_LE(address+1)) << 8) | - (cpu_readop(BYTE4_XOR_LE(address+2)) << 16) | (cpu_readop(BYTE4_XOR_LE(address+3)) << 24); + return program_decrypted_read_byte(BYTE4_XOR_LE(address)) | (program_decrypted_read_byte(BYTE4_XOR_LE(address+1)) << 8) | + (program_decrypted_read_byte(BYTE4_XOR_LE(address+2)) << 16) | (program_decrypted_read_byte(BYTE4_XOR_LE(address+3)) << 24); } static void ChangePC_32(offs_t pc) @@ -376,9 +376,9 @@ static const struct cpu_info v70_i = #define PortWrite32 v60.info.pw32 #if defined(LSB_FIRST) && !defined(ALIGN_INTS) -#define OpRead8(a) (cpu_readop(a)) -#define OpRead16(a) (cpu_readop16(a)) -#define OpRead32(a) (cpu_readop32(a)) +#define OpRead8(a) (program_decrypted_read_byte(a)) +#define OpRead16(a) (program_decrypted_read_word(a)) +#define OpRead32(a) (program_decrypted_read_dword(a)) #else #define OpRead8 v60.info.mr8 #define OpRead16 v60.info.mr16 diff --git a/src/emu/cpu/z180/z180dd.c b/src/emu/cpu/z180/z180dd.c index a1195b02883..e6aaf683cbd 100644 --- a/src/emu/cpu/z180/z180dd.c +++ b/src/emu/cpu/z180/z180dd.c @@ -1,6 +1,6 @@ OP(illegal,1) { logerror("Z180 #%d ill. opcode $%02x $%02x\n", - cpunum_get_active(), cpu_readop((_PCD-1)&0xffff), cpu_readop(_PCD)); + cpunum_get_active(), program_decrypted_read_byte((_PCD-1)&0xffff), program_decrypted_read_byte(_PCD)); } /********************************************************** diff --git a/src/emu/cpu/z180/z180ed.c b/src/emu/cpu/z180/z180ed.c index 86e8b2b220f..cc4e1abc004 100644 --- a/src/emu/cpu/z180/z180ed.c +++ b/src/emu/cpu/z180/z180ed.c @@ -1,7 +1,7 @@ OP(illegal,2) { logerror("Z180 #%d ill. opcode $ed $%02x\n", - cpunum_get_active(), cpu_readop((_PCD-1)&0xffff)); + cpunum_get_active(), program_decrypted_read_byte((_PCD-1)&0xffff)); } /********************************************************** diff --git a/src/emu/cpu/z180/z180ops.h b/src/emu/cpu/z180/z180ops.h index de4aa5220ff..a287f186cd1 100644 --- a/src/emu/cpu/z180/z180ops.h +++ b/src/emu/cpu/z180/z180ops.h @@ -111,7 +111,7 @@ INLINE UINT8 ROP(void) { offs_t addr = _PCD; _PC++; - return cpu_readop(MMU_REMAP_ADDR(addr)); + return program_decrypted_read_byte(MMU_REMAP_ADDR(addr)); } /**************************************************************** @@ -124,14 +124,14 @@ INLINE UINT8 ARG(void) { offs_t addr = _PCD; _PC++; - return cpu_readop_arg(MMU_REMAP_ADDR(addr)); + return program_raw_read_byte(MMU_REMAP_ADDR(addr)); } INLINE UINT32 ARG16(void) { offs_t addr = _PCD; _PC += 2; - return cpu_readop_arg(MMU_REMAP_ADDR(addr)) | (cpu_readop_arg(MMU_REMAP_ADDR(addr+1)) << 8); + return program_raw_read_byte(MMU_REMAP_ADDR(addr)) | (program_raw_read_byte(MMU_REMAP_ADDR(addr+1)) << 8); } /**************************************************************************** @@ -200,7 +200,7 @@ void z180_setOPbase(int pc) } \ else \ { \ - UINT8 op = cpu_readop(_PCD); \ + UINT8 op = program_decrypted_read_byte(_PCD); \ if( _PCD == oldpc-1 ) \ { \ /* NOP - JR $-1 or EI - JR $-1 */ \ diff --git a/src/emu/cpu/z80/z80.c b/src/emu/cpu/z80/z80.c index 4c90ebe43e6..a139c4d45a4 100644 --- a/src/emu/cpu/z80/z80.c +++ b/src/emu/cpu/z80/z80.c @@ -621,7 +621,7 @@ INLINE UINT8 ROP(z80_state *z80) { unsigned pc = PCD; PC++; - return cpu_readop(pc); + return program_decrypted_read_byte(pc); } /**************************************************************** @@ -634,14 +634,14 @@ INLINE UINT8 ARG(z80_state *z80) { unsigned pc = PCD; PC++; - return cpu_readop_arg(pc); + return program_raw_read_byte(pc); } INLINE UINT32 ARG16(z80_state *z80) { unsigned pc = PCD; PC += 2; - return cpu_readop_arg(pc) | (cpu_readop_arg((pc+1)&0xffff) << 8); + return program_raw_read_byte(pc) | (program_raw_read_byte((pc+1)&0xffff) << 8); } /*************************************************************** @@ -678,7 +678,7 @@ INLINE UINT32 ARG16(z80_state *z80) } \ else \ { \ - UINT8 op = cpu_readop(PCD); \ + UINT8 op = program_decrypted_read_byte(PCD); \ if( PCD == oldpc-1 ) \ { \ /* NOP - JP $-1 or EI - JP $-1 */ \ @@ -741,7 +741,7 @@ INLINE UINT32 ARG16(z80_state *z80) } \ else \ { \ - UINT8 op = cpu_readop(PCD); \ + UINT8 op = program_decrypted_read_byte(PCD); \ if( PCD == oldpc-1 ) \ { \ /* NOP - JR $-1 or EI - JR $-1 */ \ @@ -2170,7 +2170,7 @@ OP(xycb,ff) { A = SET(7, RM(EA) ); WM( EA,A ); } /* SET 7,A=(XY+o) */ OP(illegal,1) { logerror("Z80 #%d ill. opcode $%02x $%02x\n", - cpunum_get_active(), cpu_readop((PCD-1)&0xffff), cpu_readop(PCD)); + cpunum_get_active(), program_decrypted_read_byte((PCD-1)&0xffff), program_decrypted_read_byte(PCD)); } /********************************************************** @@ -2758,7 +2758,7 @@ OP(fd,ff) { illegal_1(z80); op_ff(z80); } /* DB FD */ OP(illegal,2) { logerror("Z80 #%d ill. opcode $ed $%02x\n", - cpunum_get_active(), cpu_readop((PCD-1)&0xffff)); + cpunum_get_active(), program_decrypted_read_byte((PCD-1)&0xffff)); } /********************************************************** diff --git a/src/emu/cpu/z8000/z8000.c b/src/emu/cpu/z8000/z8000.c index 87017be0972..c713dfe6d03 100644 --- a/src/emu/cpu/z8000/z8000.c +++ b/src/emu/cpu/z8000/z8000.c @@ -187,7 +187,7 @@ static UINT64 *const pRQ[16] = { INLINE UINT16 RDOP(void) { - UINT16 res = cpu_readop16(PC); + UINT16 res = program_decrypted_read_word(PC); PC += 2; return res; } diff --git a/src/emu/cpuintrf.c b/src/emu/cpuintrf.c index fe22b81b360..e98a4fc75f7 100644 --- a/src/emu/cpuintrf.c +++ b/src/emu/cpuintrf.c @@ -1266,7 +1266,6 @@ int cpu_execute(const device_config *device, int cycles) int ran; cpu_push_context(device); - memory_set_opbase(cpu_get_physical_pc_byte(device)); ran = (*classheader->execute)(device, cycles); cpu_pop_context(); return ran; @@ -1282,7 +1281,7 @@ void cpu_reset(const device_config *device) cpu_class_header *classheader = get_safe_classheader(device); cpu_push_context(device); - memory_set_opbase(0); + memory_set_direct_region(cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), 0); (*classheader->reset)(device); cpu_pop_context(); } @@ -1335,19 +1334,6 @@ offs_t cpu_get_physical_pc_byte(const device_config *device) } -/*------------------------------------------------- - cpu_set_opbase - update the banking on a given - CPU --------------------------------------------------*/ - -void cpu_set_opbase(const device_config *device, unsigned val) -{ - cpu_push_context(device); - memory_set_opbase(val); - cpu_pop_context(); -} - - /*------------------------------------------------- cpu_dasm - disassemble a line at a given PC on a given CPU diff --git a/src/emu/cpuintrf.h b/src/emu/cpuintrf.h index d3279e9c832..1b1e87264f9 100644 --- a/src/emu/cpuintrf.h +++ b/src/emu/cpuintrf.h @@ -717,9 +717,6 @@ void cpu_write_byte(const device_config *cpu, offs_t address, UINT8 data); /* return the PC, corrected to a byte offset and translated to physical space, on a given CPU */ offs_t cpu_get_physical_pc_byte(const device_config *cpu); -/* update the banking on a given CPU */ -void cpu_set_opbase(const device_config *cpu, offs_t val); - /* disassemble a line at a given PC on a given CPU */ offs_t cpu_dasm(const device_config *cpu, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram); diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index ab2bda5e12a..d4a9687c508 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -2086,7 +2086,7 @@ UINT64 debug_read_opcode(offs_t address, int size, int arg) address &= info->space[ADDRESS_SPACE_PROGRAM].physbytemask; /* adjust the address */ - memory_set_opbase(address); + memory_set_direct_region(cpu_get_address_space(info->device, ADDRESS_SPACE_PROGRAM), address); switch (info->space[ADDRESS_SPACE_PROGRAM].databytes * 10 + size) { diff --git a/src/emu/debug/debugvw.c b/src/emu/debug/debugvw.c index 42410d295c7..3fb1540445a 100644 --- a/src/emu/debug/debugvw.c +++ b/src/emu/debug/debugvw.c @@ -113,8 +113,8 @@ struct _debug_view_disasm UINT8 right_column; /* right column? */ UINT32 backwards_steps; /* number of backwards steps */ UINT32 dasm_width; /* width of the disassembly area */ - UINT8 * last_opbase_rom; /* last opbase.rom */ - UINT8 * last_opbase_ram; /* last opbase.ram */ + UINT8 * last_direct_raw; /* last direct raw value */ + UINT8 * last_direct_decrypted; /* last direct decrypted value */ UINT32 last_change_count; /* last comment change count */ offs_t last_pcbyte; /* last PC byte value */ UINT32 active_address; /* the address cursor_row is pointing to */ @@ -1463,9 +1463,9 @@ static void disasm_generate_bytes(offs_t pcbyte, int numbytes, const debug_cpu_i static int disasm_recompute(debug_view *view, offs_t pc, int startline, int lines, int original_cpunum) { - extern opbase_data opbase; debug_view_disasm *dasmdata = view->extra_data; const debug_cpu_info *cpuinfo = debug_get_cpu_info(dasmdata->cpunum); + const address_space *space = cpu_get_address_space(cpuinfo->device, ADDRESS_SPACE_PROGRAM); int chunksize, minbytes, maxbytes, maxbytes_clamped; int changed = FALSE; UINT32 addrmask; @@ -1596,11 +1596,11 @@ static int disasm_recompute(debug_view *view, offs_t pc, int startline, int line /* reset the opcode base */ if (dasmdata->cpunum == original_cpunum) - memory_set_opbase(cpu_get_physical_pc_byte(Machine->activecpu)); + memory_set_direct_region(space, cpu_get_physical_pc_byte(Machine->activecpu)); /* update opcode base information */ - dasmdata->last_opbase_rom = opbase.rom; - dasmdata->last_opbase_ram = opbase.ram; + dasmdata->last_direct_decrypted = space->direct.decrypted; + dasmdata->last_direct_raw = space->direct.raw; dasmdata->last_change_count = debug_comment_all_change_count(); /* now longer need to recompute */ @@ -1616,9 +1616,9 @@ static int disasm_recompute(debug_view *view, offs_t pc, int startline, int line static void disasm_update(debug_view *view) { - extern opbase_data opbase; debug_view_disasm *dasmdata = view->extra_data; const debug_cpu_info *cpuinfo = debug_get_cpu_info(dasmdata->cpunum); + const address_space *space = cpu_get_address_space(cpuinfo->device, ADDRESS_SPACE_PROGRAM); offs_t pc = cpu_get_reg(Machine->cpu[dasmdata->cpunum], REG_PC); offs_t pcbyte = ADDR2BYTE_MASKED(pc, cpuinfo, ADDRESS_SPACE_PROGRAM); debug_view_char *dest = view->viewdata; @@ -1680,7 +1680,7 @@ static void disasm_update(debug_view *view) } /* if the opcode base has changed, rework things */ - if (opbase.rom != dasmdata->last_opbase_rom || opbase.ram != dasmdata->last_opbase_ram) + if (space->direct.decrypted != dasmdata->last_direct_decrypted || space->direct.raw != dasmdata->last_direct_raw) dasmdata->recompute = TRUE; /* if the comments have changed, redo it */ @@ -2289,10 +2289,10 @@ static void memory_set_cursor_pos(debug_view *view, offs_t address, UINT8 shift) /*------------------------------------------------- - memory_read_byte - generic byte reader + generic_read_byte - generic byte reader -------------------------------------------------*/ -static UINT8 memory_read_byte(debug_view_memory *memdata, offs_t offs, int apply_translation) +static UINT8 generic_read_byte(debug_view_memory *memdata, offs_t offs, int apply_translation) { /* if no raw data, just use the standard debug routines */ if (memdata->raw_base == NULL) @@ -2307,10 +2307,10 @@ static UINT8 memory_read_byte(debug_view_memory *memdata, offs_t offs, int apply /*------------------------------------------------- - memory_read_word - generic word reader + generic_read_word - generic word reader -------------------------------------------------*/ -static UINT16 memory_read_word(debug_view_memory *memdata, offs_t offs, int apply_translation) +static UINT16 generic_read_word(debug_view_memory *memdata, offs_t offs, int apply_translation) { /* if no raw data, just use the standard debug routines */ if (memdata->raw_base == NULL) @@ -2318,17 +2318,17 @@ static UINT16 memory_read_word(debug_view_memory *memdata, offs_t offs, int appl /* otherwise, decompose into bytes */ if (memdata->raw_little_endian) - return memory_read_byte(memdata, offs + 0, apply_translation) | (memory_read_byte(memdata, offs + 1, apply_translation) << 8); + return generic_read_byte(memdata, offs + 0, apply_translation) | (generic_read_byte(memdata, offs + 1, apply_translation) << 8); else - return memory_read_byte(memdata, offs + 1, apply_translation) | (memory_read_byte(memdata, offs + 0, apply_translation) << 8); + return generic_read_byte(memdata, offs + 1, apply_translation) | (generic_read_byte(memdata, offs + 0, apply_translation) << 8); } /*------------------------------------------------- - memory_read_dword - generic dword reader + generic_read_dword - generic dword reader -------------------------------------------------*/ -static UINT32 memory_read_dword(debug_view_memory *memdata, offs_t offs, int apply_translation) +static UINT32 generic_read_dword(debug_view_memory *memdata, offs_t offs, int apply_translation) { /* if no raw data, just use the standard debug routines */ if (memdata->raw_base == NULL) @@ -2336,17 +2336,17 @@ static UINT32 memory_read_dword(debug_view_memory *memdata, offs_t offs, int app /* otherwise, decompose into words */ if (memdata->raw_little_endian) - return memory_read_word(memdata, offs + 0, apply_translation) | (memory_read_word(memdata, offs + 2, apply_translation) << 16); + return generic_read_word(memdata, offs + 0, apply_translation) | (generic_read_word(memdata, offs + 2, apply_translation) << 16); else - return memory_read_word(memdata, offs + 2, apply_translation) | (memory_read_word(memdata, offs + 0, apply_translation) << 16); + return generic_read_word(memdata, offs + 2, apply_translation) | (generic_read_word(memdata, offs + 0, apply_translation) << 16); } /*------------------------------------------------- - memory_read_qword - generic qword reader + generic_read_qword - generic qword reader -------------------------------------------------*/ -static UINT64 memory_read_qword(debug_view_memory *memdata, offs_t offs, int apply_translation) +static UINT64 generic_read_qword(debug_view_memory *memdata, offs_t offs, int apply_translation) { /* if no raw data, just use the standard debug routines */ if (memdata->raw_base == NULL) @@ -2354,17 +2354,17 @@ static UINT64 memory_read_qword(debug_view_memory *memdata, offs_t offs, int app /* otherwise, decompose into dwords */ if (memdata->raw_little_endian) - return memory_read_dword(memdata, offs + 0, apply_translation) | ((UINT64)memory_read_dword(memdata, offs + 4, apply_translation) << 32); + return generic_read_dword(memdata, offs + 0, apply_translation) | ((UINT64)generic_read_dword(memdata, offs + 4, apply_translation) << 32); else - return memory_read_dword(memdata, offs + 4, apply_translation) | ((UINT64)memory_read_dword(memdata, offs + 0, apply_translation) << 32); + return generic_read_dword(memdata, offs + 4, apply_translation) | ((UINT64)generic_read_dword(memdata, offs + 0, apply_translation) << 32); } /*------------------------------------------------- - memory_write_byte - generic byte writer + generic_write_byte - generic byte writer -------------------------------------------------*/ -static void memory_write_byte(debug_view_memory *memdata, offs_t offs, UINT8 data, int apply_translation) +static void generic_write_byte(debug_view_memory *memdata, offs_t offs, UINT8 data, int apply_translation) { /* if no raw data, just use the standard debug routines */ if (memdata->raw_base == NULL) @@ -2391,10 +2391,10 @@ static void memory_write_byte(debug_view_memory *memdata, offs_t offs, UINT8 dat /*------------------------------------------------- - memory_write_word - generic word writer + generic_write_word - generic word writer -------------------------------------------------*/ -static void memory_write_word(debug_view_memory *memdata, offs_t offs, UINT16 data, int apply_translation) +static void generic_write_word(debug_view_memory *memdata, offs_t offs, UINT16 data, int apply_translation) { /* if no raw data, just use the standard debug routines */ if (memdata->raw_base == NULL) @@ -2406,22 +2406,22 @@ static void memory_write_word(debug_view_memory *memdata, offs_t offs, UINT16 da /* otherwise, decompose into bytes */ if (memdata->raw_little_endian) { - memory_write_byte(memdata, offs + 0, data, apply_translation); - memory_write_byte(memdata, offs + 1, data >> 8, apply_translation); + generic_write_byte(memdata, offs + 0, data, apply_translation); + generic_write_byte(memdata, offs + 1, data >> 8, apply_translation); } else { - memory_write_byte(memdata, offs + 1, data, apply_translation); - memory_write_byte(memdata, offs + 0, data >> 8, apply_translation); + generic_write_byte(memdata, offs + 1, data, apply_translation); + generic_write_byte(memdata, offs + 0, data >> 8, apply_translation); } } /*------------------------------------------------- - memory_write_dword - generic dword writer + generic_write_dword - generic dword writer -------------------------------------------------*/ -static void memory_write_dword(debug_view_memory *memdata, offs_t offs, UINT32 data, int apply_translation) +static void generic_write_dword(debug_view_memory *memdata, offs_t offs, UINT32 data, int apply_translation) { /* if no raw data, just use the standard debug routines */ if (memdata->raw_base == NULL) @@ -2433,22 +2433,22 @@ static void memory_write_dword(debug_view_memory *memdata, offs_t offs, UINT32 d /* otherwise, decompose into words */ if (memdata->raw_little_endian) { - memory_write_word(memdata, offs + 0, data, apply_translation); - memory_write_word(memdata, offs + 2, data >> 16, apply_translation); + generic_write_word(memdata, offs + 0, data, apply_translation); + generic_write_word(memdata, offs + 2, data >> 16, apply_translation); } else { - memory_write_word(memdata, offs + 2, data, apply_translation); - memory_write_word(memdata, offs + 0, data >> 16, apply_translation); + generic_write_word(memdata, offs + 2, data, apply_translation); + generic_write_word(memdata, offs + 0, data >> 16, apply_translation); } } /*------------------------------------------------- - memory_write_qword - generic qword writer + generic_write_qword - generic qword writer -------------------------------------------------*/ -static void memory_write_qword(debug_view_memory *memdata, offs_t offs, UINT64 data, int apply_translation) +static void generic_write_qword(debug_view_memory *memdata, offs_t offs, UINT64 data, int apply_translation) { /* if no raw data, just use the standard debug routines */ if (memdata->raw_base == NULL) @@ -2460,13 +2460,13 @@ static void memory_write_qword(debug_view_memory *memdata, offs_t offs, UINT64 d /* otherwise, decompose into dwords */ if (memdata->raw_little_endian) { - memory_write_dword(memdata, offs + 0, data, apply_translation); - memory_write_dword(memdata, offs + 4, data >> 32, apply_translation); + generic_write_dword(memdata, offs + 0, data, apply_translation); + generic_write_dword(memdata, offs + 4, data >> 32, apply_translation); } else { - memory_write_dword(memdata, offs + 4, data, apply_translation); - memory_write_dword(memdata, offs + 0, data >> 32, apply_translation); + generic_write_dword(memdata, offs + 4, data, apply_translation); + generic_write_dword(memdata, offs + 0, data >> 32, apply_translation); } } @@ -2565,7 +2565,7 @@ static void memory_handle_char(debug_view *view, char chval) default: case 1: if (hexchar) - memory_write_byte(memdata, address, (memory_read_byte(memdata, address, !memdata->no_translation) & ~(0xf << shift)) | ((hexchar - hexvals) << shift), !memdata->no_translation); + generic_write_byte(memdata, address, (generic_read_byte(memdata, address, !memdata->no_translation) & ~(0xf << shift)) | ((hexchar - hexvals) << shift), !memdata->no_translation); if (hexchar || chval == DCH_RIGHT) { if (shift == 0) { shift = 8-4; if (address != maxaddr) address++; } @@ -2580,7 +2580,7 @@ static void memory_handle_char(debug_view *view, char chval) case 2: if (hexchar) - memory_write_word(memdata, address, (memory_read_word(memdata, address, !memdata->no_translation) & ~(0xf << shift)) | ((hexchar - hexvals) << shift), !memdata->no_translation); + generic_write_word(memdata, address, (generic_read_word(memdata, address, !memdata->no_translation) & ~(0xf << shift)) | ((hexchar - hexvals) << shift), !memdata->no_translation); if (hexchar || chval == DCH_RIGHT) { if (shift == 0) { shift = 16-4; if (address != maxaddr) address += 2; } @@ -2595,7 +2595,7 @@ static void memory_handle_char(debug_view *view, char chval) case 4: if (hexchar) - memory_write_dword(memdata, address, (memory_read_dword(memdata, address, !memdata->no_translation) & ~(0xf << shift)) | ((hexchar - hexvals) << shift), !memdata->no_translation); + generic_write_dword(memdata, address, (generic_read_dword(memdata, address, !memdata->no_translation) & ~(0xf << shift)) | ((hexchar - hexvals) << shift), !memdata->no_translation); if (hexchar || chval == DCH_RIGHT) { if (shift == 0) { shift = 32-4; if (address != maxaddr) address += 4; } @@ -2610,7 +2610,7 @@ static void memory_handle_char(debug_view *view, char chval) case 8: if (hexchar) - memory_write_qword(memdata, address, (memory_read_qword(memdata, address, !memdata->no_translation) & ~((UINT64)0xf << shift)) | ((UINT64)(hexchar - hexvals) << shift), !memdata->no_translation); + generic_write_qword(memdata, address, (generic_read_qword(memdata, address, !memdata->no_translation) & ~((UINT64)0xf << shift)) | ((UINT64)(hexchar - hexvals) << shift), !memdata->no_translation); if (hexchar || chval == DCH_RIGHT) { if (shift == 0) { shift = 64-4; if (address != maxaddr) address += 8; } @@ -2773,7 +2773,7 @@ static void memory_update(debug_view *view) len += sprintf(&data[len], " "); else if (memdata->raw_base != NULL || memdata->no_translation || cpuinfo->translate == NULL || (*cpuinfo->translate)(cpuinfo->device, memdata->spacenum, TRANSLATE_READ_DEBUG, &curaddr)) - len += sprintf(&data[len], "%02X ", memory_read_byte(memdata, addrbyte + i, !memdata->no_translation)); + len += sprintf(&data[len], "%02X ", generic_read_byte(memdata, addrbyte + i, !memdata->no_translation)); else len += sprintf(&data[len], "** "); } @@ -2787,7 +2787,7 @@ static void memory_update(debug_view *view) len += sprintf(&data[len], " "); else if (memdata->raw_base != NULL || memdata->no_translation || cpuinfo->translate == NULL || (*cpuinfo->translate)(cpuinfo->device, memdata->spacenum, TRANSLATE_READ_DEBUG, &curaddr)) - len += sprintf(&data[len], " %04X ", memory_read_word(memdata, addrbyte + 2 * i, !memdata->no_translation)); + len += sprintf(&data[len], " %04X ", generic_read_word(memdata, addrbyte + 2 * i, !memdata->no_translation)); else len += sprintf(&data[len], " **** "); } @@ -2801,7 +2801,7 @@ static void memory_update(debug_view *view) len += sprintf(&data[len], " "); else if (memdata->raw_base != NULL || memdata->no_translation || cpuinfo->translate == NULL || (*cpuinfo->translate)(cpuinfo->device, memdata->spacenum, TRANSLATE_READ_DEBUG, &curaddr)) - len += sprintf(&data[len], " %08X ", memory_read_dword(memdata, addrbyte + 4 * i, !memdata->no_translation)); + len += sprintf(&data[len], " %08X ", generic_read_dword(memdata, addrbyte + 4 * i, !memdata->no_translation)); else len += sprintf(&data[len], " ******** "); } @@ -2816,7 +2816,7 @@ static void memory_update(debug_view *view) else if (memdata->raw_base != NULL || memdata->no_translation || cpuinfo->translate == NULL || (*cpuinfo->translate)(cpuinfo->device, memdata->spacenum, TRANSLATE_READ_DEBUG, &curaddr)) { - UINT64 qword = memory_read_qword(memdata, addrbyte + 8 * i, !memdata->no_translation); + UINT64 qword = generic_read_qword(memdata, addrbyte + 8 * i, !memdata->no_translation); len += sprintf(&data[len], " %08X%08X ", (UINT32)(qword >> 32), (UINT32)qword); } else @@ -2831,7 +2831,7 @@ static void memory_update(debug_view *view) { if (addrbyte + i <= maxaddr) { - char c = memory_read_byte(memdata, addrbyte + i, !memdata->no_translation); + char c = generic_read_byte(memdata, addrbyte + i, !memdata->no_translation); len += sprintf(&data[len], "%c", isprint((UINT8)c) ? c : '.'); } else @@ -2849,7 +2849,7 @@ static void memory_update(debug_view *view) { if (addrbyte + i <= maxaddr) { - char c = memory_read_byte(memdata, addrbyte + i, !memdata->no_translation); + char c = generic_read_byte(memdata, addrbyte + i, !memdata->no_translation); len += sprintf(&data[len], "%c", isprint((UINT8)c) ? c : '.'); } else @@ -2869,7 +2869,7 @@ static void memory_update(debug_view *view) len += sprintf(&data[len], " "); else if (memdata->raw_base != NULL || memdata->no_translation || cpuinfo->translate == NULL || (*cpuinfo->translate)(cpuinfo->device, memdata->spacenum, TRANSLATE_READ_DEBUG, &curaddr)) - len += sprintf(&data[len], "%02X ", memory_read_byte(memdata, addrbyte + i, !memdata->no_translation)); + len += sprintf(&data[len], "%02X ", generic_read_byte(memdata, addrbyte + i, !memdata->no_translation)); else len += sprintf(&data[len], "** "); } @@ -2883,7 +2883,7 @@ static void memory_update(debug_view *view) len += sprintf(&data[len], " "); else if (memdata->raw_base != NULL || memdata->no_translation || cpuinfo->translate == NULL || (*cpuinfo->translate)(cpuinfo->device, memdata->spacenum, TRANSLATE_READ_DEBUG, &curaddr)) - len += sprintf(&data[len], " %04X ", memory_read_word(memdata, addrbyte + 2 * i, !memdata->no_translation)); + len += sprintf(&data[len], " %04X ", generic_read_word(memdata, addrbyte + 2 * i, !memdata->no_translation)); else len += sprintf(&data[len], " **** "); } @@ -2897,7 +2897,7 @@ static void memory_update(debug_view *view) len += sprintf(&data[len], " "); else if (memdata->raw_base != NULL || memdata->no_translation || cpuinfo->translate == NULL || (*cpuinfo->translate)(cpuinfo->device, memdata->spacenum, TRANSLATE_READ_DEBUG, &curaddr)) - len += sprintf(&data[len], " %08X ", memory_read_dword(memdata, addrbyte + 4 * i, !memdata->no_translation)); + len += sprintf(&data[len], " %08X ", generic_read_dword(memdata, addrbyte + 4 * i, !memdata->no_translation)); else len += sprintf(&data[len], " ******** "); } @@ -2912,7 +2912,7 @@ static void memory_update(debug_view *view) else if (memdata->raw_base != NULL || memdata->no_translation || cpuinfo->translate == NULL || (*cpuinfo->translate)(cpuinfo->device, memdata->spacenum, TRANSLATE_READ_DEBUG, &curaddr)) { - UINT64 qword = memory_read_qword(memdata, addrbyte + 8 * i, !memdata->no_translation); + UINT64 qword = generic_read_qword(memdata, addrbyte + 8 * i, !memdata->no_translation); len += sprintf(&data[len], " %08X%08X ", (UINT32)(qword >> 32), (UINT32)qword); } else diff --git a/src/emu/mame.c b/src/emu/mame.c index da7d1b03a52..0a943378b05 100644 --- a/src/emu/mame.c +++ b/src/emu/mame.c @@ -1749,9 +1749,6 @@ static void handle_save(running_machine *machine) { cpu_push_context(machine->cpu[cpunum]); - /* make sure banking is set */ - memory_set_opbase(cpu_get_physical_pc_byte(machine->activecpu)); - /* save the CPU data */ state_save_push_tag(cpunum + 1); state_save_save_continue(machine); @@ -1832,17 +1829,11 @@ static void handle_load(running_machine *machine) { cpu_push_context(machine->cpu[cpunum]); - /* make sure banking is set */ - memory_set_opbase(cpu_get_physical_pc_byte(machine->activecpu)); - /* load the CPU data */ state_save_push_tag(cpunum + 1); state_save_load_continue(machine); state_save_pop_tag(); - /* make sure banking is set */ - memory_set_opbase(cpu_get_physical_pc_byte(machine->activecpu)); - cpu_pop_context(); } diff --git a/src/emu/memory.c b/src/emu/memory.c index c9227e604d6..7f5a0158bd8 100644 --- a/src/emu/memory.c +++ b/src/emu/memory.c @@ -54,7 +54,7 @@ - Automatically mirror program space into data space if no data space - Get rid of opcode/data separation by using address spaces? - Add support for internal addressing (maybe just accessors - see TMS3202x) - - Evaluate min/max opcode ranges and do we include a check in cpu_readop? + - Evaluate min/max opcode ranges and do we include a check in program_decrypted_read_byte? **************************************************************************** @@ -251,9 +251,6 @@ struct _cpu_data UINT8 * region; /* pointer to memory region */ size_t regionsize; /* size of region, in bytes */ - opbase_handler_func opbase_handler; /* opcode base handler */ - opbase_data opbase; /* dynamic opcode data */ - UINT8 spacemask; /* mask of which address spaces are used */ address_space space[ADDRESS_SPACES]; /* info about each address space */ }; @@ -264,8 +261,6 @@ struct _cpu_data GLOBAL VARIABLES ***************************************************************************/ -opbase_data opbase; /* opcode data */ - address_space * active_address_space[ADDRESS_SPACES];/* address space data */ static UINT8 * bank_ptr[STATIC_COUNT]; /* array of bank pointers */ @@ -276,8 +271,6 @@ static memory_block * memory_block_list; /* head of the list of memory block static int cur_context; /* current CPU context */ -static opbase_handler_func opbase_handler; /* opcode base override */ - static UINT8 debugger_access; /* treat accesses as coming from the debugger */ static UINT8 log_unmap[ADDRESS_SPACES]; /* log unmapped memory accesses */ @@ -288,7 +281,7 @@ static UINT8 * wptable; /* watchpoint-fill table */ #define ACCESSOR_GROUP(type, width) \ { \ - memory_set_opbase, \ + type##_set_direct_region, \ type##_read_byte_##width, \ type##_read_word_##width, \ type##_read_word_masked_##width, \ @@ -381,10 +374,10 @@ static void mem_dump(void); the opcode base -------------------------------------------------*/ -INLINE void force_opbase_update(running_machine *machine) +INLINE void force_opbase_update(address_space *space) { - opbase.entry = 0xff; - memory_set_opbase(cpu_get_physical_pc_byte(Machine->activecpu)); + space->direct.entry = 0xff; + memory_set_direct_region(space, cpu_get_physical_pc_byte(space->cpu)); } @@ -757,13 +750,8 @@ void memory_set_context(running_machine *machine, int activecpu) /* remember dynamic RAM/ROM */ if (activecpu == -1) activecpu = cur_context; - else if (cur_context != -1) - cpudata[cur_context].opbase = opbase; cur_context = activecpu; - opbase = cpudata[activecpu].opbase; - opbase_handler = cpudata[activecpu].opbase_handler; - active_address_space[ADDRESS_SPACE_PROGRAM] = &cpudata[activecpu].space[ADDRESS_SPACE_PROGRAM]; active_address_space[ADDRESS_SPACE_DATA] = &cpudata[activecpu].space[ADDRESS_SPACE_DATA]; active_address_space[ADDRESS_SPACE_IO] = &cpudata[activecpu].space[ADDRESS_SPACE_IO]; @@ -1085,8 +1073,8 @@ void memory_set_decrypted_region(int cpunum, offs_t addrstart, offs_t addrend, v found = TRUE; /* if we are executing from here, force an opcode base update */ - if (cpunum_get_active() >= 0 && cpunum == cur_context && opbase.entry == banknum) - force_opbase_update(Machine); + if (active_address_space[ADDRESS_SPACE_PROGRAM] != NULL && active_address_space[ADDRESS_SPACE_PROGRAM]->direct.entry == banknum) + force_opbase_update(space); } /* fatal error if the decrypted region straddles the bank */ @@ -1107,44 +1095,43 @@ void memory_set_decrypted_region(int cpunum, offs_t addrstart, offs_t addrend, v CPU -------------------------------------------------*/ -opbase_handler_func memory_set_opbase_handler(int cpunum, opbase_handler_func function) +direct_update_func memory_set_direct_update_handler(const address_space *space, direct_update_func function) { - opbase_handler_func old = cpudata[cpunum].opbase_handler; - cpudata[cpunum].opbase_handler = function; - if (cpunum == cpunum_get_active()) - opbase_handler = function; + address_space *spacerw = (address_space *)space; + direct_update_func old = spacerw->directupdate; + spacerw->directupdate = function; return old; } /*------------------------------------------------- - memory_set_opbase - called by CPU cores to + memory_set_direct_region - called by CPU cores to update the opcode base for the given address -------------------------------------------------*/ -void memory_set_opbase(offs_t byteaddress) +void memory_set_direct_region(const address_space *space, offs_t byteaddress) { - const address_space *space = active_address_space[ADDRESS_SPACE_PROGRAM]; + address_space *spacerw = (address_space *)space; UINT8 *base = NULL, *based = NULL; const handler_data *handlers; UINT8 entry; /* allow overrides */ - if (opbase_handler != NULL) + if (spacerw->directupdate != NULL) { - byteaddress = (*opbase_handler)(space, byteaddress, &opbase); + byteaddress = (*spacerw->directupdate)(spacerw, byteaddress, &spacerw->direct); if (byteaddress == ~0) return; } /* perform the lookup */ - byteaddress &= space->bytemask; - entry = space->readlookup[LEVEL1_INDEX(byteaddress)]; + byteaddress &= spacerw->bytemask; + entry = spacerw->readlookup[LEVEL1_INDEX(byteaddress)]; if (entry >= SUBTABLE_BASE) - entry = space->readlookup[LEVEL2_INDEX(entry,byteaddress)]; + entry = spacerw->readlookup[LEVEL2_INDEX(entry,byteaddress)]; /* keep track of current entry */ - opbase.entry = entry; + spacerw->direct.entry = entry; /* if we don't map to a bank, see if there are any banks we can map to */ if (entry < STATIC_BANK1 || entry >= STATIC_RAM) @@ -1153,7 +1140,7 @@ void memory_set_opbase(offs_t byteaddress) for (entry = 1; entry < STATIC_COUNT; entry++) { bank_info *bank = &bankdata[entry]; - if (bank->used && bank->cpunum == cur_context && bank->spacenum == ADDRESS_SPACE_PROGRAM && + if (bank->used && bank->cpunum == cur_context && bank->spacenum == space->spacenum && bank->bytestart < byteaddress && bank->byteend > byteaddress) break; } @@ -1174,15 +1161,30 @@ void memory_set_opbase(offs_t byteaddress) based = base; /* compute the adjusted base */ - handlers = active_address_space[ADDRESS_SPACE_PROGRAM]->read.handlers[entry]; - opbase.mask = handlers->bytemask; - opbase.ram = base - (handlers->bytestart & opbase.mask); - opbase.rom = based - (handlers->bytestart & opbase.mask); - opbase.mem_min = handlers->bytestart; - opbase.mem_max = handlers->byteend; + handlers = spacerw->read.handlers[entry]; + spacerw->direct.mask = handlers->bytemask; + spacerw->direct.raw = base - (handlers->bytestart & spacerw->direct.mask); + spacerw->direct.decrypted = based - (handlers->bytestart & spacerw->direct.mask); + spacerw->direct.min = handlers->bytestart; + spacerw->direct.max = handlers->byteend; } +void program_set_direct_region(offs_t byteaddress) +{ + memory_set_direct_region(active_address_space[ADDRESS_SPACE_PROGRAM], byteaddress); +} + +void data_set_direct_region(offs_t byteaddress) +{ + memory_set_direct_region(active_address_space[ADDRESS_SPACE_DATA], byteaddress); +} + +void io_set_direct_region(offs_t byteaddress) +{ + memory_set_direct_region(active_address_space[ADDRESS_SPACE_IO], byteaddress); +} + /*************************************************************************** OPCODE BASE CONTROL @@ -1248,30 +1250,30 @@ void *memory_get_write_ptr(int cpunum, int spacenum, offs_t byteaddress) void *memory_get_op_ptr(running_machine *machine, int cpunum, offs_t byteaddress, int arg) { - address_space *space = &cpudata[cpunum].space[ADDRESS_SPACE_PROGRAM]; + address_space *spacerw = &cpudata[cpunum].space[ADDRESS_SPACE_PROGRAM]; offs_t byteoffset; void *ptr = NULL; UINT8 entry; /* if there is a custom mapper, use that */ - if (cpudata[cpunum].opbase_handler != NULL) + if (spacerw->directupdate != NULL) { /* need to save opcode info */ - opbase_data saved_opbase = opbase; + direct_read_data saved_data = spacerw->direct; /* query the handler */ - offs_t new_byteaddress = (*cpudata[cpunum].opbase_handler)(space, byteaddress, &opbase); + offs_t new_byteaddress = (*spacerw->directupdate)(spacerw, byteaddress, &spacerw->direct); /* if it returns ~0, we use whatever data the handler set */ if (new_byteaddress == ~0) - ptr = arg ? &opbase.ram[byteaddress] : &opbase.rom[byteaddress]; + ptr = arg ? &spacerw->direct.raw[byteaddress] : &spacerw->direct.decrypted[byteaddress]; /* otherwise, we use the new offset in the generic case below */ else byteaddress = new_byteaddress; /* restore opcode info */ - opbase = saved_opbase; + spacerw->direct = saved_data; /* if we got our pointer, we're done */ if (ptr != NULL) @@ -1279,17 +1281,17 @@ void *memory_get_op_ptr(running_machine *machine, int cpunum, offs_t byteaddress } /* perform the lookup */ - byteaddress &= space->bytemask; - entry = space->read.table[LEVEL1_INDEX(byteaddress)]; + byteaddress &= spacerw->bytemask; + entry = spacerw->read.table[LEVEL1_INDEX(byteaddress)]; if (entry >= SUBTABLE_BASE) - entry = space->read.table[LEVEL2_INDEX(entry, byteaddress)]; + entry = spacerw->read.table[LEVEL2_INDEX(entry, byteaddress)]; /* if a non-RAM area, return NULL */ if (entry >= STATIC_RAM) return NULL; /* adjust the offset */ - byteoffset = (byteaddress - space->read.handlers[entry]->bytestart) & space->read.handlers[entry]->bytemask; + byteoffset = (byteaddress - spacerw->read.handlers[entry]->bytestart) & spacerw->read.handlers[entry]->bytemask; return (!arg && bankd_ptr[entry]) ? &bankd_ptr[entry][byteoffset] : &bank_ptr[entry][byteoffset]; } @@ -1372,8 +1374,8 @@ void memory_set_bank(int banknum, int entrynum) bankd_ptr[banknum] = bankdata[banknum].entryd[entrynum]; /* if we're executing out of this bank, adjust the opbase pointer */ - if (opbase.entry == banknum && cpunum_get_active() >= 0) - force_opbase_update(Machine); + if (active_address_space[ADDRESS_SPACE_PROGRAM] != NULL && active_address_space[ADDRESS_SPACE_PROGRAM]->direct.entry == banknum) + force_opbase_update((address_space *)active_address_space[ADDRESS_SPACE_PROGRAM]); } @@ -1415,8 +1417,8 @@ void memory_set_bankptr(int banknum, void *base) bank_ptr[banknum] = base; /* if we're executing out of this bank, adjust the opbase pointer */ - if (opbase.entry == banknum && cpunum_get_active() >= 0) - force_opbase_update(Machine); + if (active_address_space[ADDRESS_SPACE_PROGRAM] != NULL && active_address_space[ADDRESS_SPACE_PROGRAM]->direct.entry == banknum) + force_opbase_update((address_space *)active_address_space[ADDRESS_SPACE_PROGRAM]); } @@ -1676,15 +1678,15 @@ static void memory_init_cpudata(running_machine *machine) /* initialize the lookups */ space->readlookup = space->read.table; space->writelookup = space->write.table; - } - /* set the RAM/ROM base */ - cpu->opbase.ram = cpu->opbase.rom = cpu->region; - cpu->opbase.mask = cpu->space[ADDRESS_SPACE_PROGRAM].bytemask; - cpu->opbase.mem_min = 0; - cpu->opbase.mem_max = cpu->regionsize; - cpu->opbase.entry = STATIC_UNMAP; - cpu->opbase_handler = NULL; + /* set the RAM/ROM base */ + space->direct.raw = space->direct.decrypted = cpu->region; + space->direct.mask = space->bytemask; + space->direct.min = 0; + space->direct.max = cpu->regionsize; + space->direct.entry = STATIC_UNMAP; + space->directupdate = NULL; + } } } @@ -2795,59 +2797,6 @@ static void *memory_find_base(int cpunum, int spacenum, offs_t byteaddress) -/*------------------------------------------------- - safe opcode reading --------------------------------------------------*/ - -UINT8 cpu_readop_safe(offs_t byteaddress) -{ - cpu_set_opbase(Machine->activecpu, byteaddress); - return cpu_readop_unsafe(byteaddress); -} - -UINT16 cpu_readop16_safe(offs_t byteaddress) -{ - cpu_set_opbase(Machine->activecpu, byteaddress); - return cpu_readop16_unsafe(byteaddress); -} - -UINT32 cpu_readop32_safe(offs_t byteaddress) -{ - cpu_set_opbase(Machine->activecpu, byteaddress); - return cpu_readop32_unsafe(byteaddress); -} - -UINT64 cpu_readop64_safe(offs_t byteaddress) -{ - cpu_set_opbase(Machine->activecpu, byteaddress); - return cpu_readop64_unsafe(byteaddress); -} - -UINT8 cpu_readop_arg_safe(offs_t byteaddress) -{ - cpu_set_opbase(Machine->activecpu, byteaddress); - return cpu_readop_arg_unsafe(byteaddress); -} - -UINT16 cpu_readop_arg16_safe(offs_t byteaddress) -{ - cpu_set_opbase(Machine->activecpu, byteaddress); - return cpu_readop_arg16_unsafe(byteaddress); -} - -UINT32 cpu_readop_arg32_safe(offs_t byteaddress) -{ - cpu_set_opbase(Machine->activecpu, byteaddress); - return cpu_readop_arg32_unsafe(byteaddress); -} - -UINT64 cpu_readop_arg64_safe(offs_t byteaddress) -{ - cpu_set_opbase(Machine->activecpu, byteaddress); - return cpu_readop_arg64_unsafe(byteaddress); -} - - /*------------------------------------------------- unmapped memory handlers -------------------------------------------------*/ diff --git a/src/emu/memory.h b/src/emu/memory.h index bc20362be04..dc9555aae81 100644 --- a/src/emu/memory.h +++ b/src/emu/memory.h @@ -97,21 +97,21 @@ typedef struct _address_space address_space; typedef UINT32 offs_t; -/* opbase_data contains state data for opcode handling */ -typedef struct _opbase_data opbase_data; -struct _opbase_data +/* direct_read_data contains state data for direct read access */ +typedef struct _direct_read_data direct_read_data; +struct _direct_read_data { - UINT8 * rom; /* opcode ROM base pointer */ - UINT8 * ram; /* opcode RAM base pointer */ - offs_t mask; /* opcode ROM address mask */ - offs_t mem_min; /* opcode ROM/RAM min */ - offs_t mem_max; /* opcode ROM/RAM max */ - UINT8 entry; /* opcode readmem entry */ + UINT8 * raw; /* direct access data pointer (raw) */ + UINT8 * decrypted; /* direct access data pointer (decrypted) */ + offs_t mask; /* address mask */ + offs_t min; /* minimum valid address */ + offs_t max; /* maximum valid address */ + UINT8 entry; /* live entry */ }; /* opcode base adjustment handler */ -typedef offs_t (*opbase_handler_func) (ATTR_UNUSED const address_space *space, ATTR_UNUSED offs_t address, ATTR_UNUSED opbase_data *opbase); +typedef offs_t (*direct_update_func) (ATTR_UNUSED const address_space *space, ATTR_UNUSED offs_t address, ATTR_UNUSED direct_read_data *direct); /* space read/write handlers */ @@ -277,6 +277,8 @@ struct _address_space UINT8 * readlookup; /* live lookup table for reads */ UINT8 * writelookup; /* live lookup table for writes */ data_accessors accessors; /* data access handlers */ + direct_read_data direct; /* fast direct-access read info */ + direct_update_func directupdate; /* fast direct-access update callback */ UINT64 unmap; /* unmapped value */ offs_t addrmask; /* global address mask */ offs_t bytemask; /* byte-converted global address mask */ @@ -406,7 +408,7 @@ union _addrmap64_token ***************************************************************************/ /* opcode base adjustment handler function macro */ -#define OPBASE_HANDLER(name) offs_t name(ATTR_UNUSED const address_space *space, ATTR_UNUSED offs_t address, opbase_data *opbase) +#define DIRECT_UPDATE_HANDLER(name) offs_t name(ATTR_UNUSED const address_space *space, ATTR_UNUSED offs_t address, direct_read_data *direct) /* space read/write handler function macros */ @@ -493,23 +495,55 @@ union _addrmap64_token /* bank switching for CPU cores */ -#define change_pc(byteaddress) memory_set_opbase(byteaddress) +#define change_pc(byteaddress) memory_set_direct_region(active_address_space[ADDRESS_SPACE_PROGRAM], byteaddress) /* opcode range safety check */ -#define address_is_unsafe(A) ((UNEXPECTED((A) < opbase.mem_min) || UNEXPECTED((A) > opbase.mem_max))) +#define address_is_unsafe(S,A) ((UNEXPECTED((A) < (S)->direct.min) || UNEXPECTED((A) > (S)->direct.max))) -/* unsafe opcode and opcode argument reading */ -#define cpu_opptr_unsafe(A) ((void *)&opbase.rom[(A) & opbase.mask]) -#define cpu_readop_unsafe(A) (opbase.rom[(A) & opbase.mask]) -#define cpu_readop16_unsafe(A) (*(UINT16 *)&opbase.rom[(A) & opbase.mask]) -#define cpu_readop32_unsafe(A) (*(UINT32 *)&opbase.rom[(A) & opbase.mask]) -#define cpu_readop64_unsafe(A) (*(UINT64 *)&opbase.rom[(A) & opbase.mask]) -#define cpu_readop_arg_unsafe(A) (opbase.ram[(A) & opbase.mask]) -#define cpu_readop_arg16_unsafe(A) (*(UINT16 *)&opbase.ram[(A) & opbase.mask]) -#define cpu_readop_arg32_unsafe(A) (*(UINT32 *)&opbase.ram[(A) & opbase.mask]) -#define cpu_readop_arg64_unsafe(A) (*(UINT64 *)&opbase.ram[(A) & opbase.mask]) +/* temporary shortcuts for accessing the active address space */ +#define program_read_byte(_addr) memory_read_byte(active_address_space[ADDRESS_SPACE_PROGRAM], (_addr)) +#define program_read_word(_addr) memory_read_word(active_address_space[ADDRESS_SPACE_PROGRAM], (_addr)) +#define program_read_dword(_addr) memory_read_dword(active_address_space[ADDRESS_SPACE_PROGRAM], (_addr)) +#define program_read_qword(_addr) memory_read_qword(active_address_space[ADDRESS_SPACE_PROGRAM], (_addr)) + +#define program_write_byte(_addr,_data) memory_write_byte(active_address_space[ADDRESS_SPACE_PROGRAM], (_addr), (_data)) +#define program_write_word(_addr,_data) memory_write_word(active_address_space[ADDRESS_SPACE_PROGRAM], (_addr), (_data)) +#define program_write_dword(_addr,_data) memory_write_dword(active_address_space[ADDRESS_SPACE_PROGRAM], (_addr), (_data)) +#define program_write_qword(_addr,_data) memory_write_qword(active_address_space[ADDRESS_SPACE_PROGRAM], (_addr), (_data)) + +#define program_decrypted_read_ptr(_addr) memory_decrypted_read_ptr(active_address_space[ADDRESS_SPACE_PROGRAM], (_addr)) +#define program_decrypted_read_byte(_addr) memory_decrypted_read_byte(active_address_space[ADDRESS_SPACE_PROGRAM], (_addr)) +#define program_decrypted_read_word(_addr) memory_decrypted_read_word(active_address_space[ADDRESS_SPACE_PROGRAM], (_addr)) +#define program_decrypted_read_dword(_addr) memory_decrypted_read_dword(active_address_space[ADDRESS_SPACE_PROGRAM], (_addr)) +#define program_decrypted_read_qword(_addr) memory_decrypted_read_qword(active_address_space[ADDRESS_SPACE_PROGRAM], (_addr)) + +#define program_raw_read_ptr(_addr) memory_raw_read_ptr(active_address_space[ADDRESS_SPACE_PROGRAM], (_addr)) +#define program_raw_read_byte(_addr) memory_raw_read_byte(active_address_space[ADDRESS_SPACE_PROGRAM], (_addr)) +#define program_raw_read_word(_addr) memory_raw_read_word(active_address_space[ADDRESS_SPACE_PROGRAM], (_addr)) +#define program_raw_read_dword(_addr) memory_raw_read_dword(active_address_space[ADDRESS_SPACE_PROGRAM], (_addr)) +#define program_raw_read_qword(_addr) memory_raw_read_qword(active_address_space[ADDRESS_SPACE_PROGRAM], (_addr)) + +#define data_read_byte(_addr) memory_read_byte(active_address_space[ADDRESS_SPACE_DATA], (_addr)) +#define data_read_word(_addr) memory_read_word(active_address_space[ADDRESS_SPACE_DATA], (_addr)) +#define data_read_dword(_addr) memory_read_dword(active_address_space[ADDRESS_SPACE_DATA], (_addr)) +#define data_read_qword(_addr) memory_read_qword(active_address_space[ADDRESS_SPACE_DATA], (_addr)) + +#define data_write_byte(_addr,_data) memory_write_byte(active_address_space[ADDRESS_SPACE_DATA], (_addr), (_data)) +#define data_write_word(_addr,_data) memory_write_word(active_address_space[ADDRESS_SPACE_DATA], (_addr), (_data)) +#define data_write_dword(_addr,_data) memory_write_dword(active_address_space[ADDRESS_SPACE_DATA], (_addr), (_data)) +#define data_write_qword(_addr,_data) memory_write_qword(active_address_space[ADDRESS_SPACE_DATA], (_addr), (_data)) + +#define io_read_byte(_addr) memory_read_byte(active_address_space[ADDRESS_SPACE_IO], (_addr)) +#define io_read_word(_addr) memory_read_word(active_address_space[ADDRESS_SPACE_IO], (_addr)) +#define io_read_dword(_addr) memory_read_dword(active_address_space[ADDRESS_SPACE_IO], (_addr)) +#define io_read_qword(_addr) memory_read_qword(active_address_space[ADDRESS_SPACE_IO], (_addr)) + +#define io_write_byte(_addr,_data) memory_write_byte(active_address_space[ADDRESS_SPACE_IO], (_addr), (_data)) +#define io_write_word(_addr,_data) memory_write_word(active_address_space[ADDRESS_SPACE_IO], (_addr), (_data)) +#define io_write_dword(_addr,_data) memory_write_dword(active_address_space[ADDRESS_SPACE_IO], (_addr), (_data)) +#define io_write_qword(_addr,_data) memory_write_qword(active_address_space[ADDRESS_SPACE_IO], (_addr), (_data)) /* wrappers for dynamic read handler installation */ @@ -890,10 +924,10 @@ const address_map *memory_get_address_map(int cpunum, int spacenum); void memory_set_decrypted_region(int cpunum, offs_t addrstart, offs_t addrend, void *base); /* register a handler for opcode base changes on a given CPU */ -opbase_handler_func memory_set_opbase_handler(int cpunum, opbase_handler_func function); +direct_update_func memory_set_direct_update_handler(const address_space *space, direct_update_func function); /* called by CPU cores to update the opcode base for the given address */ -void memory_set_opbase(offs_t byteaddress); +void memory_set_direct_region(const address_space *space, offs_t byteaddress); @@ -936,67 +970,161 @@ const char *memory_get_handler_string(int read0_or_write1, int cpunum, int space /*************************************************************************** - HELPER MACROS AND INLINES + INLINE FUNCTIONS ***************************************************************************/ -/* generic memory access */ -INLINE UINT8 program_read_byte (offs_t byteaddress) { return (*active_address_space[ADDRESS_SPACE_PROGRAM]->accessors.read_byte)(byteaddress); } -INLINE UINT16 program_read_word (offs_t byteaddress) { return (*active_address_space[ADDRESS_SPACE_PROGRAM]->accessors.read_word)(byteaddress); } -INLINE UINT32 program_read_dword(offs_t byteaddress) { return (*active_address_space[ADDRESS_SPACE_PROGRAM]->accessors.read_dword)(byteaddress); } -INLINE UINT64 program_read_qword(offs_t byteaddress) { return (*active_address_space[ADDRESS_SPACE_PROGRAM]->accessors.read_qword)(byteaddress); } +/*------------------------------------------------- + memory_read_byte/word/dword/qword - read a + value from the specified address space +-------------------------------------------------*/ -INLINE void program_write_byte (offs_t byteaddress, UINT8 data) { (*active_address_space[ADDRESS_SPACE_PROGRAM]->accessors.write_byte)(byteaddress, data); } -INLINE void program_write_word (offs_t byteaddress, UINT16 data) { (*active_address_space[ADDRESS_SPACE_PROGRAM]->accessors.write_word)(byteaddress, data); } -INLINE void program_write_dword(offs_t byteaddress, UINT32 data) { (*active_address_space[ADDRESS_SPACE_PROGRAM]->accessors.write_dword)(byteaddress, data); } -INLINE void program_write_qword(offs_t byteaddress, UINT64 data) { (*active_address_space[ADDRESS_SPACE_PROGRAM]->accessors.write_qword)(byteaddress, data); } +INLINE UINT8 memory_read_byte(const address_space *space, offs_t byteaddress) +{ + return (*space->accessors.read_byte)(byteaddress); +} -INLINE UINT8 data_read_byte (offs_t byteaddress) { return (*active_address_space[ADDRESS_SPACE_DATA]->accessors.read_byte)(byteaddress); } -INLINE UINT16 data_read_word (offs_t byteaddress) { return (*active_address_space[ADDRESS_SPACE_DATA]->accessors.read_word)(byteaddress); } -INLINE UINT32 data_read_dword(offs_t byteaddress) { return (*active_address_space[ADDRESS_SPACE_DATA]->accessors.read_dword)(byteaddress); } -INLINE UINT64 data_read_qword(offs_t byteaddress) { return (*active_address_space[ADDRESS_SPACE_DATA]->accessors.read_qword)(byteaddress); } +INLINE UINT16 memory_read_word(const address_space *space, offs_t byteaddress) +{ + return (*space->accessors.read_word)(byteaddress); +} -INLINE void data_write_byte (offs_t byteaddress, UINT8 data) { (*active_address_space[ADDRESS_SPACE_DATA]->accessors.write_byte)(byteaddress, data); } -INLINE void data_write_word (offs_t byteaddress, UINT16 data) { (*active_address_space[ADDRESS_SPACE_DATA]->accessors.write_word)(byteaddress, data); } -INLINE void data_write_dword(offs_t byteaddress, UINT32 data) { (*active_address_space[ADDRESS_SPACE_DATA]->accessors.write_dword)(byteaddress, data); } -INLINE void data_write_qword(offs_t byteaddress, UINT64 data) { (*active_address_space[ADDRESS_SPACE_DATA]->accessors.write_qword)(byteaddress, data); } +INLINE UINT32 memory_read_dword(const address_space *space, offs_t byteaddress) +{ + return (*space->accessors.read_dword)(byteaddress); +} -INLINE UINT8 io_read_byte (offs_t byteaddress) { return (*active_address_space[ADDRESS_SPACE_IO]->accessors.read_byte)(byteaddress); } -INLINE UINT16 io_read_word (offs_t byteaddress) { return (*active_address_space[ADDRESS_SPACE_IO]->accessors.read_word)(byteaddress); } -INLINE UINT32 io_read_dword(offs_t byteaddress) { return (*active_address_space[ADDRESS_SPACE_IO]->accessors.read_dword)(byteaddress); } -INLINE UINT64 io_read_qword(offs_t byteaddress) { return (*active_address_space[ADDRESS_SPACE_IO]->accessors.read_qword)(byteaddress); } +INLINE UINT64 memory_read_qword(const address_space *space, offs_t byteaddress) +{ + return (*space->accessors.read_qword)(byteaddress); +} -INLINE void io_write_byte (offs_t byteaddress, UINT8 data) { (*active_address_space[ADDRESS_SPACE_IO]->accessors.write_byte)(byteaddress, data); } -INLINE void io_write_word (offs_t byteaddress, UINT16 data) { (*active_address_space[ADDRESS_SPACE_IO]->accessors.write_word)(byteaddress, data); } -INLINE void io_write_dword(offs_t byteaddress, UINT32 data) { (*active_address_space[ADDRESS_SPACE_IO]->accessors.write_dword)(byteaddress, data); } -INLINE void io_write_qword(offs_t byteaddress, UINT64 data) { (*active_address_space[ADDRESS_SPACE_IO]->accessors.write_qword)(byteaddress, data); } -/* safe opcode and opcode argument reading */ -UINT8 cpu_readop_safe(offs_t byteaddress); -UINT16 cpu_readop16_safe(offs_t byteaddress); -UINT32 cpu_readop32_safe(offs_t byteaddress); -UINT64 cpu_readop64_safe(offs_t byteaddress); -UINT8 cpu_readop_arg_safe(offs_t byteaddress); -UINT16 cpu_readop_arg16_safe(offs_t byteaddress); -UINT32 cpu_readop_arg32_safe(offs_t byteaddress); -UINT64 cpu_readop_arg64_safe(offs_t byteaddress); +/*------------------------------------------------- + memory_write_byte/word/dword/qword - write a + value to the specified address space +-------------------------------------------------*/ -/* opcode and opcode argument reading */ -INLINE void * cpu_opptr(offs_t byteaddress) { extern opbase_data opbase; if (address_is_unsafe(byteaddress)) { memory_set_opbase(byteaddress); } return cpu_opptr_unsafe(byteaddress); } -INLINE UINT8 cpu_readop(offs_t byteaddress) { extern opbase_data opbase; if (address_is_unsafe(byteaddress)) { memory_set_opbase(byteaddress); } return cpu_readop_unsafe(byteaddress); } -INLINE UINT16 cpu_readop16(offs_t byteaddress) { extern opbase_data opbase; if (address_is_unsafe(byteaddress)) { memory_set_opbase(byteaddress); } return cpu_readop16_unsafe(byteaddress); } -INLINE UINT32 cpu_readop32(offs_t byteaddress) { extern opbase_data opbase; if (address_is_unsafe(byteaddress)) { memory_set_opbase(byteaddress); } return cpu_readop32_unsafe(byteaddress); } -INLINE UINT64 cpu_readop64(offs_t byteaddress) { extern opbase_data opbase; if (address_is_unsafe(byteaddress)) { memory_set_opbase(byteaddress); } return cpu_readop64_unsafe(byteaddress); } -INLINE UINT8 cpu_readop_arg(offs_t byteaddress) { extern opbase_data opbase; if (address_is_unsafe(byteaddress)) { memory_set_opbase(byteaddress); } return cpu_readop_arg_unsafe(byteaddress); } -INLINE UINT16 cpu_readop_arg16(offs_t byteaddress) { extern opbase_data opbase; if (address_is_unsafe(byteaddress)) { memory_set_opbase(byteaddress); } return cpu_readop_arg16_unsafe(byteaddress); } -INLINE UINT32 cpu_readop_arg32(offs_t byteaddress) { extern opbase_data opbase; if (address_is_unsafe(byteaddress)) { memory_set_opbase(byteaddress); } return cpu_readop_arg32_unsafe(byteaddress); } -INLINE UINT64 cpu_readop_arg64(offs_t byteaddress) { extern opbase_data opbase; if (address_is_unsafe(byteaddress)) { memory_set_opbase(byteaddress); } return cpu_readop_arg64_unsafe(byteaddress); } +INLINE void memory_write_byte(const address_space *space, offs_t byteaddress, UINT8 data) +{ + (*space->accessors.write_byte)(byteaddress, data); +} +INLINE void memory_write_word(const address_space *space, offs_t byteaddress, UINT16 data) +{ + (*space->accessors.write_word)(byteaddress, data); +} + +INLINE void memory_write_dword(const address_space *space, offs_t byteaddress, UINT32 data) +{ + (*space->accessors.write_dword)(byteaddress, data); +} + +INLINE void memory_write_qword(const address_space *space, offs_t byteaddress, UINT64 data) +{ + (*space->accessors.write_qword)(byteaddress, data); +} + + +/*------------------------------------------------- + memory_decrypted_read_byte/word/dword/qword - + read a value from the specified address space + using the direct addressing mechanism and + the decrypted base pointer +-------------------------------------------------*/ + +INLINE void *memory_decrypted_read_ptr(const address_space *space, offs_t byteaddress) +{ + if (address_is_unsafe(space, byteaddress)) + memory_set_direct_region(space, byteaddress); + return &space->direct.decrypted[byteaddress & space->direct.mask]; +} + +INLINE UINT8 memory_decrypted_read_byte(const address_space *space, offs_t byteaddress) +{ + if (address_is_unsafe(space, byteaddress)) + memory_set_direct_region(space, byteaddress); + return space->direct.decrypted[byteaddress & space->direct.mask]; +} + +INLINE UINT16 memory_decrypted_read_word(const address_space *space, offs_t byteaddress) +{ + if (address_is_unsafe(space, byteaddress)) + memory_set_direct_region(space, byteaddress); + return *(UINT16 *)&space->direct.decrypted[byteaddress & space->direct.mask]; +} + +INLINE UINT32 memory_decrypted_read_dword(const address_space *space, offs_t byteaddress) +{ + if (address_is_unsafe(space, byteaddress)) + memory_set_direct_region(space, byteaddress); + return *(UINT32 *)&space->direct.decrypted[byteaddress & space->direct.mask]; +} + +INLINE UINT64 memory_decrypted_read_qword(const address_space *space, offs_t byteaddress) +{ + if (address_is_unsafe(space, byteaddress)) + memory_set_direct_region(space, byteaddress); + return *(UINT64 *)&space->direct.decrypted[byteaddress & space->direct.mask]; +} + + +/*------------------------------------------------- + memory_raw_read_byte/word/dword/qword - + read a value from the specified address space + using the direct addressing mechanism and + the raw base pointer +-------------------------------------------------*/ + +INLINE void *memory_raw_read_ptr(const address_space *space, offs_t byteaddress) +{ + if (address_is_unsafe(space, byteaddress)) + memory_set_direct_region(space, byteaddress); + return &space->direct.raw[byteaddress & space->direct.mask]; +} + +INLINE UINT8 memory_raw_read_byte(const address_space *space, offs_t byteaddress) +{ + if (address_is_unsafe(space, byteaddress)) + memory_set_direct_region(space, byteaddress); + return space->direct.raw[byteaddress & space->direct.mask]; +} + +INLINE UINT16 memory_raw_read_word(const address_space *space, offs_t byteaddress) +{ + if (address_is_unsafe(space, byteaddress)) + memory_set_direct_region(space, byteaddress); + return *(UINT16 *)&space->direct.raw[byteaddress & space->direct.mask]; +} + +INLINE UINT32 memory_raw_read_dword(const address_space *space, offs_t byteaddress) +{ + if (address_is_unsafe(space, byteaddress)) + memory_set_direct_region(space, byteaddress); + return *(UINT32 *)&space->direct.raw[byteaddress & space->direct.mask]; +} + +INLINE UINT64 memory_raw_read_qword(const address_space *space, offs_t byteaddress) +{ + if (address_is_unsafe(space, byteaddress)) + memory_set_direct_region(space, byteaddress); + return *(UINT64 *)&space->direct.raw[byteaddress & space->direct.mask]; +} + + +/*------------------------------------------------- + program_* - shortcuts to the above for the + active program address space +-------------------------------------------------*/ /*************************************************************************** FUNCTION PROTOTYPES FOR CORE READ/WRITE ROUTINES ***************************************************************************/ +void program_set_direct_region(offs_t byteaddress); +void data_set_direct_region(offs_t byteaddress); +void io_set_direct_region(offs_t byteaddress); + /* declare generic address space handlers */ UINT8 memory_read_byte_8le(const address_space *space, offs_t address); UINT16 memory_read_word_8le(const address_space *space, offs_t address); diff --git a/src/mame/drivers/atarig42.c b/src/mame/drivers/atarig42.c index 9f9b637a21a..5aa9ecba9e3 100644 --- a/src/mame/drivers/atarig42.c +++ b/src/mame/drivers/atarig42.c @@ -136,11 +136,11 @@ static WRITE16_HANDLER( mo_command_w ) * *************************************/ -static OPBASE_HANDLER( sloop_opbase_handler ) +static DIRECT_UPDATE_HANDLER( sloop_direct_handler ) { - if (address < 0x80000) + if (address < 0x80000) { - opbase->rom = opbase->ram = (void *)sloop_base; + direct->raw = direct->decrypted = (void *)sloop_base; return (offs_t)-1; } return address; @@ -687,7 +687,7 @@ static DRIVER_INIT( roadriot ) atarig42_motion_object_mask = 0x1ff; sloop_base = memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x07ffff, 0, 0, roadriot_sloop_data_r, roadriot_sloop_data_w); - memory_set_opbase_handler(0, sloop_opbase_handler); + memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), sloop_direct_handler); asic65_config(machine, ASIC65_ROMBASED); /* @@ -740,7 +740,7 @@ static DRIVER_INIT( guardian ) *(UINT16 *)&memory_region(machine, "main")[0x80000] = 0x4E75; sloop_base = memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x07ffff, 0, 0, guardians_sloop_data_r, guardians_sloop_data_w); - memory_set_opbase_handler(0, sloop_opbase_handler); + memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), sloop_direct_handler); asic65_config(machine, ASIC65_GUARDIANS); /* diff --git a/src/mame/drivers/atarisy2.c b/src/mame/drivers/atarisy2.c index efe41ed291a..808d8a643e0 100644 --- a/src/mame/drivers/atarisy2.c +++ b/src/mame/drivers/atarisy2.c @@ -231,12 +231,12 @@ static void scanline_update(const device_config *screen, int scanline) * *************************************/ -static OPBASE_HANDLER( atarisy2_opbase_handler ) +static DIRECT_UPDATE_HANDLER( atarisy2_direct_handler ) { /* make sure slapstic area looks like ROM */ if (address >= 0x8000 && address < 0x8200) { - opbase->rom = opbase->ram = (UINT8 *)atarisy2_slapstic - 0x8000; + direct->raw = direct->decrypted = (UINT8 *)atarisy2_slapstic - 0x8000; return ~0; } return address; @@ -263,7 +263,7 @@ static MACHINE_RESET( atarisy2 ) atarigen_interrupt_reset(update_interrupts); atarigen_sound_io_reset(1); atarigen_scanline_timer_reset(machine->primary_screen, scanline_update, 64); - memory_set_opbase_handler(0, atarisy2_opbase_handler); + memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), atarisy2_direct_handler); tms5220_data_strobe = 1; diff --git a/src/mame/drivers/cps3.c b/src/mame/drivers/cps3.c index 536575cebf2..0cbf3301e64 100644 --- a/src/mame/drivers/cps3.c +++ b/src/mame/drivers/cps3.c @@ -603,7 +603,7 @@ INLINE void cps3_drawgfxzoom(running_machine *machine, bitmap_t *dest_bmp,const -static OPBASE_HANDLER( cps3_opbase_handler ); +static DIRECT_UPDATE_HANDLER( cps3_direct_handler ); /* Encryption */ @@ -754,7 +754,7 @@ static DRIVER_INIT( cps3 ) cps3_0xc0000000_ram_decrypted = auto_malloc(0x400); - memory_set_opbase_handler(0, cps3_opbase_handler); + memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), cps3_direct_handler); // flash roms @@ -1340,38 +1340,38 @@ static WRITE32_HANDLER( cps3_0xc0000000_ram_w ) -static OPBASE_HANDLER( cps3_opbase_handler ) +static DIRECT_UPDATE_HANDLER( cps3_direct_handler ) { // if(DEBUG_PRINTF) printf("address %04x\n",address); /* BIOS ROM */ if (address < 0x80000) { - opbase->rom = opbase->ram = memory_region(space->machine, "user1"); + direct->raw = direct->decrypted = memory_region(space->machine, "user1"); return ~0; } /* RAM */ else if (address >= 0x06000000 && address <= 0x06ffffff) { - opbase->rom = (UINT8*)decrypted_gamerom-0x06000000; - opbase->ram = (UINT8*)decrypted_gamerom-0x06000000; + direct->decrypted = (UINT8*)decrypted_gamerom-0x06000000; + direct->raw = (UINT8*)decrypted_gamerom-0x06000000; - if (cps3_altEncryption) opbase->ram = (UINT8*) memory_region(space->machine, "user4")-0x06000000; + if (cps3_altEncryption) direct->raw = (UINT8*) memory_region(space->machine, "user4")-0x06000000; return ~0; } else if (address >= 0xc0000000 && address <= 0xc00003ff) { - //opbase->rom = (void*)cps3_0xc0000000_ram_decrypted; - opbase->rom = (UINT8*)cps3_0xc0000000_ram_decrypted-0xc0000000; - opbase->ram = (UINT8*)cps3_0xc0000000_ram-0xc0000000; + //direct->decrypted = (void*)cps3_0xc0000000_ram_decrypted; + direct->decrypted = (UINT8*)cps3_0xc0000000_ram_decrypted-0xc0000000; + direct->raw = (UINT8*)cps3_0xc0000000_ram-0xc0000000; return ~0; } /* anything else falls through to NOPs */ - opbase->rom = (UINT8*)cps3_nops-address; - opbase->ram = (UINT8*)cps3_nops-address; + direct->decrypted = (UINT8*)cps3_nops-address; + direct->raw = (UINT8*)cps3_nops-address; return ~0; } diff --git a/src/mame/drivers/hng64.c b/src/mame/drivers/hng64.c index 7c15e0002b0..f4310e8881d 100644 --- a/src/mame/drivers/hng64.c +++ b/src/mame/drivers/hng64.c @@ -1070,9 +1070,9 @@ index=00000004 pagesize=01000000 vaddr=00000000C9000000 paddr=000000006900000 #define KL5C_MMU_A(xxx) ( (xxx==0) ? 0x0000 : (hng64_com_mmu_mem[((xxx-1)*2)+1] << 2) | ((hng64_com_mmu_mem[(xxx-1)*2] & 0xc0) >> 6) ) #define KL5C_MMU_B(xxx) ( (xxx==0) ? 0x0000 : (hng64_com_mmu_mem[(xxx-1)*2] & 0x3f) ) -static OPBASE_HANDLER( KL5C80_opbase_handler ) +static DIRECT_UPDATE_HANDLER( KL5C80_direct_handler ) { - opbase->rom = opbase->ram = hng64_com_op_base; + direct->raw = direct->decrypted = hng64_com_op_base; return ~0; } @@ -1477,7 +1477,7 @@ static MACHINE_RESET(hyperneo) hng64_com_virtual_mem[i] = rom[i] ; KL5C80_virtual_mem_sync(); - memory_set_opbase_handler(2, KL5C80_opbase_handler); + memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[2], ADDRESS_SPACE_PROGRAM), KL5C80_direct_handler); cpu_set_input_line(machine->cpu[2], INPUT_LINE_RESET, PULSE_LINE); // reset the CPU and let 'er rip // cpu_set_input_line(machine->cpu[2], INPUT_LINE_HALT, ASSERT_LINE); // hold on there pardner... diff --git a/src/mame/drivers/leland.c b/src/mame/drivers/leland.c index 3e40fc2b557..4511984c834 100644 --- a/src/mame/drivers/leland.c +++ b/src/mame/drivers/leland.c @@ -1901,13 +1901,13 @@ static void dasm_chunk(char *tag, UINT8 *base, UINT16 pc, UINT32 length, FILE *o count = DasmZ80(buffer, pc); for (i = 0; i < 4; i++) if (i < count) - fprintf(output, "%c", (cpu_readop(pc + i) >= 32 && cpu_readop(pc + i) < 127) ? cpu_readop(pc + i) : ' '); + fprintf(output, "%c", (program_decrypted_read_byte(pc + i) >= 32 && program_decrypted_read_byte(pc + i) < 127) ? program_decrypted_read_byte(pc + i) : ' '); else fprintf(output, " "); fprintf(output, " %04X: ", pc); for (i = 0; i < 4; i++) if (i < count) - fprintf(output, "%02X ", cpu_readop(pc++)); + fprintf(output, "%02X ", program_decrypted_read_byte(pc++)); else fprintf(output, " "); fprintf(output, "%s\n", buffer); diff --git a/src/mame/drivers/missile.c b/src/mame/drivers/missile.c index 407f27e951c..5f15c981181 100644 --- a/src/mame/drivers/missile.c +++ b/src/mame/drivers/missile.c @@ -444,7 +444,7 @@ static TIMER_CALLBACK( adjust_cpu_speed ) } -static OPBASE_HANDLER( missile_opbase_handler ) +static DIRECT_UPDATE_HANDLER( missile_direct_handler ) { /* offset accounts for lack of A15 decoding */ int offset = address & 0x8000; @@ -453,14 +453,14 @@ static OPBASE_HANDLER( missile_opbase_handler ) /* RAM? */ if (address < 0x4000) { - opbase->rom = opbase->ram = videoram - offset; + direct->raw = direct->decrypted = videoram - offset; return ~0; } /* ROM? */ else if (address >= 0x5000) { - opbase->rom = opbase->ram = memory_region(space->machine, "main") - offset; + direct->raw = direct->decrypted = memory_region(space->machine, "main") - offset; return ~0; } @@ -476,7 +476,7 @@ static MACHINE_START( missile ) flipscreen = 0; /* set up an opcode base handler since we use mapped handlers for RAM */ - memory_set_opbase_handler(0, missile_opbase_handler); + memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), missile_direct_handler); /* create a timer to speed/slow the CPU */ cpu_timer = timer_alloc(adjust_cpu_speed, NULL); @@ -521,7 +521,7 @@ INLINE int get_madsel(running_machine *machine) /* MADSEL signal disables standard address decoding and routes writes to video RAM; it is enabled if the IRQ signal is clear and the low 5 bits of the fetched opcode are 0x01 */ - if (!irq_state && (cpu_readop(pc) & 0x1f) == 0x01) + if (!irq_state && (program_decrypted_read_byte(pc) & 0x1f) == 0x01) { /* the MADSEL signal goes high 5 cycles after the opcode is identified; this effectively skips the indirect memory read. Since this is difficult diff --git a/src/mame/drivers/plygonet.c b/src/mame/drivers/plygonet.c index 03122e4f1f7..5030465a3dc 100644 --- a/src/mame/drivers/plygonet.c +++ b/src/mame/drivers/plygonet.c @@ -285,16 +285,16 @@ static READ16_HANDLER( dsp56k_bootload_r ) return 0x7fff; } -static OPBASE_HANDLER( plygonet_dsp56k_opbase_handler ) +static DIRECT_UPDATE_HANDLER( plygonet_dsp56k_direct_handler ) { if (address >= 0x7000 && address <= 0x7fff) { - opbase->rom = opbase->ram = (void*)(dsp56k_p_mirror - 0x7000); + direct->raw = direct->decrypted = (void*)(dsp56k_p_mirror - 0x7000); return ~0; } else if (address >= 0x8000 && address <= 0x87ff) { - opbase->rom = opbase->ram = (void*)(dsp56k_p_8000 - 0x8000); + direct->raw = direct->decrypted = (void*)(dsp56k_p_8000 - 0x8000); return ~0; } @@ -682,7 +682,7 @@ static DRIVER_INIT(polygonet) memset(dsp56k_bank04_ram, 0, 2 * 8 * dsp56k_bank04_size * sizeof(UINT16)); /* The dsp56k occasionally executes out of mapped memory */ - memory_set_opbase_handler(1, plygonet_dsp56k_opbase_handler); + memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), plygonet_dsp56k_direct_handler); } ROM_START( plygonet ) diff --git a/src/mame/drivers/starwars.c b/src/mame/drivers/starwars.c index ad6e27dc72d..ec74cc65465 100644 --- a/src/mame/drivers/starwars.c +++ b/src/mame/drivers/starwars.c @@ -126,7 +126,7 @@ static WRITE8_HANDLER( esb_slapstic_w ) * *************************************/ -static OPBASE_HANDLER( esb_setopbase ) +static DIRECT_UPDATE_HANDLER( esb_setdirect ) { /* if we are in the slapstic region, process it */ if ((address & 0xe000) == 0x8000) @@ -521,7 +521,7 @@ static DRIVER_INIT( esb ) slapstic_base = &rom[0x08000]; /* install an opcode base handler */ - memory_set_opbase_handler(0, esb_setopbase); + memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), esb_setdirect); /* install read/write handlers for it */ memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x9fff, 0, 0, esb_slapstic_r, esb_slapstic_w); diff --git a/src/mame/machine/amiga.c b/src/mame/machine/amiga.c index 2e86e3ed550..2cd4844fbc6 100644 --- a/src/mame/machine/amiga.c +++ b/src/mame/machine/amiga.c @@ -326,7 +326,7 @@ static void amiga_m68k_reset(const device_config *device) } if (cpu_get_pc(space->cpu) < 0x80000) - memory_set_opbase(0); + memory_set_direct_region(space, 0); } diff --git a/src/mame/machine/atarigen.c b/src/mame/machine/atarigen.c index 0ac6151d5f0..4b384414021 100644 --- a/src/mame/machine/atarigen.c +++ b/src/mame/machine/atarigen.c @@ -507,7 +507,7 @@ static STATE_POSTLOAD( slapstic_postload ) } -static OPBASE_HANDLER( atarigen_slapstic_setopbase ) +static DIRECT_UPDATE_HANDLER( atarigen_slapstic_setdirect ) { /* if we jump to an address in the slapstic region, tweak the slapstic at that address and return ~0; this will cause us to be called on @@ -560,7 +560,7 @@ void atarigen_slapstic_init(running_machine *machine, int cpunum, offs_t base, o /* install an opcode base handler if we are a 68000 or variant */ atarigen_slapstic_base = base; atarigen_slapstic_mirror = mirror; - memory_set_opbase_handler(cpunum, atarigen_slapstic_setopbase); + memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), atarigen_slapstic_setdirect); } } diff --git a/src/mame/machine/slapstic.c b/src/mame/machine/slapstic.c index c6d8a3214b7..3cdb70f73c5 100644 --- a/src/mame/machine/slapstic.c +++ b/src/mame/machine/slapstic.c @@ -877,7 +877,7 @@ static int alt2_kludge(running_machine *machine, offs_t offset) if (MATCHES_MASK_VALUE(cpu_get_pc(machine->activecpu) >> 1, slapstic.alt1)) { /* now look for a move.w (An),(An) or cmpm.w (An)+,(An)+ */ - UINT16 opcode = cpu_readop16(cpu_get_previouspc(machine->activecpu) & 0xffffff); + UINT16 opcode = program_decrypted_read_word(cpu_get_previouspc(machine->activecpu) & 0xffffff); if ((opcode & 0xf1f8) == 0x3090 || (opcode & 0xf1f8) == 0xb148) { /* fetch the value of the register for the second operand, and see */ diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c index 674bcaeec64..3e9ddf57c97 100644 --- a/src/mame/machine/snes.c +++ b/src/mame/machine/snes.c @@ -1625,15 +1625,15 @@ void snes_hdma_init() /* should we treat this as nvram in MAME? */ -static OPBASE_HANDLER(spc_opbase) +static DIRECT_UPDATE_HANDLER(spc_direct) { - opbase->rom = opbase->ram = spc_ram; + direct->raw = direct->decrypted = spc_ram; return ~0; } -static OPBASE_HANDLER(snes_opbase) +static DIRECT_UPDATE_HANDLER(snes_direct) { - opbase->rom = opbase->ram = snes_ram; + direct->raw = direct->decrypted = snes_ram; return ~0; } @@ -1642,8 +1642,8 @@ MACHINE_START( snes ) snes_vram = auto_malloc(SNES_VRAM_SIZE); snes_cgram = auto_malloc(SNES_CGRAM_SIZE); snes_oam = auto_malloc(SNES_OAM_SIZE); - memory_set_opbase_handler(0, snes_opbase); - memory_set_opbase_handler(1, spc_opbase); + memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), snes_direct); + memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), spc_direct); // power-on sets these registers like this snes_ram[WRIO] = 0xff;