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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/08/03 10:43
Read: times


 
#45070 - RE: multivariables comparison
Responding to: ???'s previous message
Dear Lee, Raghunathan R, and all,

I have solve the problem. Mr.Raghunathan R, i think lee's solution is better and simpler coz i dun need to define a new variables/flag.

lee, the code that you write should have CLR C befor SUBB, otherwise it cannot be function well..

Others, thanks for your help and pay attention to my post!!

Thanks to you all!!!

Below is the code that success doing the task:-

COMPARE:
; VAR1 through VAR6 are in iRAM
MOV SAME,#0 ; clear SAME flag
CLR C
MOV A,VAR6
SUBB A,VAR5
JNC COMP45
ORL SAME,#00000001b ; set bit 0 if VAR5 > VAR6
COMP45:
CLR C
MOV A,VAR5
SUBB A,VAR4
JNC COMP34
ORL SAME,#00000010b ; set bit 1 if VAR4 > VAR5
COMP34:
CLR C
MOV A,VAR4
SUBB A,VAR3
JNC COMP23
ORL SAME,#00000100b ; set bit 2 if VAR3 > VAR4
COMP23:
CLR C
MOV A,VAR3
SUBB A,VAR2
JNC COMP12
ORL SAME,#00001000b ; set bit 3 if VAR2 > VAR3
COMP12:
CLR C
MOV A,VAR2
SUBB A,VAR1
JNC COMPEND
ORL SAME,#00010000b ; set bit 4 if VAR1 > VAR2
COMPEND:
RET

List of 24 messages in thread
TopicAuthorDate
multivariables comparison            01/01/70 00:00      
   RE: little problem            01/01/70 00:00      
      RE: little problem            01/01/70 00:00      
   RE: multivariables comparison            01/01/70 00:00      
      RE: multivariables comparison            01/01/70 00:00      
         RE: multivariables comparison            01/01/70 00:00      
            RE: multivariables comparison            01/01/70 00:00      
               RE: multivariables comparison            01/01/70 00:00      
            RE: multivariables comparison            01/01/70 00:00      
   RE: multivariables comparison            01/01/70 00:00      
      RE: multivariables comparison - Sampah            01/01/70 00:00      
         RE: multivariables comparison - Lee            01/01/70 00:00      
            RE: multivariables comparison - Lee            01/01/70 00:00      
               RE: multivariables comparison - Sampah            01/01/70 00:00      
         RE: multivariables comparison - Sampah            01/01/70 00:00      
      what does SAME mean?            01/01/70 00:00      
         RE: what does SAME mean?            01/01/70 00:00      
            RE: what does SAME mean?            01/01/70 00:00      
               RE: what does SAME mean?            01/01/70 00:00      
               RE: what does SAME mean?            01/01/70 00:00      
      RE: multivariables comparison            01/01/70 00:00      
   RE: multivariables comparison            01/01/70 00:00      
      RE: multivariables comparison            01/01/70 00:00      
   RE: Clear CF before SUBB            01/01/70 00:00      

Back to Subject List