The JL/JNGE instructions
Jump if less (for signed numbers).
Format of the JL/JNGE instructions
| Instruction | Description |
|---|---|
| JL rel8 / JNGE rel8 | Short jump if less/not greater or equal (SF ≠ OF). |
| JL rel16 / JNGE rel16 | Near jump if less/not greater or equal (SF ≠ OF). |
JL (Jump if Less) and JNGE (Jump if Not Greater or Equal) are synonyms. They are used for jumps after comparing signed numbers. The condition for the jump is: the sign flag (SF) is not equal to the overflow flag (OF). In other words, the jump is performed if the first operand (in CMP) is less than the second.
Usage example
title .model small .stack 100h code segment public ; Start of the code segment assume cs:code main proc ; Start of the main procedure mov ax, 3 ; Copy the value 3 into the ax register cmp ax, 6 ; Compare the value in ax with 6 jl Skip_1 ; If SF≠OF, jump to the Skip_1 label mov bx, 2 imul bx Skip_1: mov ax, 8 ; Copy the value 8 into the ax register cmp ax, 6 ; Compare the value in ax with 6 jl Skip_2 ; If SF≠OF, jump (here the condition is false) mov bx, 2 imul bx ; Perform signed multiplication of ax by bx Skip_2: mov ax, 4C00h ; Copy the process termination function number into ah and the value into al int 21h ; Call the interrupt main endp ; End of the main procedure code ends ; End of the code segment end main ; End of file. The main procedure is the entry point
Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".
Processor status flags
CF
NoPF
NoAF
NoZF
NoSF
NoTF
NoIF
NoDF
NoOF
No