Condition: jumps if OF = 1. OF is the signed counterpart of CF. ADD sets it when two numbers of the same sign give a result of the other sign, SUB and CMP when the true difference falls outside the range (−128..127 for bytes, −32768..32767 for words). INC of 7Fh, DEC of 80h and NEG of 80h overflow too. IMUL and MUL set OF (with CF) when the upper half of the product is needed; AND, OR, XOR and TEST clear it.
MOV AX, 30000ADD AX, 30000 ; 60000 does not fit a signed wordMOV DL, "Y" ; MOV leaves the flags aloneJO SHOW1 ; taken: DL stays "Y"MOV DL, "N"SHOW1:MOV AH, 02h ; DOS: print the character in DLINT 21h
Use JO to catch errors in signed arithmetic, or INTO to send them all to one INT 4 handler. Unsigned overflow is reported in CF and tested with JC.
Range
On the 8086 JO exists only in the SHORT form: two bytes, opcode 70h 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.
JNO 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 80h followed by a 16-bit displacement (32-bit in 32-bit code), so from the 386 on JO can reach anywhere in the segment. Code for the 8086 must stay with the short form.