Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Using (16-bit) labels in WinAVR inline asm

2007-07-20 by organix80

Is it possible to use 16-bit constant labels in WinAVR inline assembly?

Normally, in a assembly program, you can do:

lds r16, 0x0412 (just a example)

In mixed C/asm, some variables are stored in SRAM by the compiler. How
to read them using 'lds' and 'sts' in inline assembly?

asm volatile(" ... "
: (inputs)
: (outputs)
);

It seems that there is no 16-bit integer constant in the list. (see
table on ttp://www.scienceprog.com/how-to-use-inline-asm-using-winavr)

The constrains that could be used for addressing, are using the X, Y
or Z pointer, but this requires a lot more instructions then just
'lds' or 'sts'.

Does anyone know the method and constrains that must be used to read C
 SRAM variables using 'lds' and 'sts' in inline assembly?

Regards Laurens

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.