SWTP: Fixes to segfault issue described in #103 (from Gene Irwin)

The simulated memory address block from 0x8000 thru 0x8FFF is defined to have address 0x8000 - 0x801F mapped to I/O ports and 0x8020 - 0x8FFF as NO RAM ALLOWED.  Code has been added to behave reasonably when references are made to 0x8020 - 0x8FFF.
This commit is contained in:
Mark Pizzolato 2014-02-01 08:12:19 -08:00
parent eaae19463c
commit d0cee0f6b6

View file

@ -214,7 +214,10 @@ int32 MB_get_mbyte(int32 addr)
} else } else
return 0xFF; return 0xFF;
case 0x8000: case 0x8000:
if (addr < 0x8020)
val = (dev_table[addr - 0x8000].routine(0, 0)) & 0xFF; val = (dev_table[addr - 0x8000].routine(0, 0)) & 0xFF;
else
val = 0xFF;
if (MB_dev.dctrl & DEBUG_read) if (MB_dev.dctrl & DEBUG_read)
printf("MB_get_mbyte: I/O addr=%04X val=%02X\n", addr, val); printf("MB_get_mbyte: I/O addr=%04X val=%02X\n", addr, val);
return val; return val;
@ -290,6 +293,7 @@ void MB_put_mbyte(int32 addr, int32 val)
return; return;
} }
case 0x8000: case 0x8000:
if (addr < 0x8020)
dev_table[addr - 0x8000].routine(1, val); dev_table[addr - 0x8000].routine(1, val);
return; return;
case 0xA000: case 0xA000:
@ -320,3 +324,4 @@ void MB_put_mword(int32 addr, int32 val)
} }
/* end of mp-b2.c */ /* end of mp-b2.c */