Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
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




List of 32 messages in thread
TopicAuthorDate
Where can I ask newbie questions?            01/01/70 00:00      
   There is no such thing as a newbie question            01/01/70 00:00      
      the question            01/01/70 00:00      
         jump table            01/01/70 00:00      
            WOW, this is what I'm looking for!            01/01/70 00:00      
               *Very* Dangerous game!            01/01/70 00:00      
                  Agree with Dangerous            01/01/70 00:00      
                  PC            01/01/70 00:00      
               A and ACC            01/01/70 00:00      
                  ACC            01/01/70 00:00      
                     Different ways of getting to the same thing            01/01/70 00:00      
                        NO!            01/01/70 00:00      
                           OK, to put it another way...            01/01/70 00:00      
               jump table            01/01/70 00:00      
         the simple and stupid way...            01/01/70 00:00      
   One way to do this            01/01/70 00:00      
      Compare with JMP @A+PC            01/01/70 00:00      
         Yes there is            01/01/70 00:00      
         JMP @A+PC?            01/01/70 00:00      
            Oops            01/01/70 00:00      
   FAQ?            01/01/70 00:00      
      I think...            01/01/70 00:00      
         That's fine            01/01/70 00:00      
         English,            01/01/70 00:00      
   Newbie questions            01/01/70 00:00      
      Steve, I disagree            01/01/70 00:00      
   One question at a time            01/01/70 00:00      
   Agree to one question at time...            01/01/70 00:00      
      manipulating PC            01/01/70 00:00      
         PC            01/01/70 00:00      
   isnt an abuse ask more questions?            01/01/70 00:00      
      You said it yourself - start a new thread!            01/01/70 00:00      

Back to Subject List