~williamvds/microlator

77215878d49494686d7e8c08f67ba6d4f0341ff2 — williamvds 3 years ago 40c7c53
Read and increment PC in BRK, fix test

Useful in cycle counting, but also means the expected PC in the test
needs to be incremented.
2 files changed, 2 insertions(+), 1 deletions(-)

M src/cpu.cpp
M test/testCPU.cpp
M src/cpu.cpp => src/cpu.cpp +1 -0
@@ 367,6 367,7 @@ constexpr void CPU::oBPL(ValueStore target) noexcept {
}

constexpr void CPU::oBRK(ValueStore) noexcept {
	read(pc++); // Read and discard
	flags.set(F::InterruptOff, true);

	push2(pc);

M test/testCPU.cpp => test/testCPU.cpp +1 -1
@@ 33,7 33,7 @@ TEST_CASE("CPU can execute", "[cpu]") {
	auto cpu = emu::CPU();
	cpu.step();

	REQUIRE(cpu.pc == 0x601);
	REQUIRE(cpu.pc == 0x602);
}

TEST_CASE("CPU passes nestest", "[cpu]") {