The DCR instruction
The DCR (Decrement) instruction is used to decrease the value of the specified register or memory location by 1.
The DCR instruction format
| Instruction | Description |
|---|---|
| DCR reg8 | This format is used to decrement the 8-bit value in a register. |
| DCR mem8 | This format is used to decrement the 8-bit value in a memory location. |
Usage example
; Author: Evgeny Sergeevich Dovgopolov num: db 20h main: mvi a, 10h ; Load the hexadecimal value 10h into register A dcr a ; Decrease the value in register A by 1 lxi h, num ; Load the address of the variable num into the HL register pair dcr m ; Decrease the value of the variable num in memory by 1 hlt ; Stop program execution
Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".
Processor status flags
S
YesZ
YesAC
YesP
YesCY
Yes