The STC and CLC instructions
Setting and clearing the carry flag CF.
The STC instruction format
| Instruction | Description |
|---|---|
| STC | Set the carry flag (CF = 1). |
The CLC instruction format
| Instruction | Description |
|---|---|
| CLC | Clear 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 .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
YesPF
NoAF
NoZF
NoSF
NoTF
NoIF
NoDF
NoOF
No