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

Back to Subject List

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


 
#184274 - re:blindness
Responding to: ???'s previous message
About my blindness: i spent half day (yesterday) to discover why communication fails time to time.
Finally i found - one relay port was declared as 'relayport6 equ P3.0' instead
'relayport6 equ P2.0' .

About Jan's blindness: such 'switch' is very compact and (i suppose ) popular.
Last years i stopped to use it - especaially in multi-tables (as You describe) cases. I prefer to spent some code space and loss in time with more complicated 'switch':


modesearchtable1:
  db 1 ;mode 1            //line 1
  dw limitationstable1
  dw proceduresmode1
   
  db 12h ;mode 12h        //line 2
  dw limitationstable12h
  dw proceduresmode12h

  db 2 ;mode2             //line 3  
  dw limitationstable2
  dw proceduresmode2

  db 0ffh ;end of table , mode 0ffh not allowed

switchbymodesteptab equ 5 ;each 'line' takes 1 byte and 2 twobyte words


switchbymode:
   mov dptr,#modesearchtable1
   mov a,mode
   xrl a,#0ffh
   mov r2,a
switchbymodeloop:
   clr a
   movc a,@a+dptr
   xrl a,#0ffh
   jz switchbymodeNotFound ;end of table found
   xrl a,r2
   jz switchbymodeFound
   mov a,#switchbymodesteptab
   add a,dpl
   mov dpl,a
   jnc switchbymodeloop
   inc dph
   sjmp switchbymodeloop
switchbymodeNotFound:
   ljmp 0 ;???
   
switchbymodeFound:
   inc dptr
   ;now dptr points table with limitations
   ret  

 



At least is more safely ,when new line/option is needed.
regards


List of 10 messages in thread
TopicAuthorDate
the programmer blindness            01/01/70 00:00      
   split hairs            01/01/70 00:00      
   Double Dec            01/01/70 00:00      
      unreachable code            01/01/70 00:00      
         Analysis tools            01/01/70 00:00      
   re: blindness            01/01/70 00:00      
   re:blindness            01/01/70 00:00      
      Thanks all for the comments.            01/01/70 00:00      
         but remember            01/01/70 00:00      
   What is this, really?            01/01/70 00:00      

Back to Subject List