-
Notifications
You must be signed in to change notification settings - Fork 1
/
PDP8_Operate.inc
141 lines (127 loc) · 1.95 KB
/
PDP8_Operate.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 (PDP8_Operate.inc)
INCLUDE PDP8_Operate_Instructions.inc
.data
bit1 BYTE ?
bit2 BYTE ?
bit3 BYTE ?
bit4 BYTE ?
bit5 BYTE ?
bit6 BYTE ?
bit7 BYTE ?
bit8 BYTE ?
skip BYTE 0
groups DWORD groupOne, groupTwo
.code
startOperate PROC
call extractOperateVariables
call doOperate
ret
startOperate ENDP
extractOperateVariables PROC uses eax
mov ax, instruction
shr ax, 7
and ax, 1b
mov bit1, al
mov ax, instruction
shr ax, 6
and ax, 1b
mov bit2, al
mov ax, instruction
shr ax, 5
and ax, 1b
mov bit3, al
mov ax, instruction
shr ax, 4
and ax, 1b
mov bit4, al
mov ax, instruction
shr ax, 3
and ax, 1b
mov bit5, al
mov ax, instruction
shr ax, 2
and ax, 1b
mov bit6, al
mov ax, instruction
shr ax, 1
and ax, 1b
mov bit7, al
mov ax, instruction
and ax, 1b
mov bit8, al
ret
extractOperateVariables ENDP
doOperate PROC uses eax ebx
xor eax, eax
mov ax, instruction
shr ax, 8
and ax, 1b
mov ebx, groups[eax * TYPE groups]
call ebx
ret
doOperate ENDP
groupOne PROC
.IF bit1
call clearAccumulator
.ENDIF
.IF bit2
call clearLink
.ENDIF
.IF bit3
call onesComplementAccumulator
.ENDIF
.IF bit4
call complementL
.ENDIF
.IF bit8
call increment
.ENDIF
.IF bit7
.IF (bit5 || bit6)
.IF bit5
call rotateRightTwice
.ENDIF
.IF bit6
call rotateLeftTwice
.ENDIF
jmp done
.ELSE
call bitSwap
.ENDIF
.ENDIF
.IF bit5
call rotateRight
.ENDIF
.IF bit6
call rotateLeft
.ENDIF
done:
ret
groupOne ENDP
groupTwo PROC
.IF bit2
call skipIfACLessThanZero
.ENDIF
.IF bit3
call skipIfACZero
.ENDIF
.IF bit4
call skipIfLNotZero
.ENDIF
.IF bit5
not skip
.ENDIF
.IF skip
inc programCounter
.ENDIF
.IF bit1
call clearAccumulator
.ENDIF
.IF bit6
call orACFrontPanel
.ENDIF
.IF bit7
call halt
.ENDIF
ret
groupTwo ENDP