Skip to content

Commit

Permalink
raise bus error on 68000/10 on odd addresses for w/l
Browse files Browse the repository at this point in the history
  • Loading branch information
bebbo committed Jan 13, 2022
1 parent c37870a commit 1eada7a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions musashi/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ unsigned int m68k_read_memory_8(unsigned int address)

unsigned int m68k_read_memory_16(unsigned int address)
{
if (CPU_TYPE <= M68K_CPU_TYPE_68010 && (address & 1))
m68k_pulse_bus_error();
uint page = address >> 16;
if (page < NUM_PAGES) {
uint val = r_func[page][1](address, r_ctx[page][1]);
Expand All @@ -158,6 +160,8 @@ unsigned int m68k_read_memory_16(unsigned int address)

unsigned int m68k_read_memory_32(unsigned int address)
{
if (CPU_TYPE <= M68K_CPU_TYPE_68010 && (address & 1))
m68k_pulse_bus_error();
uint page = address >> 16;
if (page < NUM_PAGES) {
uint val = r_func[page][2](address, r_ctx[page][2]);
Expand Down Expand Up @@ -186,6 +190,8 @@ void m68k_write_memory_8(unsigned int address, unsigned int value)

void m68k_write_memory_16(unsigned int address, unsigned int value)
{
if (CPU_TYPE <= M68K_CPU_TYPE_68010 && (address & 1))
m68k_pulse_bus_error();
uint page = address >> 16;
if (page < NUM_PAGES) {
w_func[page][1](address, value, w_ctx[page][1]);
Expand All @@ -199,6 +205,8 @@ void m68k_write_memory_16(unsigned int address, unsigned int value)

void m68k_write_memory_32(unsigned int address, unsigned int value)
{
if (CPU_TYPE <= M68K_CPU_TYPE_68010 && (address & 1))
m68k_pulse_bus_error();
uint page = address >> 16;
if (page < NUM_PAGES) {
w_func[page][2](address, value, w_ctx[page][2]);
Expand Down

0 comments on commit 1eada7a

Please sign in to comment.