diff --git a/src/emu.hpp b/src/emu.hpp index bae413a..53c7cfd 100644 --- a/src/emu.hpp +++ b/src/emu.hpp @@ -20,7 +20,8 @@ struct EmulatorState { uint16_t stack[stack_size] = {}; int stack_pointer = 0; - + + // this is technically 12-bits wide, but of course we dont have access to that :-) uint16_t I = 0; uint8_t v[16] = {}; diff --git a/tests/test.cpp b/tests/test.cpp index 97875aa..0b8c37b 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -4,6 +4,23 @@ #include "emu.hpp" +TEST_CASE("Test 0x0") { + state.reset(); + + state.pixels[0] = 1; + + // Display clear + process_opcode(0x00E0); + CHECK(state.pixels[0] == 0); + + state.stack_pointer = 1; + + // Subroutine return + process_opcode(0x00EE); + CHECK(state.stack_pointer == 0); +} + + TEST_CASE("Test 0x1") { state.reset();