mirror of
https://github.com/open-simh/simh.git
synced 2026-04-25 20:01:33 +00:00
Fix off-by-one in reading cache address from memory
Commit a9ac7c153 properly avoided writing past the end of cache_line,
but in doing so introduced an error as to the first memory address that
should be written. This fix avoids writing past the cache_line by simply
reading the previous memory location.
Fixes the CP/M 68K simulation example and issue #181
This commit is contained in:
@@ -269,7 +269,7 @@ static t_stat ReadICache(t_addr tpc)
|
|||||||
t_stat rc;
|
t_stat rc;
|
||||||
uint8* mem;
|
uint8* mem;
|
||||||
|
|
||||||
ASSERT_OKRET(Mem((tpc+CACHE_SIZE)&addrmask,&mem));
|
ASSERT_OKRET(Mem((tpc+CACHE_SIZE-1)&addrmask,&mem));
|
||||||
|
|
||||||
/* 68000/08/10 do not like unaligned access */
|
/* 68000/08/10 do not like unaligned access */
|
||||||
if (cputype < 3 && (tpc & 1)) return STOP_ERRADR;
|
if (cputype < 3 && (tpc & 1)) return STOP_ERRADR;
|
||||||
|
|||||||
Reference in New Issue
Block a user