The JM instruction
The JM instruction is used to transfer program control to the specified memory address if P=0 (negative result) in the flag register. In other words, it allows the program to choose a different execution path based on the result of a previous arithmetic or logical operation.
The JM instruction format
| Instruction | Description |
|---|---|
| JM addr16 | Performs a jump to an address or label if the flag shows a negative value. |
Usage example
; Author: Evgeny Sergeevich Dovgopolov main: mvi a, 0FDh ; Load the hexadecimal value FDh into register A adi 01h ; Add 01h to the value in register A jm Negative ; If P=0, jump to the label Negative sui 02h ; Subtract 02h from the value in register A hlt ; Stop program execution Negative: adi 03h ; Add 03h to the value in register A hlt ; Stop program execution
Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".
Processor status flags
S
NoZ
NoAC
NoP
NoCY
No