aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_mov_constants.c
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2021-10-23 21:08:34 -0400
committerClyne Sullivan <clyne@bitgloo.com>2021-10-23 21:08:34 -0400
commitfa1c2a97da1dc6e728bb1bc7ed0031712849ae6a (patch)
tree4d25f85685405e428260741caffa63c2e4f57ab2 /tests/test_mov_constants.c
parent7737afa6c225d947e02893c1698cc76a4b4ca4b1 (diff)
basic test framework; MOV and ADD testsHEADmaster
Diffstat (limited to 'tests/test_mov_constants.c')
-rw-r--r--tests/test_mov_constants.c36
1 files changed, 36 insertions, 0 deletions
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 <stdio.h>
+
+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;
+}
+