The JC instruction

The JC instruction is used to transfer program control to the specified memory address if C=1 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 JC instruction format

InstructionDescription
JC addr16 Performs a jump to an address or label if the CY flag is 1.

Usage example

; Author: Evgeny Sergeevich Dovgopolov

main:
    mvi     a, 0FFh  ; Load the hexadecimal value FFh into register A
    adi     01h      ; Add 01h to the value in register A
    jc      Carry    ; If C=1, jump to the label Carry

    mvi     b, 01h   ; Load the hexadecimal value 01h into register B
    hlt              ; Stop program execution

Carry:
    mvi     c, 01h   ; Copy the hexadecimal value 01h into register C

    hlt              ; Stop program execution

Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".

Processor status flags

S
No
Z
No
AC
No
P
No
CY
No