src/emu/cpu/m68000/m68000.h
| r1335 | r1336 | |
| 26 | 26 | |
| 27 | 27 | struct m68k_memory_interface |
| 28 | 28 | { |
| 29 | | offs_t opcode_xor; // Address Calculation |
| 30 | | UINT8 (*read8)(offs_t); // Normal read 8 bit |
| 29 | offs_t opcode_xor; // Address Calculation |
| 30 | UINT16 (*readimm16)(offs_t); // Immediate read 16 bit |
| 31 | UINT8 (*read8)(offs_t); // Normal read 8 bit |
| 31 | 32 | UINT16 (*read16)(offs_t); // Normal read 16 bit |
| 32 | 33 | UINT32 (*read32)(offs_t); // Normal read 32 bit |
| 33 | | void (*write8)(offs_t, UINT8); // Write 8 bit |
| 34 | | void (*write16)(offs_t, UINT16); // Write 16 bit |
| 35 | | void (*write32)(offs_t, UINT32); // Write 32 bit |
| 36 | | void (*changepc)(offs_t); // Change PC |
| 34 | void (*write8)(offs_t, UINT8); // Write 8 bit |
| 35 | void (*write16)(offs_t, UINT16); // Write 16 bit |
| 36 | void (*write32)(offs_t, UINT32); // Write 32 bit |
| 37 | void (*changepc)(offs_t); // Change PC |
| 37 | 38 | |
| 38 | 39 | // For Encrypted Stuff |
| 39 | 40 | |
| 40 | | UINT8 (*read8pc)(offs_t); // PC Relative read 8 bit |
| 41 | UINT8 (*read8pc)(offs_t); // PC Relative read 8 bit |
| 41 | 42 | UINT16 (*read16pc)(offs_t); // PC Relative read 16 bit |
| 42 | 43 | UINT32 (*read32pc)(offs_t); // PC Relative read 32 bit |
| 43 | 44 | |
| r1335 | r1336 | |
| 47 | 48 | |
| 48 | 49 | struct m68k_encryption_interface |
| 49 | 50 | { |
| 50 | | UINT8 (*read8pc)(offs_t); // PC Relative read 8 bit |
| 51 | UINT8 (*read8pc)(offs_t); // PC Relative read 8 bit |
| 51 | 52 | UINT16 (*read16pc)(offs_t); // PC Relative read 16 bit |
| 52 | 53 | UINT32 (*read32pc)(offs_t); // PC Relative read 32 bit |
| 53 | 54 | |
src/emu/cpu/m68000/m68kmame.c
| r1335 | r1336 | |
| 20 | 20 | * 8-bit data memory interface |
| 21 | 21 | ****************************************************************************/ |
| 22 | 22 | |
| 23 | static UINT16 m68008_read_immediate_16(offs_t address) |
| 24 | { |
| 25 | offs_t addr = (address) ^ m68k_memory_intf.opcode_xor; |
| 26 | return (cpu_readop(addr) << 8) | (cpu_readop(addr + 1)); |
| 27 | } |
| 28 | |
| 23 | 29 | static UINT16 readword_d8(offs_t address) |
| 24 | 30 | { |
| 25 | 31 | UINT16 result = program_read_byte_8(address) << 8; |
| r1335 | r1336 | |
| 52 | 58 | static const struct m68k_memory_interface interface_d8 = |
| 53 | 59 | { |
| 54 | 60 | 0, |
| 61 | m68008_read_immediate_16, |
| 55 | 62 | program_read_byte_8, |
| 56 | 63 | readword_d8, |
| 57 | 64 | readlong_d8, |
| r1335 | r1336 | |
| 64 | 71 | * 16-bit data memory interface |
| 65 | 72 | ****************************************************************************/ |
| 66 | 73 | |
| 74 | static UINT16 read_immediate_16(offs_t address) |
| 75 | { |
| 76 | return cpu_readop16((address) ^ m68k_memory_intf.opcode_xor); |
| 77 | } |
| 78 | |
| 67 | 79 | static UINT32 readlong_d16(offs_t address) |
| 68 | 80 | { |
| 69 | 81 | UINT32 result = program_read_word_16be(address) << 16; |
| r1335 | r1336 | |
| 80 | 92 | static const struct m68k_memory_interface interface_d16 = |
| 81 | 93 | { |
| 82 | 94 | 0, |
| 95 | read_immediate_16, |
| 83 | 96 | program_read_byte_16be, |
| 84 | 97 | program_read_word_16be, |
| 85 | 98 | readlong_d16, |
| r1335 | r1336 | |
| 155 | 168 | static const struct m68k_memory_interface interface_d32 = |
| 156 | 169 | { |
| 157 | 170 | WORD_XOR_BE(0), |
| 171 | read_immediate_16, |
| 158 | 172 | program_read_byte_32be, |
| 159 | 173 | readword_d32, |
| 160 | 174 | readlong_d32, |
src/emu/cpu/m68000/m68kmame.h
| r1335 | r1336 | |
| 65 | 65 | #define m68k_read_memory_16(address) (*m68k_memory_intf.read16)(address) |
| 66 | 66 | #define m68k_read_memory_32(address) (*m68k_memory_intf.read32)(address) |
| 67 | 67 | |
| 68 | | #define m68k_read_immediate_16(address) m68kx_read_immediate_16(address) |
| 68 | #define m68k_read_immediate_16(address) (*m68k_memory_intf.readimm16)(address) |
| 69 | 69 | #define m68k_read_immediate_32(address) m68kx_read_immediate_32(address) |
| 70 | 70 | #define m68k_read_pcrelative_8(address) m68kx_read_pcrelative_8(address) |
| 71 | 71 | #define m68k_read_pcrelative_16(address) m68kx_read_pcrelative_16(address) |
| r1335 | r1336 | |
| 80 | 80 | #define m68k_write_memory_32_pd(address, value) m68kx_write_memory_32_pd(address, value) |
| 81 | 81 | |
| 82 | 82 | |
| 83 | | INLINE unsigned int m68k_read_immediate_16(unsigned int address); |
| 84 | 83 | INLINE unsigned int m68k_read_immediate_32(unsigned int address); |
| 85 | 84 | INLINE unsigned int m68k_read_pcrelative_8(unsigned int address); |
| 86 | 85 | INLINE unsigned int m68k_read_pcrelative_16(unsigned int address); |
| r1335 | r1336 | |
| 88 | 87 | INLINE void m68k_write_memory_32_pd(unsigned int address, unsigned int value); |
| 89 | 88 | |
| 90 | 89 | |
| 91 | | INLINE unsigned int m68kx_read_immediate_16(unsigned int address) |
| 92 | | { |
| 93 | | return cpu_readop16((address) ^ m68k_memory_intf.opcode_xor); |
| 94 | | } |
| 95 | | |
| 96 | 90 | INLINE unsigned int m68kx_read_immediate_32(unsigned int address) |
| 97 | 91 | { |
| 98 | 92 | return ((m68k_read_immediate_16(address) << 16) | m68k_read_immediate_16((address)+2)); |