Implement CHIP-8 Instructions: Bitwise Arithmetic
Closed this issue · 1 comments
fokoid commented
-
0x8XY1
Sets VX to VX or VY. (bitwise OR operation) (Vx |= Vy
) -
0x8XY2
Sets VX to VX and VY. (bitwise AND operation) (Vx &= Vy
) -
0x8XY3
Sets VX to VX xor VY. (Vx ^= Vy
) -
0x8XY6
Stores the least significant bit of VX in VF and then shifts VX to the right by 1.[b] (Vx >>= 1
) -
0x8XYE
Stores the most significant bit of VX in VF and then shifts VX to the left by 1.[b] (Vx <<= 1
)
Pseudocode and descriptions were sourced from the CHIP-8 Wikipedia article and are licensed under the Creative Commons Attribution-ShareAlike License 3.0.
fokoid commented
note: the bitshift operators vary in implementation. the original COSMAC interpreter set VX = VY
before shifting; modern interpreters ignore VY
entirely. adding a configuration object to the machine to tweak this, with the modern behaviour the default for now.