avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Large chunks of Assembly


From: Alexey Boyko
Subject: Re: [avr-gcc-list] Large chunks of Assembly
Date: Fri, 31 May 2002 12:21:04 +0300

Hello Michael,

MB>    Is there a way of writing larger blocks of assembly?  With the
MB> Codevision compiler I just used #asm and #endasm, and just stuck my 
MB> block of assembly in the middle.  Is there a similar way with avr-gcc?

There is example of larger block of assembly:

  asm volatile
  (
   "push R2" "\n\t"  "push R3" "\n\t"
   "push R4" "\n\t"  "push R5" "\n\t"
   "push R6" "\n\t"  "push R7" "\n\t"
   "push R8" "\n\t"  "push R9" "\n\t"
   "push R10" "\n\t" "push R11" "\n\t"
   "push R12" "\n\t" "push R13" "\n\t"
   "push R14" "\n\t" "push R15" "\n\t"
   "push R16" "\n\t" "push R17" "\n\t"
   "push R28" "\n\t" "push R29" "\n\t"
   "in __tmp_reg__, %2"     "\n\t"
   "st Z+,__tmp_reg__"      "\n\t"
   "in __tmp_reg__, %3"     "\n\t"
   "st Z+,__tmp_reg__"      "\n\t"
   "out %2, %A1"    "\n\t"
   "out %3, %B1"    "\n\t"
   "pop R29" "\n\t"  "pop R28" "\n\t"
   "pop R17" "\n\t"  "pop R16" "\n\t"
   "pop R15" "\n\t"  "pop R14" "\n\t"
   "pop R13" "\n\t"  "pop R12" "\n\t"
   "pop R11" "\n\t"  "pop R10" "\n\t"
   "pop R9" "\n\t"   "pop R8" "\n\t"
   "pop R7" "\n\t"   "pop R6" "\n\t"
   "pop R5" "\n\t"   "pop R4" "\n\t"
   "pop R3" "\n\t"   "pop R2" "\n\t"
   :
   : "z" (WhereStore), "r" (NewValue), "I" (SPL), "I" (SPH)
  );


  Look into gcc info pages for more information about inserting
  assembler code into C programs.

Best regards,
 Alexey                            mailto:address@hidden

avr-gcc-list at http://avr1.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]