From: Jonathan Creekmore Date: Thu, 6 Mar 2014 15:21:52 +0000 (-0600) Subject: 16-bits is not large enough if using RAMPZ X-Git-Tag: v1.2~9^2~2 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=3fa972fc676cdeb2b6bb82f51d5ca29d1cc061e0;p=sx%2Fsimavr.git 16-bits is not large enough if using RAMPZ The RAMPZ register allows the effective address to be up to 24-bit, so a 16-bit variable is not large enough to hold it. --- diff --git a/simavr/sim/avr_flash.c b/simavr/sim/avr_flash.c index 5b8a615..b754f1f 100644 --- a/simavr/sim/avr_flash.c +++ b/simavr/sim/avr_flash.c @@ -53,7 +53,7 @@ static int avr_flash_ioctl(struct avr_io_t * port, uint32_t ctl, void * io_param avr_flash_t * p = (avr_flash_t *)port; avr_t * avr = p->io.avr; - uint16_t z = avr->data[R_ZL] | (avr->data[R_ZH] << 8); + avr_flashaddr_t z = avr->data[R_ZL] | (avr->data[R_ZH] << 8); if (avr->rampz) z |= avr->data[avr->rampz] << 16; uint16_t r01 = avr->data[0] | (avr->data[1] << 8);