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:
Eric Scharff 2015-01-22 21:58:56 -05:00
parent f0f3176c78
commit af713b78e1

View file

@ -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;