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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/20/05 09:46
Modified:
  10/20/05 09:51

Read: times


 
#102671 - Value testing
Responding to: ???'s previous message
Andy Neil said:

The clue is right there in the name of the instruction:
CJNE = Compare and Jump if Not Equal

Yes, it's pretty clear, but I agree that this command appears a bit confusing, and easily produces bugs, especially with beginners.

I often use these two macros:
;	Macros:

JPLESS	MACRO	R,DAT,LAB	; Jump to LABEL if REG less than DAT
	CJNE	R,DAT,$+3       ; (No jump, just take the next instruction)
	JC	LAB
ENDM

JPGTEQ	MACRO	R,DAT,LAB	; Jump to LABEL if REG greater-equal to DAT
	CJNE	R,DAT,$+3
	JNC	LAB
ENDM

But besides that, if the value is to be tested on Equal or Not-Equal, and if it can be destroyed, then this seems a bit easier:
	XRL	A,Value		; or #Value !
	JZ	Equal

or	JNZ	NotEqual

Regards, Slobodan






List of 25 messages in thread
TopicAuthorDate
CJNE clarrification            01/01/70 00:00      
   Please find my answer below each quest            01/01/70 00:00      
   cjne            01/01/70 00:00      
      continued..            01/01/70 00:00      
         external memory            01/01/70 00:00      
            Absolutely!            01/01/70 00:00      
         cheat....            01/01/70 00:00      
            Hint            01/01/70 00:00      
               you young whippersnappers            01/01/70 00:00      
                  Young Whippersnappers tools            01/01/70 00:00      
               size & information            01/01/70 00:00      
         CJNE macros            01/01/70 00:00      
            More CJNE            01/01/70 00:00      
               PRE tags            01/01/70 00:00      
   Whatever made you think that??            01/01/70 00:00      
      used to other language            01/01/70 00:00      
         CJD            01/01/70 00:00      
            welllll...            01/01/70 00:00      
               most admirable, but            01/01/70 00:00      
         Don't guess!            01/01/70 00:00      
            which many that could not be bothered to            01/01/70 00:00      
      Value testing            01/01/70 00:00      
         Confusing for bigineer            01/01/70 00:00      
            Just apply it            01/01/70 00:00      
   what more then "the bibl" do you need            01/01/70 00:00      

Back to Subject List