I've been pulling my hair out about an auto increment problem.  I
finally realized the following statement wasn't acting as I expected it
to:

Unsigned char ReadByte( unsigned int *address )
{
unsigned char data;

    // Setup read from memory chip (SPI)

    E2DISABLE;      // End Read operation
    // Auto increment address the proper number of bytes
    *address++;
    return data;
}

I expected the contents of memory that address pointed to be incremented
one.  But when I check the .lst file, I get this:
...
    E2DISABLE;      // End Read operation
    1b88:       d2 d3 19 00             bis.b   #1,     &0x0019
    *address++;
    return data;
    1b8c:       4f 4e                   mov.b   r14,    r15     ;
...

Nothing came out at all!!! And no warnings.  When I changed the line to
read:
    // Auto increment address the proper number of bytes
    *address += 1;      
I got the desired result:
    *address += 1;
    1b8e:       9e 53 00 00             inc     0(r14)          ;
Is this a bug?
-Mark Stokes


Reply via email to