<< Previous | Next >>

CBM n     Change Bit Mask     Rabbit 4000/5000 Instruction

Opcode
Instruction
Operation
ED 00 n CBM n tmp = [(HL) & ~n] | [A & n]
(HL) = tmp
(DE) = tmp

8-Bit Access
16-Bit Unaligned
16-Bit Aligned
Rabbit 4000
15
n/a
n/a
Rabbit 5000
15
14
13

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.


Rabbit Instructions << Previous | Next >> rabbit.com