Corrigiendo instrucciones segun corax+ opcode test
This commit is contained in:
@@ -333,7 +333,8 @@ void Interpreter::ld_vx_byte(const Instruction& instruction) const
|
|||||||
|
|
||||||
void Interpreter::add_vx_byte(const Instruction& instruction) const
|
void Interpreter::add_vx_byte(const Instruction& instruction) const
|
||||||
{
|
{
|
||||||
this->machine_state->v[instruction.x] += instruction.kk;
|
auto& vx = this->machine_state->v[instruction.x];
|
||||||
|
vx = (vx + instruction.kk) & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Interpreter::ld_vx_vy(const Instruction& instruction) const
|
void Interpreter::ld_vx_vy(const Instruction& instruction) const
|
||||||
@@ -362,7 +363,7 @@ void Interpreter::add_vx_vy(const Instruction& instruction) const
|
|||||||
const auto& vy = this->machine_state->v[instruction.y];
|
const auto& vy = this->machine_state->v[instruction.y];
|
||||||
auto& vf = this->machine_state->v[0xF];
|
auto& vf = this->machine_state->v[0xF];
|
||||||
|
|
||||||
if (vx + vy > 0xFF)
|
if (vx + vy > 0x100)
|
||||||
{
|
{
|
||||||
vf = 1;
|
vf = 1;
|
||||||
}
|
}
|
||||||
@@ -371,7 +372,7 @@ void Interpreter::add_vx_vy(const Instruction& instruction) const
|
|||||||
vf = 0;
|
vf = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
vx += vy;
|
vx = (vx + vy) & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Interpreter::sub_vx_vy(const Instruction& instruction) const
|
void Interpreter::sub_vx_vy(const Instruction& instruction) const
|
||||||
@@ -380,7 +381,7 @@ void Interpreter::sub_vx_vy(const Instruction& instruction) const
|
|||||||
const auto& vy = this->machine_state->v[instruction.y];
|
const auto& vy = this->machine_state->v[instruction.y];
|
||||||
auto& vf = this->machine_state->v[0xF];
|
auto& vf = this->machine_state->v[0xF];
|
||||||
|
|
||||||
if (vx > vy)
|
if (vx >= vy)
|
||||||
{
|
{
|
||||||
vf = 1;
|
vf = 1;
|
||||||
}
|
}
|
||||||
@@ -389,7 +390,7 @@ void Interpreter::sub_vx_vy(const Instruction& instruction) const
|
|||||||
vf = 0;
|
vf = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
vx -= vy;
|
vx = (vx - vy) & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Interpreter::shr_vx_vy(const Instruction& instruction) const
|
void Interpreter::shr_vx_vy(const Instruction& instruction) const
|
||||||
@@ -421,7 +422,7 @@ void Interpreter::subn_vx_vy(const Instruction& instruction) const
|
|||||||
const auto& vy = this->machine_state->v[instruction.y];
|
const auto& vy = this->machine_state->v[instruction.y];
|
||||||
auto& vf = this->machine_state->v[0xF];
|
auto& vf = this->machine_state->v[0xF];
|
||||||
|
|
||||||
if (vy > vx)
|
if (vy >= vx)
|
||||||
{
|
{
|
||||||
vf = 1;
|
vf = 1;
|
||||||
}
|
}
|
||||||
@@ -430,7 +431,7 @@ void Interpreter::subn_vx_vy(const Instruction& instruction) const
|
|||||||
vf = 0;
|
vf = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
vx = vy - vx;
|
vx = (vy - vx) & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Interpreter::shl_vx_vy(const Instruction& instruction) const
|
void Interpreter::shl_vx_vy(const Instruction& instruction) const
|
||||||
@@ -453,7 +454,7 @@ void Interpreter::shl_vx_vy(const Instruction& instruction) const
|
|||||||
vf = 0;
|
vf = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
vx = vx << 1;
|
vx = vx << 1 & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Interpreter::sne_vx_vy(const Instruction& instruction) const
|
void Interpreter::sne_vx_vy(const Instruction& instruction) const
|
||||||
|
|||||||
Reference in New Issue
Block a user