Re: [AVR-Chat] Vector table in assembler.
2005-03-21 by Reza
--- Dave VanHorn <dvanhorn@dvanhorn.org> wrote:
>
>
> For speed, I need to have a bunch of operations that
> I would normally loop,
> set up in straightline code.
> I also need to control how many of these operations
> that I execute, by
> varying the entry point.
>
> I seem to remember a way to implement vectored
> jumps, but I can't think
> what it was offhand.
>
> Each entry might be 6-10 instructions, and there may
> be 256 of them, so
> whatever it is, needs to not use rjmps.
> Definitely trading codespace for speed here!, and
> one of the few places
> where I'm likely to use a macro.
>
hi;
I has same problem before,
the best way I found is this:
ensure this table is aligned on 128 word boundry:
jump_tbl:
rjmp loc_00
rjmp loc_01
....
rjmp loc_FF ;entry 255
jump_it: //pass function index in ZL
ldi ZH,hi8(jump_tbl*2)
ijmp
so the overhead is about 6 cycles only.
good lock.
commonly the best way is the simplest way.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com