fix memory breakpoint range checking.

It's still broken for page/bank wrapped data.  Eg, sta <$ff stores @ $ff and $00
This commit is contained in:
Kelvin Sherlock 2019-03-21 22:12:30 -04:00
parent 5da4e5c39f
commit bf09880caf

View File

@ -443,14 +443,14 @@ int check_mp_breakpoints(word32 addr, word32 value, unsigned bytes, int in_page,
/* assumptions:
* bytes is 1-3, so no possibility of crossing multiple pags
* bytes is 1-3, so no possibility of crossing multiple pages
* g_mp_breakpoints is in ascending order.
*/
word32 a1 = addr;
word32 a2 = addr + bytes - 1;
if (in_page) a1 = (a1 & 0x00ff) | (addr & 0xffff00);
if (in_bank) a1 = (a1 & 0xffff) | (addr & 0xff0000);
if (in_page) a2 = (a2 & 0x00ff) | (addr & 0xffff00);
if (in_bank) a2 = (a2 & 0xffff) | (addr & 0xff0000);
stat1 = GET_PAGE_INFO_WR(((a1) >> 8) & 0xffff);
stat2 = GET_PAGE_INFO_WR(((a2) >> 8) & 0xffff);
@ -459,7 +459,7 @@ int check_mp_breakpoints(word32 addr, word32 value, unsigned bytes, int in_page,
if (wstat & BANK_BREAK) {
for (i = 0; i < g_num_mp_breakpoints; ++i) {
word32 bp = g_mp_breakpoints[i];
if (a1 >= bp && a2 <= bp) {
if (bp >= a1 && bp <= a2) {
g_abort_address = addr;
g_abort_bytes = bytes;
mask = (1 << (bytes << 3))-1;