From fa1c2a97da1dc6e728bb1bc7ed0031712849ae6a Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Sat, 23 Oct 2021 21:08:34 -0400 Subject: basic test framework; MOV and ADD tests --- tests/test_mov_constants.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/test_mov_constants.c (limited to 'tests/test_mov_constants.c') diff --git a/tests/test_mov_constants.c b/tests/test_mov_constants.c new file mode 100644 index 0000000..f52b5ee --- /dev/null +++ b/tests/test_mov_constants.c @@ -0,0 +1,36 @@ +#include "core.h" +#include "test.h" + +#include + +static uint8_t mem[0x10000] = { + TESTBIN +}; + +int main() +{ + msp430_t state; + msp430_init_state(&state, mem); + + int r; + do { + r = msp430_do_cycle(&state); + if (r < 0) { + printf("Failed to execute near PC=0x%04x!\n", state.reg[0]); + return 1; + } + } while (r != 1); + + if (state.reg[4] != 0 || + state.reg[5] != 1 || + state.reg[6] != 2 || + state.reg[7] != 0xFFFF || + state.reg[8] != 4 || + state.reg[9] != 8) + { + return 1; + } + + return 0; +} + -- cgit v1.2.3