<< Previous | Next >>

CBM n     Change Bit Mask     Rabbit 4000 Instruction
Opcode
Instruction
Clocks
Operation

ED 00 n

CBM n

15 (2,2,2,1,2,3,3)

tmp = [(HL) & ~n] | [A & n]
(HL) = tmp
(DE) = tmp


Flags ALTD IOI/IOE
S
Z
L/V
C
F
R
SP
S
D
-
-
-
-
·

Description

This instruction sets specified bits in an I/O register, where:

A = requested bits to be set in I/O register

n = 8-bit mask identifies bits that can be changed

DE = address of I/O register

HL = address of shadow register for I/O register

A bitwise AND operation is performed on the value in the shadow register and the inverse of the bitmask; which results in preserving any bits already set in the I/O register that are not under the bitmask. A second bitwise AND operation is performed on A and the bitmask; which results in setting all bits that are both requested (A) and allowed (n). The results of the two AND operations are then bitwise OR'd. This final answer is saved first in the shadow register and then in the I/O register.

Only (DE) is affected by IOI or IOE.


<< Previous | Next >>