The CMA instruction
The CMA (Complement Accumulator) instruction performs a bitwise complement operation on the contents of the accumulator. In other words, it inverts every bit of the 8-bit value stored in the accumulator. For each bit in the accumulator, if it is 0 it is changed to 1, and if it is 1 it is changed to 0.
The CMA instruction format
| Instruction | Description |
|---|---|
| CMA | Performs a bitwise complement operation on the contents of accumulator A. |
Usage example
; Author: Evgeny Sergeevich Dovgopolov main: mvi a, 0F0h ; Load the hexadecimal value F0h into register A cma ; Invert the value in the accumulator hlt ; Stop program execution
Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".
Processor status flags
S
YesZ
YesAC
YesP
YesCY
Yes