-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_sumc.spin
61 lines (46 loc) · 1.23 KB
/
test_sumc.spin
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
dat
orgh 0
org 0
andn outb, ##$FFFF
or dirb, ##$FFFF
mov cnt, testc
mov ptra, #@tests
_test rdlong d, ptra++
rdlong s, ptra++
rdlong cz, ptra++
setcz cz wc, wz
sumc d, s wc, wz ' TEST INSTRUCTION
setbc cz, #1 ' store C/Z
setbz cz, #0
rdlong r, ptra++ ' get the expected result
rdlong rcz, ptra++ ' get the expected flags
cmp d, r wz
if_nz jmp #_next
cmp cz, rcz wz
if_nz jmp #_next
mov d, testc ' set LED 0 to N
sub d, cnt
setb outb, d
_next
djnz cnt, #_test
end jmp #end
testc long (cnt-tests)/5
' d s cz r rcz
tests long $0000_0001, $0000_0001, %01, $0000_0002, %00
long $0000_0001, $0000_0001, %10, $0000_0000, %01
long $0000_0001, $FFFF_FFFF, %00, $0000_0000, %01
long $FFFF_FFFF, $FFFF_FFFF, %01, $FFFF_FFFE, %00
long $FFFF_FFFF, $FFFF_FFFF, %10, $0000_0000, %01
long $FFFF_FFFF, $0000_0001, %00, $0000_0000, %01
long $8000_0000, $0000_0001, %01, $8000_0001, %00
long $8000_0000, $0000_0001, %11, $7FFF_FFFF, %10
long $8000_0000, $FFFF_FFFF, %01, $7FFF_FFFF, %10
long $7FFF_FFFF, $FFFF_FFFF, %01, $7FFF_FFFE, %00
long $7FFF_FFFF, $FFFF_FFFF, %11, $8000_0000, %10
long $7FFF_FFFF, $0000_0001, %01, $8000_0000, %10
cnt res 1
d res 1
s res 1
cz res 1
r res 1
rcz res 1