From: Michel Pollet Date: Wed, 14 Sep 2011 08:08:47 +0000 (+0100) Subject: core: Fixed opcode printing on access violation X-Git-Tag: v1.0a9~6 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=3f2d9eea99f5c98395369e4bd346be6fd0205051;p=sx%2Fsimavr.git core: Fixed opcode printing on access violation No functional change Signed-off-by: Markus Lampert Signed-off-by: Michel Pollet --- diff --git a/simavr/sim/sim_core.c b/simavr/sim/sim_core.c index 9dcf4bd..e056974 100644 --- a/simavr/sim/sim_core.c +++ b/simavr/sim/sim_core.c @@ -101,12 +101,12 @@ void avr_core_watch_write(avr_t *avr, uint16_t addr, uint8_t v) { if (addr > avr->ramend) { printf("*** Invalid write address PC=%04x SP=%04x O=%04x Address %04x=%02x out of ram\n", - avr->pc, _avr_sp_get(avr), avr->flash[avr->pc] | (avr->flash[avr->pc]<<8), addr, v); + avr->pc, _avr_sp_get(avr), avr->flash[avr->pc + 1] | (avr->flash[avr->pc]<<8), addr, v); CRASH(); } if (addr < 32) { printf("*** Invalid write address PC=%04x SP=%04x O=%04x Address %04x=%02x low registers\n", - avr->pc, _avr_sp_get(avr), avr->flash[avr->pc] | (avr->flash[avr->pc]<<8), addr, v); + avr->pc, _avr_sp_get(avr), avr->flash[avr->pc + 1] | (avr->flash[avr->pc]<<8), addr, v); CRASH(); } #if AVR_STACK_WATCH @@ -126,7 +126,7 @@ uint8_t avr_core_watch_read(avr_t *avr, uint16_t addr) { if (addr > avr->ramend) { printf( FONT_RED "*** Invalid read address PC=%04x SP=%04x O=%04x Address %04x out of ram (%04x)\n" FONT_DEFAULT, - avr->pc, _avr_sp_get(avr), avr->flash[avr->pc] | (avr->flash[avr->pc]<<8), addr, avr->ramend); + avr->pc, _avr_sp_get(avr), avr->flash[avr->pc + 1] | (avr->flash[avr->pc]<<8), addr, avr->ramend); CRASH(); } return avr->data[addr];