-
Notifications
You must be signed in to change notification settings - Fork 0
/
instructions-micro-steps.txt
196 lines (170 loc) · 6.68 KB
/
instructions-micro-steps.txt
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
00000000 # HLT
HLT|HLT|HLT|HLT|HLT|HLT|HLT|HLT|HLT|HLT|HLT|HLT|HLT
11111111 # HLT
HLT|HLT|HLT|HLT|HLT|HLT|HLT|HLT|HLT|HLT|HLT|HLT|HLT
11110000 # NOOP
NXT
00010001 # MOV A, #
HL_INC,PC_INC|M_OUT,A_IN|NXT
00010010 # MOV A, a
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,A_IN|NXT
00010011 # MOV A, @
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,TMP_IN|HL_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,A_IN|NXT
#00010100 # MOV A, B
#B_OUT,A_IN|NXT
00010101 # MOV A, (SP)
SPH_OUT,H_IN|SPL_OUT,L_IN|M_OUT,A_IN|NXT
00010110 # MOV A, SPL
SPL_OUT,A_IN|NXT
00010111 # MOV A, SPH
SPH_OUT,A_IN|NXT
00011000 # MOV IOA, A
A_OUT,IOA_IN|NXT
00011001 # MOV IOA, #
HL_INC,PC_INC|M_OUT,IOA_IN|NXT
00011010 # MOV IOA, a
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,IOA_IN|NXT
00011011 # MOV IOA, @
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,TMP_IN|HL_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,IOA_IN|NXT
#00011011 # MOV IOA, B
#B_OUT,IOA_IN|NXT
00011101 # MOV IOA, (SP)
SPH_OUT,H_IN|SPL_OUT,L_IN|M_OUT,IOA_IN|NXT
# MOV B,
00101000 # MOV SPL, A
A_OUT,SPL_IN|NXT
#00101001 # MOV SPL, B
00101010 # MOV SPH, A
A_OUT,SPH_IN|NXT
#00101011 # MOV SPH, B
00101100 # MOV SP, #
HL_INC,PC_INC|M_OUT,SPH_IN|HL_INC,PC_INC|M_OUT,SPL_IN|NXT
00101101 # MOV SP, a
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,SPH_IN|HL_INC|M_OUT,SPL_IN|NXT
00110000 # MOV (SP), A
SPH_OUT,H_IN|SPL_OUT,L_IN|A_OUT,M_IN|NXT
00110001 # MOV (SP), #
HL_INC,PC_INC|M_OUT,TMP_IN|SPH_OUT,H_IN|SPL_OUT,L_IN|TMP_OUT,M_IN|NXT
00110010 # MOV (SP), a
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,TMP_OUT|SPH_OUT,H_IN|SPL_OUT,L_IN|TMP_OUT,M_IN|NXT
#00110100 # MOV (SP), B
00110110 # MOV (SP), SPL
SPH_OUT,H_IN|SPL_OUT,L_IN|SPL_OUT,M_IN|NXT
00110111 # MOV (SP), SPH
SPH_OUT,H_IN|SPL_OUT,L_IN|SPH_OUT,M_IN|NXT
00111000 # MOV a, A
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|A_OUT,M_IN|NXT
#00111001 # MOV a, B
#HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|B_OUT,M_IN|NXT
00111010 # MOV a, SP
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,M_IN|SPH_OUT,M_IN|HL_INC|SPL_OUT,M_IN|NXT
00111100 # MOV @, A
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,TMP_IN|HL_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_IN,A_OUT|NXT
#00111101 # MOV @, B
01000000 # ADD A
A_OUT,ALU_OUT,A_IN|NXT
01000001 # ADD #
HL_INC,PC_INC|M_OUT,ALU_OUT,A_IN|NXT
01000010 # ADD a
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,ALU_OUT,A_IN|NXT
01000011 # ADD @
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,TMP_IN|HL_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,ALU_OUT,A_IN|NXT
#01000100 # ADD B
#B_OUT,ALU_OUT,A_IN|NXT
01000101 # ADD (SP)
SPH_OUT,H_IN|SPL_OUT,L_IN|M_OUT,ALU_OUT,A_IN|NXT
01001000 # ADDC A
A_OUT,ALU_OUT,A_IN,CARRY_IN|NXT
01001001 # ADDC #
HL_INC,PC_INC|M_OUT,ALU_OUT,A_IN,CARRY_IN|NXT
01001010 # ADDC a
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,ALU_OUT,A_IN,CARRY_IN|NXT
01001011 # ADDC @
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,TMP_IN|HL_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,ALU_OUT,A_IN,CARRY_IN|NXT
#01001100 # ADDC B
#B_OUT,ALU_OUT,A_IN,CARRY_IN|NXT
01001101 # ADDC (SP)
SPH_OUT,H_IN|SPL_OUT,L_IN|M_OUT,ALU_OUT,A_IN,CARRY_IN|NXT
01010001 # SUB #
HL_INC,PC_INC|M_OUT,ALU_OUT,A_IN,INV,CARRY_IN|NXT
01010010 # SUB a
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,ALU_OUT,A_IN,INV,CARRY_IN|NXT
01010011 # SUB @
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,TMP_IN|HL_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,ALU_OUT,A_IN,INV,CARRY_IN|NXT
#01010100 # SUB B
#B_OUT,ALU_OUT,A_IN,INV,CARRY_IN|NXT
01010101 # SUB (SP)
SPH_OUT,H_IN|SPL_OUT,L_IN|M_OUT,ALU_OUT,A_IN,INV,CARRY_IN|NXT
01011001 # SUBB #
HL_INC,PC_INC|M_OUT,ALU_OUT,A_IN,INV|NXT
01011010 # SUBB a
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,ALU_OUT,A_IN,INV|NXT
01011011 # SUBB @
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,TMP_IN|HL_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,ALU_OUT,A_IN,INV|NXT
#01011100 # SUBB B
#B_OUT,ALU_OUT,A_IN,INV|NXT
01011101 # SUBB (SP)
SPH_OUT,H_IN|SPL_OUT,L_IN|M_OUT,ALU_OUT,A_IN,INV|NXT
01100000 # INC SP
SP_INC|NXT
01100001 # DEC SP
SP_DEC|NXT
01110001 # COMP #
HL_INC,PC_INC|M_OUT,ALU_OUT,INV,CARRY_IN|NXT
01110010 # COMP a
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,ALU_OUT,INV,CARRY_IN|NXT
01110011 # COMP @
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,TMP_IN|HL_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,ALU_OUT,INV,CARRY_IN|NXT
#01110100 # COMP B
#B_OUT,ALU_OUT,INV,CARRY_IN|NXT
01110101 # COMP (SP)
SPH_OUT,H_IN|SPL_OUT,L_IN|M_OUT,ALU_OUT,INV,CARRY_IN|NXT
10000000 # OUT A
A_OUT,OUT|NXT
10000001 # OUT #
HL_INC,PC_INC|M_OUT,OUT|NXT
10000010 # OUT a
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,OUT|NXT
10000011 # OUT @
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,TMP_IN|HL_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,OUT|NXT
#10000100 # OUT B
#B_OUT,OUT|NXT
10000101 # OUT (SP)
SPH_OUT,H_IN|SPL_OUT,L_IN|M_OUT,OUT|NXT
10001000 # IN A
A_IN,IN|NXT
10001010 # IN a
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_IN,IN|NXT
10001011 # IN @
HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,TMP_IN|HL_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_IN,IN|NXT
#10001100 # IN B
#B_IN,IN|NXT
10010000 # JMP #
HL_INC|M_OUT,PCH_IN|HL_INC|M_OUT,PCL_IN|NXT
10010FFF # JMPF #
HL_INC|M_OUT,PCH_IN|HL_INC|M_OUT,PCL_IN|NXT
10011000 # JMP a
HL_INC|M_OUT,TMP_IN|HL_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,PCH_IN|HL_INC|M_OUT,PCL_IN|NXT
10011FFF # JMPF a
HL_INC|M_OUT,TMP_IN|HL_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,PCH_IN|HL_INC|M_OUT,PCL_IN|NXT
#10011000 # JMP BA
#B_OUT,PCH_IN|A_OUT,PCL_IN|NXT
#10011FFF # JMPF BA
#B_OUT,PCH_IN|A_OUT,PCL_IN|NXT
# Waiting one step because SP increases with the next rising edge of the clock
10100000 # PUSH A
SP_DEC||SPH_OUT,H_IN|SPL_OUT,L_IN|A_OUT,M_IN|NXT
10100001 # PUSH #
SP_DEC,HL_INC,PC_INC|M_OUT,TMP_IN|SPH_OUT,H_IN|SPL_OUT,L_IN|TMP_OUT,M_IN|NXT
10100010 # PUSH a
SP_DEC,HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,L_IN|TMP_OUT,H_IN|M_OUT,TMP_IN|SPH_OUT,H_IN|SPL_OUT,L_IN|TMP_OUT,M_IN|NXT
#10100100 # PUSH B
10100110 # PUSH w
SP_DEC,HL_INC,PC_INC|M_OUT,TMP_IN|HL_INC,PC_INC|M_OUT,A_IN|SPH_OUT,H_IN|SPL_OUT,L_IN|A_OUT,M_IN|SP_DEC||SPH_OUT,H_IN|SPL_OUT,L_IN|TMP_OUT,M_IN|NXT
10100111 # PUSH PC+3
SP_DEC,PC_INC|PC_INC|PC_INC,SPH_OUT,H_IN|SPL_OUT,L_IN|PCL_OUT,M_IN|SP_DEC||SPH_OUT,H_IN|SPL_OUT,L_IN|SPH_OUT,H_IN|NXT
10101000 # POP A
SPH_OUT,H_IN|SPL_OUT,L_IN|M_OUT,A_IN|SP_INC|NXT
#10101100 # POP B
10101110 # POP PC
SPH_OUT,H_IN|SPL_OUT,L_IN|M_OUT,PCH_IN|SP_INC,HL_INC|M_OUT,PCL_IN|SP_INC|NXT