-
Notifications
You must be signed in to change notification settings - Fork 1
/
PDP8_Operate_Instructions.inc
141 lines (125 loc) · 2.17 KB
/
PDP8_Operate_Instructions.inc
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
TITLE PDP8_Operate_Instructions (PDP8_Operate_Instructions.inc)
.data
linkMask WORD 1111000000000000b
accumulatorMask WORD 0000111111111111b
tempStorage WORD 0
.code
clearAccumulator PROC
mov accumulator, 0
ret
clearAccumulator ENDP
clearLink PROC
mov link, 0
ret
clearLink ENDP
onesComplementAccumulator PROC
not accumulator
ret
onesComplementAccumulator ENDP
complementL PROC
not link
ret
complementL ENDP
increment PROC uses eax
xor eax, eax
mov ax, accumulator
inc ax
and ax, linkMask
shr ax, 15
mov link, al
inc accumulator
mov ax, accumulator
and ax, accumulatorMask
mov accumulator, ax
ret
increment ENDP
rotateRight PROC uses eax
mov ax, accumulator
ror ax, 1
and ax, linkMask
shr ax, 15
mov link, al
mov ax, accumulator
ror ax, 1
and ax, accumulatorMask
mov accumulator, ax
ret
rotateRight ENDP
rotateLeft PROC uses eax
mov ax, accumulator
rol ax, 1
shr ax, 12
mov link, al
mov ax, accumulator
rol ax, 1
.IF link
inc ax
.ENDIF
and ax, accumulatorMask
mov accumulator, ax
ret
rotateLeft ENDP
rotateRightTwice PROC uses eax
mov ax, accumulator
and ax, 11b
shl ax, 10
mov tempStorage, ax
mov ax, accumulator
shr ax, 2
or ax, tempStorage
mov accumulator, ax
mov ax, tempStorage
shr ax, 1
mov link, al
ret
rotateRightTwice ENDP
rotateLeftTwice PROC uses eax
mov ax, accumulator
and ax, 110000000000b
shr ax, 10
mov tempStorage, ax
mov ax, accumulator
shl ax, 2
and ax, accumulatorMask
or ax, tempStorage
mov accumulator, ax
mov ax, tempStorage
and ax, 1b
mov al, link
ret
rotateLeftTwice ENDP
bitSwap PROC uses eax ebx
mov ax, accumulator
mov bx, accumulator
shr bx, 6
shl ax, 6
or ax, bx
mov ax, accumulator
ret
bitSwap ENDP
skipIfACLessThanZero PROC
.IF accumulator < 0
mov skip, 1
.ENDIF
ret
skipIfACLessThanZero ENDP
skipIfACZero PROC
.IF accumulator == 0
mov skip, 1
.ENDIF
ret
skipIfACZero ENDP
skipIfLNotZero PROC
.IF link != 0
mov skip, 1
.ENDIF
ret
skipIfLNotZero ENDP
orACFrontPanel PROC
nop
ret
orACFrontPanel ENDP
halt PROC
mov halted, 1
ret
halt ENDP