I have a macro defined:

#define WRITE_4BYTES(x, y) { CS_LOW \
            *(BASE + ((y) ))) = (INT8U) (x); \
            *(BASE + ((y + 1)))) = (INT8U) (x >> 8);\
            CS_HIGH }

(where BASE is defined as an 8 bit pointer with a value 0x8000 in ext
ram and the macros CS_LOW and CS_HIGH are predefined to set a pin lo /
high).

When assembled by avr-gcc (GCC) 3.4.5, avr-libc-1.4.2, binutils-2.16.1, I
get the following (for the atmega128):

    42f2:       31 83           std     Z+1, r19        ; 0x01
    42f4:       20 83           st      Z, r18

which means that in reality the write occurs this way:

 *(BASE + ((y + 1)))) = (INT8U) (x >> 8);\
 *(BASE + ((y) ))) = (INT8U) (x); \

Is there any way I can "force" the write order to be in the order I
specified (in C), or must I resort to assembly?  Thanks.

Keith



_______________________________________________
AVR-chat mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-chat

Reply via email to