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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/17/03 10:16
Read: times


 
#58828 - RE: Lookup Table Help
Responding to: ???'s previous message
This is an easy way to do the trick
Load a routine adress via the JMP Table
Then do a CALL to the JMP @A+DPTR
All routines return to AGAIN
Then simply JMP back

Have a nice day

Robert

DIPSWT_mode:
MOV A, P2 ; get the DIP switch value
ANL A, #0FH ; mask to the low 4 bits
RL A ; Table must be AJMP's
MOV DPTR, #TABLE
CALL PERFORM ; Call one of 16 routines
AGAIN: AJMP DIPSWT_MODE

PERFORM: JMP @A+DPTR ; jump to and through table
;
TABLE:
AJMP IGNOR ; swt=0 no operation
AJMP IGNOR ; swt=1 no operation
AJMP IGNOR ; swt=2 no operation
AJMP IGNOR ; swt=3 no operation
AJMP IGNOR ; swt=4 no operation
AJMP IGNOR ; swt=5 no operation
AJMP MODE5 ; swt=6 go to mode 5
AJMP IGNOR ; swt=7 no operation
AJMP MODE4 ; swt=8 go to mode 4
AJMP IGNOR ; swt=9 no operation
AJMP MODE3 ; swt=10 go to mode 3
AJMP IGNOR ; swt=11 no operation
AJMP MODE2 ; swt=12 go to mode 2
AJMP IGNOR ; swt=13 no operation
AJMP MODE1 ; swt=14 go to mode 1
AJMP IGNOR ; swt=15 no operation
;
IGNOR: RET ; Dummy routine

MODE1: ; What ever you want
RET ; Must end with RET
....


List of 6 messages in thread
TopicAuthorDate
Lookup Table Help            01/01/70 00:00      
   RE: Lookup Table Help            01/01/70 00:00      
      RE: Lookup Table Help            01/01/70 00:00      
         RE: Lookup Table Help            01/01/70 00:00      
   RE: Lookup Table Help            01/01/70 00:00      
   RE: Lookup Table Help            01/01/70 00:00      

Back to Subject List