Topics / Index / Deutsch

Assembler programming with WinGCC

Content (automatic)

Inline Assembler

Inline assembler statements are writen in a asm(""); pseudo function call.
Example:
asm("ldi r24,0x55 ; by hjh");
The follow registers must not be used, as they are used in special way by the compiled code:
Reg reserved for
r28 r29
frame pointer
r24=L r25=H
first argument, char or  word or Pointer
r22=L r25=H
second argument, char or word or Pointer
r20 r21
third argument
r18 r19
fourth argument
r16 r17
fifth argument
r22=LL r23 r24 r25=HH
first double argument / first double operator
r18 r19 r20 r21
second double argument / second double operator
r14 r15 r16 r17
third double argument

External assembler routines

see also i C:\WinAVR\doc\avr-libc\avr-libc-user-manual-1.4.3.pdf #198 page 191
The follow registers may be used without push / pop
r0 r18 r19 r26 r27 r30 r31
The special register contains 0
r1
The follow registers must be pushed / popped
r28 r29