src/musashi/example/sim.h

Fri, 18 Jan 2013 17:18:50 +0000

author
Philip Pemberton <philpem@philpem.me.uk>
date
Fri, 18 Jan 2013 17:18:50 +0000
changeset 129
8b24770dea79
parent 0
8bf1bf91a36d
permissions
-rw-r--r--

[memory] Emulate main memory read wrap-around

3B1s with 512K or 1MB of base memory have a decoding quirk which causes reads
to 'wrap around'. That is to say, on a 512K machine, reading from addresses 0,
512K, 1024K or 1536K will address the same RAM byte. On a 1MB machine,
addresses 0 and 1024K address the same RAM byte.

Emulating this incorrectly causes P4TEST to report an incorrect amount of
available base RAM.

philpem@0 1 #ifndef SIM__HEADER
philpem@0 2 #define SIM__HEADER
philpem@0 3
philpem@0 4 unsigned int m68k_read_memory_8(unsigned int address);
philpem@0 5 unsigned int m68k_read_memory_16(unsigned int address);
philpem@0 6 unsigned int m68k_read_memory_32(unsigned int address);
philpem@0 7 void m68k_write_memory_8(unsigned int address, unsigned int value);
philpem@0 8 void m68k_write_memory_16(unsigned int address, unsigned int value);
philpem@0 9 void m68k_write_memory_32(unsigned int address, unsigned int value);
philpem@0 10 void cpu_pulse_reset(void);
philpem@0 11 void cpu_set_fc(unsigned int fc);
philpem@0 12 int cpu_irq_ack(int level);
philpem@0 13
philpem@0 14 #endif /* SIM__HEADER */