The STC and CLC instructions

Setting and clearing the carry flag CF.

The STC instruction format

InstructionDescription
STCSet the carry flag (CF = 1).

The CLC instruction format

InstructionDescription
CLCClear the carry flag (CF = 0).

These instructions are used to control the carry flag explicitly, for example, before performing addition with carry (ADC) or subtraction with borrow (SBB) operations.

Usage example

title Author: Evgeny Sergeevich Dovgopolov

.model small
.stack 100h

code segment public        ; Start of the code segment
    assume cs:code

    main proc              ; Start of the main procedure
        clc                ; Clear the carry flag (CF = 0)
        stc                ; Set the carry flag (CF = 1)

        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
Yes
PF
No
AF
No
ZF
No
SF
No
TF
No
IF
No
DF
No
OF
No