I'm trying to learn a bit of assembler out of curiosity. I just spent a fair amount of time wondering why I couldn't light some LEDs using this code:
ldi mp,0xFF out DDRB,mp out PORTB,mp
Finally ran across some posts that talk about special function registers and point to this instructions page: http://www.nongnu.org/avr-libc/u...
So I fixed my code up and it now works:
ldi mp,0xFF out _SFR_IO_ADDR(DDRB),mp out _SFR_IO_ADDR(PORTB),mp
But I'm having trouble understanding why the include file is offsetting those addresses by 0x20 in the first place. Can someone give me an example of where this offset is necessary and useful?
(if it matters, I'm using an ATtiny13 and obviously AVR-GCC as the compiler)