??? 01/12/08 07:16 Read: times Msg Score: +1 +1 Good Answer/Helpful |
#149347 - jump table Responding to: ???'s previous message |
What you want is called a 'jump table'
There's a number of ways you can achieve this. One way is: ; ; jump table. index in A ; address of jump table in dptr ; maximum of 256/3 entries ; do_jtable: mov b,#3 mul a,b ;each jump is three bytes jmp @a+dptr ;goto required routine jtable ljmp routine0 ljmp routine1 ljmp routine2 ....... to use this code you would.. mov a,#3 ;call routine#3 mov dptr,#jtable call do_jtable ...... routine3 .. ... ret |