Skip to content

Commit 22e5b12

Browse files
committed
test for merge, split, and seuss
MERGEB, MERGEW, SPLITB, SPLITW, SEUSSF, SEUSSR
1 parent 4a2c1ac commit 22e5b12

6 files changed

+318
-0
lines changed

test_mergeb.spin

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
dat
2+
orgh 0
3+
org 0
4+
5+
andn outb, ##$FFFF
6+
or dirb, ##$FFFF
7+
8+
mov cnt, testc
9+
mov ptra, #@tests
10+
11+
_test rdlong d, ptra++
12+
rdlong s, ptra++
13+
rdlong cz, ptra++
14+
15+
setcz cz wc, wz
16+
17+
mergeb d, s ' TEST INSTRUCTION
18+
19+
setbc cz, #1 ' store C/Z
20+
setbz cz, #0
21+
22+
rdlong r, ptra++ ' get the expected result
23+
rdlong rcz, ptra++ ' get the expected flags
24+
25+
cmp d, r wz
26+
if_nz jmp #_next
27+
28+
cmp cz, rcz wz
29+
if_nz jmp #_next
30+
31+
mov d, testc ' set LED 0 to N
32+
sub d, cnt
33+
setb outb, d
34+
35+
_next
36+
djnz cnt, #_test
37+
38+
end jmp #end
39+
40+
41+
testc long (cnt-tests)/5
42+
' d s cz r rcz
43+
tests long $BADD_ECAF, $FF00_FF00, %11, $AAAA_AAAA, %11
44+
long $BADD_ECAF, $00FF_00FF, %11, $5555_5555, %11
45+
long $BADD_ECAF, $0000_0000, %11, $0000_0000, %11
46+
long $BADD_ECAF, $FFFF_FFFF, %11, $FFFF_FFFF, %11
47+
48+
cnt res 1
49+
d res 1
50+
s res 1
51+
cz res 1
52+
r res 1
53+
rcz res 1

test_mergew.spin

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
dat
2+
orgh 0
3+
org 0
4+
5+
andn outb, ##$FFFF
6+
or dirb, ##$FFFF
7+
8+
mov cnt, testc
9+
mov ptra, #@tests
10+
11+
_test rdlong d, ptra++
12+
rdlong s, ptra++
13+
rdlong cz, ptra++
14+
15+
setcz cz wc, wz
16+
17+
mergew d, s ' TEST INSTRUCTION
18+
19+
setbc cz, #1 ' store C/Z
20+
setbz cz, #0
21+
22+
rdlong r, ptra++ ' get the expected result
23+
rdlong rcz, ptra++ ' get the expected flags
24+
25+
cmp d, r wz
26+
if_nz jmp #_next
27+
28+
cmp cz, rcz wz
29+
if_nz jmp #_next
30+
31+
mov d, testc ' set LED 0 to N
32+
sub d, cnt
33+
setb outb, d
34+
35+
_next
36+
djnz cnt, #_test
37+
38+
end jmp #end
39+
40+
41+
testc long (cnt-tests)/5
42+
' d s cz r rcz
43+
tests long $BADD_ECAF, $FFFF_0000, %11, $AAAA_AAAA, %11
44+
long $BADD_ECAF, $0000_FFFF, %11, $5555_5555, %11
45+
long $BADD_ECAF, $0000_0000, %11, $0000_0000, %11
46+
long $BADD_ECAF, $FFFF_FFFF, $11, $FFFF_FFFF, %11
47+
48+
cnt res 1
49+
d res 1
50+
s res 1
51+
cz res 1
52+
r res 1
53+
rcz res 1

test_seussf.spin

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
dat
2+
orgh 0
3+
org 0
4+
5+
andn outb, ##$FFFF
6+
or dirb, ##$FFFF
7+
8+
mov cnt, testc
9+
mov ptra, #@tests
10+
11+
_test rdlong d, ptra++
12+
rdlong s, ptra++
13+
rdlong cz, ptra++
14+
15+
setcz cz wc, wz
16+
17+
seussf d, s ' TEST INSTRUCTION
18+
19+
setbc cz, #1 ' store C/Z
20+
setbz cz, #0
21+
22+
rdlong r, ptra++ ' get the expected result
23+
rdlong rcz, ptra++ ' get the expected flags
24+
25+
cmp d, r wz
26+
if_nz jmp #_next
27+
28+
cmp cz, rcz wz
29+
if_nz jmp #_next
30+
31+
mov d, testc ' set LED 0 to N
32+
sub d, cnt
33+
setb outb, d
34+
35+
_next
36+
djnz cnt, #_test
37+
38+
end jmp #end
39+
40+
41+
testc long (cnt-tests)/5
42+
' d s cz r rcz
43+
tests long $BADD_ECAF, $AAAA_AAAA, %11, $D285_BB67, %11
44+
long $BADD_ECAF, $0000_0000, %11, $354D_AE51, %11
45+
long $BADD_ECAF, $FFFF_FFFF, %11, $CAB2_51AE, %11
46+
47+
48+
cnt res 1
49+
d res 1
50+
s res 1
51+
cz res 1
52+
r res 1
53+
rcz res 1

