[elektro] Atmel - call far...

VFX info at vfx.hu
Sat Nov 22 11:11:53 CET 2008


Hali!

> Ki menniyre vesézte ki az atmegát ?

Nagyon :)


> Akarok írni egy call far rutint, eddig jutottam:
> 
>   lpm  YL, Z+    ; reading function pointer from table
>   lpm  YH, Z+
>                  ; --- FAR CALL sequence ---------------
>   rjmp CallFar1  ;     1: initializing
> Next1:
>   push YL        ;     3: store to stack to jump address
>   push YH
>   ret            ;     4: goto address (return address: nop instr.)
> CallFar1:
>   call Next1     ;     2: store to stack the next instr.
>   nop            ; --- 5: returned, continue... ------
> 
> Vélemény ? 2 vagy 3 bytos at atmega64 és 168 ?


2 byte-os, de miért nem használog a IJMP vagy ICALL utasításokat. Akkor
nem kell a veremmel bajlódni.

   (e)lpm  R0, Z+    ; reading function pointer from table
   (e)lpm  R1, Z+
   movw ZL,R0
   icall	     ;subrutin hívás, amúgy a M64-ben és szerintem a M168-ban
sincs távoli szubrutin hívás. Amiben lehet az a 128kb-nál nagyobb
FLASH-es AVRek.

ÜDV. VFX.
http://www.vfx.hu



More information about the Elektro mailing list