Previous 15994 Revisions Next

r1336 Monday 26th November, 2007 at 07:59:10 UTC by Curt Coder
[M68008] Fixed cpu_readop endianness.
[src/emu/cpu/m68000]m68000.h m68kmame.c m68kmame.h

src/emu/cpu/m68000/m68000.h
r1335r1336
2626
2727struct m68k_memory_interface
2828{
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
3132   UINT16   (*read16)(offs_t);            // Normal read 16 bit
3233   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
3738
3839    // For Encrypted Stuff
3940
40   UINT8      (*read8pc)(offs_t);            // PC Relative read 8 bit
41   UINT8   (*read8pc)(offs_t);            // PC Relative read 8 bit
4142   UINT16   (*read16pc)(offs_t);         // PC Relative read 16 bit
4243   UINT32   (*read32pc)(offs_t);         // PC Relative read 32 bit
4344
r1335r1336
4748
4849struct m68k_encryption_interface
4950{
50   UINT8      (*read8pc)(offs_t);            // PC Relative read 8 bit
51   UINT8   (*read8pc)(offs_t);            // PC Relative read 8 bit
5152   UINT16   (*read16pc)(offs_t);         // PC Relative read 16 bit
5253   UINT32   (*read32pc)(offs_t);         // PC Relative read 32 bit
5354
src/emu/cpu/m68000/m68kmame.c
r1335r1336
2020 * 8-bit data memory interface
2121 ****************************************************************************/
2222
23static 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
2329static UINT16 readword_d8(offs_t address)
2430{
2531   UINT16 result = program_read_byte_8(address) << 8;
r1335r1336
5258static const struct m68k_memory_interface interface_d8 =
5359{
5460   0,
61   m68008_read_immediate_16,
5562   program_read_byte_8,
5663   readword_d8,
5764   readlong_d8,
r1335r1336
6471 * 16-bit data memory interface
6572 ****************************************************************************/
6673
74static UINT16 read_immediate_16(offs_t address)
75{
76   return cpu_readop16((address) ^ m68k_memory_intf.opcode_xor);
77}
78
6779static UINT32 readlong_d16(offs_t address)
6880{
6981   UINT32 result = program_read_word_16be(address) << 16;
r1335r1336
8092static const struct m68k_memory_interface interface_d16 =
8193{
8294   0,
95   read_immediate_16,
8396   program_read_byte_16be,
8497   program_read_word_16be,
8598   readlong_d16,
r1335r1336
155168static const struct m68k_memory_interface interface_d32 =
156169{
157170   WORD_XOR_BE(0),
171   read_immediate_16,
158172   program_read_byte_32be,
159173   readword_d32,
160174   readlong_d32,
src/emu/cpu/m68000/m68kmame.h
r1335r1336
6565#define m68k_read_memory_16(address)         (*m68k_memory_intf.read16)(address)
6666#define m68k_read_memory_32(address)         (*m68k_memory_intf.read32)(address)
6767
68#define m68k_read_immediate_16(address)      m68kx_read_immediate_16(address)
68#define m68k_read_immediate_16(address)      (*m68k_memory_intf.readimm16)(address)
6969#define m68k_read_immediate_32(address)      m68kx_read_immediate_32(address)
7070#define m68k_read_pcrelative_8(address)      m68kx_read_pcrelative_8(address)
7171#define m68k_read_pcrelative_16(address)     m68kx_read_pcrelative_16(address)
r1335r1336
8080#define m68k_write_memory_32_pd(address, value) m68kx_write_memory_32_pd(address, value)
8181
8282
83INLINE unsigned int m68k_read_immediate_16(unsigned int address);
8483INLINE unsigned int m68k_read_immediate_32(unsigned int address);
8584INLINE unsigned int m68k_read_pcrelative_8(unsigned int address);
8685INLINE unsigned int m68k_read_pcrelative_16(unsigned int address);
r1335r1336
8887INLINE void m68k_write_memory_32_pd(unsigned int address, unsigned int value);
8988
9089
91INLINE unsigned int m68kx_read_immediate_16(unsigned int address)
92{
93   return cpu_readop16((address) ^ m68k_memory_intf.opcode_xor);
94}
95
9690INLINE unsigned int m68kx_read_immediate_32(unsigned int address)
9791{
9892   return ((m68k_read_immediate_16(address) << 16) | m68k_read_immediate_16((address)+2));

Previous 15994 Revisions Next


© 1998-2018 The MESS Team