-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_djz.spin
96 lines (64 loc) · 1.38 KB
/
test_djz.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
dat
orgh 0
org 0
andn outb, ##$FFFF
or dirb, ##$FFFF
call #test1 ' Decrement start at non-zero greater than 1
call #test2 ' Decrement start at 1
call #test3 ' Decrement starting at zero
.end jmp #.end
'-------------------------------------------------------------------------------
test1 setcz #%11 wc, wz
mov d, #2
mov c, #0
.loop add c, #1
djz d, #.loop ' TEST INSTRUCTION
setbc cz, #1
setbz cz, #0
cmp d, #1 wz
if_nz jmp #.end
cmp c, #1 wz
if_nz jmp #.end
cmp cz, #%11 wz
if_nz jmp #.end
setb outb, #0
.end ret
'-------------------------------------------------------------------------------
test2 setcz #%01 wc, wz
mov d, #1
mov c, #0
.loop add c, #1
djz d, #.loop ' TEST INSTRUCTION
setbc cz, #1
setbz cz, #0
cmp d, ##-1 wz
if_nz jmp #.end
cmp c, #2 wz
if_nz jmp #.end
cmp cz, #%01 wz
if_nz jmp #.end
setb outb, #1
.end ret
'-------------------------------------------------------------------------------
test3 setcz #%01 wc, wz
mov d, #0
mov c, #0
.loop add c, #1
djz d, #.loop ' TEST INSTRUCTION
.continue setbc cz, #1
setbz cz, #0
cmp d, ##-1 wz
if_nz jmp #.end
cmp c, #1 wz
if_nz jmp #.end
cmp cz, #%01 wz
if_nz jmp #.end
setb outb, #2
.end ret
'-------------------------------------------------------------------------------
d res 1
c res 1
cz res 1
r res 1
rc res 1
rcz res 1