Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Commit

Permalink
cpu: fix shift right opcode
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill Lord committed Jan 21, 2018
1 parent c616886 commit 1e70960
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Chip8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void Chip8::step() {
// sub Vx from Vy and store result in Vx, VF is 1 if Vy > Vx
state.v[0xF] = state.v[y(opcode)] > state.v[x(opcode)];
state.v[x(opcode)] = state.v[y(opcode)] - state.v[x(opcode)];
} else if (opidx(opcode) == 0x8 && nibble(opcode) == 0x6) {
} else if (opidx(opcode) == 0x8 && nibble(opcode) == 0xE) {
// If the most-significant bit of Vx is 1, then VF is set to 1, otherwise to 0. Then Vx is multiplied by 2.
state.v[0xF] = (state.v[y(opcode)] & 0b10000000) >> 7;
state.v[x(opcode)] = state.v[y(opcode)] << 1;
Expand Down

0 comments on commit 1e70960

Please sign in to comment.