aboutsummaryrefslogtreecommitdiffstats
path: root/tests/core_test.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/core_test.c
parent7737afa6c225d947e02893c1698cc76a4b4ca4b1 (diff)
basic test framework; MOV and ADD testsHEADmaster
Diffstat (limited to 'tests/core_test.c')
-rw-r--r--tests/core_test.c52
1 files changed, 0 insertions, 52 deletions
diff --git a/tests/core_test.c b/tests/core_test.c
deleted file mode 100644
index 08e2650..0000000
--- a/tests/core_test.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "core.h"
-#include "test.h"
-
-#include <stdio.h>
-
-//#define DEBUG
-
-#ifdef DEBUG
-static void dump_state(msp430_t *state)
-{
- puts("MSP430 dump state:");
- printf("R0/PC: 0x%04x R1/SP: 0x%04x R2/SR: 0x%04x R3: 0x%04x\n",
- state->reg[0], state->reg[1], state->reg[2], state->reg[3]);
- printf("R4: 0x%04x R5: 0x%04x R6: 0x%04x R7: 0x%04x\n",
- state->reg[4], state->reg[5], state->reg[6], state->reg[7]);
- printf("R8: 0x%04x R9: 0x%04x R10: 0x%04x R11: 0x%04x\n",
- state->reg[8], state->reg[9], state->reg[10], state->reg[11]);
- printf("R12: 0x%04x R13: 0x%04x R14: 0x%04x R15: 0x%04x\n\n",
- state->reg[12], state->reg[13], state->reg[14], state->reg[15]);
-}
-#endif // DEBUG
-
-static uint8_t mem[0x10000] = {
- TESTBIN
-};
-
-int main()
-{
- msp430_t state;
-
- msp430_init_state(&state, mem);
-
-#ifdef DEBUG
- dump_state(&state);
-#endif // DEBUG
- 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;
- //break;
- }
-
-#ifdef DEBUG
- dump_state(&state);
-#endif // DEBUG
- } while (r != 1);
-
- return 0;
-}
-