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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/23/07 22:34
Read: times


 
#139705 - compare & jump if higher
Responding to: ???'s previous message
Erik Malund said:

read up on CJNE and see the nifty little manipulation og CY that CJME does.
Erik



Thanks for the very quick response!
I was looking at the bible, but I guess I missed the carry bit.

Does this code look right? Seems like there must be a more efficient way to do this.
"The Carry bit (C) is set if operand1 is less than operand2, otherwise it is cleared."

mov	a,dph
cjne	a,#075h,Next
jnc	error     ;if c is set, acc must be lower than 75h 
                  ;if c is clr, acc is higher or equal to 75
Next:
;if we get here, acc is lower than 75h

Error:

;if we get here, acc is higher than 75h


List of 11 messages in thread
TopicAuthorDate
compare two values, jump if greater or equal            01/01/70 00:00      
   "the bible" ch 2 gives the answer            01/01/70 00:00      
   compare & jump if higher            01/01/70 00:00      
      a goof            01/01/70 00:00      
      How about...            01/01/70 00:00      
   CLR C            01/01/70 00:00      
      compare and jump...            01/01/70 00:00      
      Why?            01/01/70 00:00      
      wrong!            01/01/70 00:00      
      no need            01/01/70 00:00      
   add a,#(0x100-0x75), jc ...            01/01/70 00:00      

Back to Subject List