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

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

[avr-gcc-list] Using IJMP


From: Ben Mann
Subject: [avr-gcc-list] Using IJMP
Date: Wed, 12 Jan 2005 17:32:06 +0800

Hi all,
 
as I understand it, the AVR has a cool IJMP instruction - indirect JMP to Z.
 
I would like to replace some existing code:
 
//------------
switch( state ) {
 case A:
  state = C;
  break;
 case B:
 ...
 case N:
 ...
}
//------------
 
with
 
//------------
//A macro with some asm to 
//load Z with state_label_address 
//and call IJMP
IndirectJump( state_label_address ); 
 
label_A:
 state_label_address = label_address_C;
 break;
label_B:
 ...
label_N:
 ...
//------------
 
The increase in speed for more than about 4 or 5 cases would be dramatic
enough for my time-sensitive application to make it worth it.
 
However - I don't know how to store the address of a label to my
label_address variable in GCC. I assume this can be done with some inline
assembler magic but I cannot seem to figure out the parameters to make this
work. Any tips would be much appreciated.
 
Regards
 
Ben Mann
 

reply via email to

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