Commit 3fa972fc676cdeb2b6bb82f51d5ca29d1cc061e0
authorJonathan Creekmore <jonathan@thecreekmores.org>
Thu, 6 Mar 2014 15:21:52 +0000 (09:21 -0600)
committerDoug Goldstein <cardoe@cardoe.com>
Sat, 15 Mar 2014 18:39:58 +0000 (13:39 -0500)
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.

simavr/sim/avr_flash.c

index 5b8a615c3ebf2cde88aeceeded4fac91c870873b..b754f1f51ea18ece4220b7a6a459230198dfd7ae 100644 (file)
@@ -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);