diff --git a/src/engine_c.c b/src/engine_c.c index 9fecd65..4c54fe7 100644 --- a/src/engine_c.c +++ b/src/engine_c.c @@ -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;