The OR instruction

Logical bitwise OR.

Format of the OR instruction

InstructionDescription
OR AL, imm8AL OR imm8.
OR AX, imm16AX OR imm16.
OR reg/mem8, imm8reg/mem8 OR imm8.
OR reg/mem16, imm16reg/mem16 OR imm16.
OR reg/mem16, imm8reg/mem16 OR imm8 (sign-extended).
OR reg/mem8, reg8reg/mem8 OR reg8.
OR reg/mem16, reg16reg/mem16 OR reg16.
OR reg8, reg/mem8reg8 OR reg/mem8.
OR reg16, reg/mem16reg16 OR reg/mem16.

Performs the bitwise OR operation between the destination (first) and source (second) operands and stores the result in the location of the destination operand. The source operand can be an immediate value, a register or a memory location; the destination operand can be a register or a memory location. (However, two memory operands cannot be used in one instruction.) Each bit of the result of the OR instruction is set to 0 if both corresponding bits of the first and second operands are 0; otherwise each bit is set to 1.

This instruction can be used with the lock prefix to allow the instruction to be executed atomically.

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
        mov     al, 0010010b  ; Copy the value 36 into the al register
        mov     bl, 0010101b  ; Copy the value 41 into the bl register
        or      al, bl         ; Set bits 0 and 3

        mov     ax, 0609h      ; Copy the value 0609 into the ax register
        or      ax, 3030h      ; Substitute 3 where there are zeros

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