Using Assembler and C constants in ZBasic
Posted: 10 February 2008, 18:43 PM
This code works just fine
What I really want to do is use symbolic constants from GCC in the assembler code. The standard GCC code is something like:
That of course won't work in ZBasic. Can you confirm that this is the correct way of doing it:It took a few attempts with generating the intermediate files to figure this all out.
Code: Select all
#asm
ldi r18, 0x07
out 0x05, r18
#endasm
Code: Select all
asm volatile("out %0, 0x07" : "I" ((unsigned short)(PORTB)):);
Code: Select all
#asm
ldi r18, 0x07
out %0, r18
:
: "I" (_SFR_IO_ADDR(PORTB))
: "r18"
#endasm