Condition: jumps if CF = 0. After CMP a, b, no borrow means a was not below b, so a ≥ b as unsigned numbers. Three names cover the one instruction: JAE and JNB read naturally after a compare, JNC after arithmetic or a shift ("no carry came out"). DOS and BIOS services report success with CF = 0, so JNC OK1 right after INT 21h is a common sight.
A neat unsigned trick: to check that a value lies in a range lo..hi, subtract lo and compare once with the width. Values below lo wrap around to large unsigned numbers, so one JAE rejects both ends:
MOV AL, "7"SUB AL, "0" ; "0".."9" become 0..9, all else 10 or moreCMP AL, 10JAE BAD1 ; one unsigned test covers both endsADD AL, "0" ; digit -> characterMOV DL, ALMOV AH, 02h ; DOS: print the character in DLINT 21hJMP DONE1BAD1:MOV DL, "?"MOV AH, 02h ; DOS: print the character in DLINT 21hDONE1:
The signed counterpart is JGE. Remember that INC and DEC do not touch CF, so JNC after them tests whatever set CF earlier.
Range
On the 8086 JAE exists only in the SHORT form: two bytes, opcode 73h and a signed 8-bit displacement counted from the end of the instruction. The target must lie within −128..+127 bytes of that point. To go farther, invert the test and hop over an unconditional JMP, which can reach the whole segment. MASM 6 makes this rewrite itself when it finds the target out of range (its default OPTION LJMP), so the listing may show two instructions where you wrote one.
JB SKIP1 ; the opposite test, a short hopJMP FARAWAY ; any distance in the segmentSKIP1:
Later CPUs
The 80386 added a near form of every conditional jump, 0Fh 83h followed by a 16-bit displacement (32-bit in 32-bit code), so from the 386 on JAE can reach anywhere in the segment. Code for the 8086 must stay with the short form.