Jump Greater (JG)
In the ASM2 assembly language, the Jump Greater (JG) instruction is used for conditional branching based on the outcome of a prior comparison. JG redirects program execution to a specified label or function if the comparison result is that the first operand is greater than the second. This decision is typically based on the state of the zero flag (ZF) and the sign flag (SF) in the status register.
Syntax for Using JG:
JG <label/function_name>
JG GREATER_CASE
Where:
<label/function_name>
is the label or function to which the program will jump if the first operand is greater than the second.
Technical Details:
Flag Evaluation: JG checks the state of both the zero flag (ZF) and the sign flag (SF). The instruction initiates a jump if ZF is cleared (0) and SF indicates a positive result, meaning the first operand is greater.
Use in Comparative Operations: JG is often used following a CMP (compare) instruction, enabling decision-making based on whether one value is greater than another.
Last updated