aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_mov_constants.c
blob: f52b5ee13100f3dead144a81bfae1bb5787d708c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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;
}