The MVI instruction

The MVI (Move Immediate) instruction is used to load an 8-bit immediate value into a register or a memory location.

The MVI instruction format

InstructionDescription
MVI reg8, imm8 This format is used to move an 8-bit immediate data value into register reg8. Here reg8 can be any general-purpose register, for example A, B, C, D, E, H or L.
MVI mem8, imm8 This format is used to move an 8-bit immediate data value into the memory location pointed to by the contents of the HL register pair. Here mem8 denotes memory.

Usage example

; Author: Evgeny Sergeevich Dovgopolov

main:
    mvi     a, 1          ; Copy the decimal value 1 into register A
    mvi     b, 10h        ; Copy the hexadecimal value 10h into register B
    mvi     c, 10101010b  ; Copy the binary value 10101010b into register C
    mvi     d, 2          ; Copy the decimal value 2 into register D
    mvi     e, 20h        ; Copy the hexadecimal value 20h into register E
    mvi     h, 01010101b  ; Copy the binary value 01010101b into register H
    mvi     l, 3          ; Copy the decimal value 3 into register L
    mvi     m, 30h        ; Copy the value 30h into the memory pointed to by the HL register pair

    hlt                   ; Stop program execution

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

Processor status flags

S
Yes
Z
Yes
AC
No
P
Yes
CY
No