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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/19/07 10:18
Read: times


 
#141004 - other type of table, XOR instead CJNE ;-)
Responding to: ???'s previous message
MY_TABLE:
  db '0'
  dw Routine_for_0
  db '1' 
  dw Routine_for_1
  db 'X'
  dw Routine_for_Xbig 
  db 'x'
  dw Routine_for_Xlitl 
  db 0 ;null, end of table
Routine_for_0:     ret
Routine_for_1:     ret
Routine_for_Xbig:  ret 
Routine_for_Xlitl: ret


AGAIN:
    JNB RI,$
    CLR RI
    MOV A,SBUF
    call findcommandNOW 
    sjmp AGAIN
          
findcommandNOW:   
    mov r0,A
    MOV DPTR,#MY_TABLE  
findcommandloop:
    clr a   
    MOVC A,@A+DPTR 
    jnz findcommand_A 
    ret    ;end of table finded, no valid command     
findcommand_A:
    xrl a,r0
    jz commandfinded 
    inc dptr
    inc dptr
    sjmp findcommandloop
commandfinded:
    inc dptr
    clr a
    MOVC A,@A+DPTR 
    mov r2,a
    inc dptr
    clr a
    MOVC A,@A+DPTR 
    mov r3,a
    ;now r2r3 contains addres of command_handler
    ;if bank 0 is default
    PUSH 2 
    PUSH 3
         ;    or reverse pushing, it depends of compiler, maybe
         ;    PUSH 3
         ;    PUSH 2  
         
    ret ;jumping to command_handler




List of 11 messages in thread
TopicAuthorDate
How to branch through table, without CJNE ?            01/01/70 00:00      
   You are very close            01/01/70 00:00      
      Oh Thanks sir, :-) you are really great,            01/01/70 00:00      
      WoW sir it really worked:-) here is full code,            01/01/70 00:00      
         Not quite            01/01/70 00:00      
            re: Abbreviations            01/01/70 00:00      
         Some remarks            01/01/70 00:00      
            Some Corrected Remarks :-)            01/01/70 00:00      
               The difference            01/01/70 00:00      
                  other type of table, XOR instead CJNE ;-)            01/01/70 00:00      
               Rotate            01/01/70 00:00      

Back to Subject List