© Thomas Kunz 2000
SCE 574
95
   Jump Tables
äCan have a multi-way jump by building a jump table
äWe can choose between routines to execute
äPROG0, PROG1,...., PROGN
äSet up a table with the addresses of the routines to execute
äTABLE DW PROG0
ä DW PROG1
ä DW PROG2
ä .....
äLoad the address of the routine into a register based on contents of another register
äCMP BX, 4
äJNC ERROR
äSHL BX, 1
äMOV BX, [TABLE+BX]
äJMP BX
ä.......
äCan add more routines by increasing the length of the table
ä
; Be sure routine is in range
; Go to error otherwise
; Convert to word offset
; Index into the table
; to get the routine’s
; address