-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_tjs.spin
78 lines (50 loc) · 1.18 KB
/
test_tjs.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
dat
orgh 0
org 0
andn outb, ##$FFFF
or dirb, ##$FFFF
call #test1 ' Jump (less than zero)
call #test2 ' Don't Jump (greater than zero)
call #test3 ' Don't Jump (zero)
.end jmp #.end
'-------------------------------------------------------------------------------
test1 setcz #%01 wc, wz
mov d, ##$80_00_00_00
tjs d, #.success ' TEST INSTRUCTION
jmp #.end
.success
setbc cz, #1
setbz cz, #0
cmp d, ##$80_00_00_00 wz
if_nz jmp #.end
cmp cz, #%01 wz
if_nz jmp #.end
setb outb, #0
.end ret
'-------------------------------------------------------------------------------
test2 setcz #%01 wc, wz
mov d, #1
tjs d, #.end ' TEST INSTRUCTION
setbc cz, #1
setbz cz, #0
cmp d, #1 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
tjs d, #.end ' TEST INSTRUCTION
setbc cz, #1
setbz cz, #0
cmp d, #0 wz
if_nz jmp #.end
cmp cz, #%01 wz
if_nz jmp #.end
setb outb, #2
.end ret
'-------------------------------------------------------------------------------
d res 1
cz res 1