test_seussr.spin

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
dat
2+
orgh 0
3+
org 0
4+
5+
andn outb, ##$FFFF
6+
or dirb, ##$FFFF
7+
8+
mov cnt, testc
9+
mov ptra, #@tests
10+
11+
_test rdlong d, ptra++
12+
rdlong s, ptra++
13+
rdlong cz, ptra++
14+
15+
setcz cz wc, wz
16+
17+
seussr d, s ' TEST INSTRUCTION
18+
19+
setbc cz, #1 ' store C/Z
20+
setbz cz, #0
21+
22+
rdlong r, ptra++ ' get the expected result
23+
rdlong rcz, ptra++ ' get the expected flags
24+
25+
cmp d, r wz
26+
if_nz jmp #_next
27+
28+
cmp cz, rcz wz
29+
if_nz jmp #_next
30+
31+
mov d, testc ' set LED 0 to N
32+
sub d, cnt
33+
setb outb, d
34+
35+
_next
36+
djnz cnt, #_test
37+
38+
end jmp #end
39+
40+
41+
testc long (cnt-tests)/5
42+
' d s cz r rcz
43+
tests long $BADD_ECAF, $D285_BB67, %11, $AAAA_AAAA, %11
44+
long $BADD_ECAF, $354D_AE51, %11, $0000_0000, %11
45+
long $BADD_ECAF, $CAB2_51AE, %11, $FFFF_FFFF, %11
46+
47+
48+
cnt res 1
49+
d res 1
50+
s res 1
51+
cz res 1
52+
r res 1
53+
rcz res 1

test_splitb.spin

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
dat
2+
orgh 0
3+
org 0
4+
5+
andn outb, ##$FFFF
6+
or dirb, ##$FFFF
7+
8+
mov cnt, testc
9+
mov ptra, #@tests
10+
11+
_test rdlong d, ptra++
12+
rdlong s, ptra++
13+
rdlong cz, ptra++
14+
15+
setcz cz wc, wz
16+
17+
splitb d, s ' TEST INSTRUCTION
18+
19+
setbc cz, #1 ' store C/Z
20+
setbz cz, #0
21+
22+
rdlong r, ptra++ ' get the expected result
23+
rdlong rcz, ptra++ ' get the expected flags
24+
25+
cmp d, r wz
26+
if_nz jmp #_next
27+
28+
cmp cz, rcz wz
29+
if_nz jmp #_next
30+
31+
mov d, testc ' set LED 0 to N
32+
sub d, cnt
33+
setb outb, d
34+
35+
_next
36+
djnz cnt, #_test
37+
38+
end jmp #end
39+
40+
41+
testc long (cnt-tests)/5
42+
' d s cz r rcz
43+
tests long $BADD_ECAF, $AAAA_AAAA, %11, $FF00_FF00, %11
44+
long $BADD_ECAF, $5555_5555, %11, $00FF_00FF, %11
45+
long $BADD_ECAF, $0000_0000, %11, $0000_0000, %11
46+
long $BADD_ECAF, $FFFF_FFFF, $11, $FFFF_FFFF, %11
47+
48+
cnt res 1
49+
d res 1
50+
s res 1
51+
cz res 1
52+
r res 1
53+
rcz res 1

test_splitw.spin

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
dat
2+
orgh 0
3+
org 0
4+
5+
andn outb, ##$FFFF
6+
or dirb, ##$FFFF
7+
8+
mov cnt, testc
9+
mov ptra, #@tests
10+
11+
_test rdlong d, ptra++
12+
rdlong s, ptra++
13+
rdlong cz, ptra++
14+
15+
setcz cz wc, wz
16+
17+
splitw d, s ' TEST INSTRUCTION
18+
19+
setbc cz, #1 ' store C/Z
20+
setbz cz, #0
21+
22+
rdlong r, ptra++ ' get the expected result
23+
rdlong rcz, ptra++ ' get the expected flags
24+
25+
cmp d, r wz
26+
if_nz jmp #_next
27+
28+
cmp cz, rcz wz
29+
if_nz jmp #_next
30+
31+
mov d, testc ' set LED 0 to N
32+
sub d, cnt
33+
setb outb, d
34+
35+
_next
36+
djnz cnt, #_test
37+
38+
end jmp #end
39+
40+
41+
testc long (cnt-tests)/5
42+
' d s cz r rcz
43+
tests long $BADD_ECAF, $AAAA_AAAA, %11, $FFFF_0000, %11
44+
long $BADD_ECAF, $5555_5555, %11, $0000_FFFF, %11
45+
long $BADD_ECAF, $0000_0000, %11, $0000_0000, %11
46+
long $BADD_ECAF, $FFFF_FFFF, $11, $FFFF_FFFF, %11
47+
48+
cnt res 1
49+
d res 1
50+
s res 1
51+
cz res 1
52+
r res 1
53+
rcz res 1

0 commit comments

Comments
 (0)