mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-12-23 15:29:24 +00:00
Add test for ASRA inherent. And fix resulting bugs exposed!
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
f2b9ab0814
commit
cf32f37fc3
@ -783,8 +783,10 @@ uint8_t EightBit::mc6809::asl(uint8_t operand) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t EightBit::mc6809::asr(uint8_t operand) {
|
uint8_t EightBit::mc6809::asr(uint8_t operand) {
|
||||||
setFlag(CC(), CF, operand & Bit7);
|
setFlag(CC(), CF, operand & Bit0);
|
||||||
adjustNZ(operand >>= 1);
|
operand >>= 1;
|
||||||
|
operand |= Bit7;
|
||||||
|
adjustNZ(operand);
|
||||||
return operand;
|
return operand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,3 +104,22 @@ TEST_CASE("Shift Accumulator or Memory Byte Left", "[ASL][ASLA]") {
|
|||||||
REQUIRE(cpu.cycles() == 2);
|
REQUIRE(cpu.cycles() == 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Shift Accumulator or Memory Byte Right", "[ASR][ASRA]") {
|
||||||
|
|
||||||
|
Board board;
|
||||||
|
board.initialise();
|
||||||
|
auto& cpu = board.CPU();
|
||||||
|
cpu.step(); // Step over the reset
|
||||||
|
|
||||||
|
SECTION("Inherent") {
|
||||||
|
board.poke(0, 0x47);
|
||||||
|
cpu.A() = 0xcb;
|
||||||
|
cpu.step();
|
||||||
|
REQUIRE(cpu.A() == 0xe5);
|
||||||
|
REQUIRE((cpu.CC() & EightBit::mc6809::CF) != 0);
|
||||||
|
REQUIRE((cpu.CC() & EightBit::mc6809::ZF) == 0);
|
||||||
|
REQUIRE((cpu.CC() & EightBit::mc6809::NF) != 0);
|
||||||
|
REQUIRE(cpu.cycles() == 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user