1# r0-r5 are used as tmps, consider them call clobbered by these macros.
2
3	.macro START
4	.data
5failmsg:
6	.ascii "fail\n"
7passmsg:
8	.ascii "pass\n"
9	.text
10	.global _START
11_START:
12	.global _start
13_start:
14	.endm
15
16	.macro exit rc
17	movw $\rc,r2
18	movw $0x410,r0
19	excp 8
20	.endm
21
22	.macro pass
23	movw $1, r2
24	movd $passmsg,(r4,r3)
25	movw $5, r5
26	movw $0x404, r0
27	excp 8
28	exit 0
29	.endm
30
31	.macro fail
32	movw $1, r2
33	movd $failmsg,(r4,r3)
34	movw $5, r5
35	movw $0x404, r0
36	excp 8
37	exit 1
38	.endm
39
40# Other macros know this only clobbers r0.
41	.macro test_h_gr reg, val
42	movw $\val,r0
43	cmpw \reg, r0
44	beq  test_gr
45	fail
46test_gr:
47	.endm
48
49	.macro test_h_grp regp, val
50	movd $\val,(r1,r0)
51	cmpd \regp,(r1,r0)
52	beq  test_grp
53	fail
54test_grp:
55	.endm
56
57
58	.macro mvi_h_condbit val
59	movw $0, r0
60	movw $\val, r1
61	cmpw r0, r1
62	.endm
63
64	.macro test_h_condbit val
65	.if \val
66	br test_c1
67	fail
68test_c1:
69	.else
70	br test_c0
71	fail
72test_c0:
73	.endif
74	.endm
75