--- In AVR-Chat@yahoogroups.com, "Paul Maddox" <P.Maddox@s...> wrote:
> Leon,
>
> Thanks, I hadn't spotted that in the instruction set.
> Just looking at IJMP, it may be simpler to use, no pushing/pulling
from the
> stack and its 1 less clock cycle (speed is king)...
I've just written a simple jump table program using ICALL:
.include "tn2313def.inc"
.def temp=r16
.cseg
.org 0
rjmp reset
reset:
ldi temp,low(RAMEND)
out spl,temp
ldi temp,$03
loop:
rol temp
ldi zl,low(jump_table)
ldi zh,high(jump_table)
add zl,temp
icall
rjmp loop
jump_table:
rcall zero
ret
rcall one
ret
rcall two
ret
rcall three
ret
zero:
ret
one:
ret
two:
ret
three:
ret
Change temp within the loop using the simulator to check that it
works.
LeonMessage
Re: Jumptable
2005-05-17 by leon_heller
Attachments
- No local attachments were found for this message.