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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
//! Cycle timing tables.
//!
//! Ported from Musashi m68kcpu.c - m68ki_exception_cycle_table
/// Exception cycle counts for each CPU type.
/// Index: 0=68000, 1=68010, 2=68020, 3=68030, 4=68040
/// Each sub-array contains cycles for vectors 0-255.
pub const EXCEPTION_CYCLES: [[u8; 256]; 5] = [
// 68000
[
40, // 0: Reset - Initial Stack Pointer
4, // 1: Reset - Initial Program Counter
50, // 2: Bus Error
50, // 3: Address Error
34, // 4: Illegal Instruction
38, // 5: Divide by Zero
40, // 6: CHK
34, // 7: TRAPV
34, // 8: Privilege Violation
34, // 9: Trace
34, // 10: 1010 (Line-A)
34, // 11: 1111 (Line-F)
4, // 12: RESERVED
4, // 13: Coprocessor Protocol Violation
4, // 14: Format Error
44, // 15: Uninitialized Interrupt
4, // 16: RESERVED
4, // 17: RESERVED
4, // 18: RESERVED
4, // 19: RESERVED
4, // 20: RESERVED
4, // 21: RESERVED
4, // 22: RESERVED
4, // 23: RESERVED
44, // 24: Spurious Interrupt
44, // 25: Level 1 Interrupt Autovector
44, // 26: Level 2 Interrupt Autovector
44, // 27: Level 3 Interrupt Autovector
44, // 28: Level 4 Interrupt Autovector
44, // 29: Level 5 Interrupt Autovector
44, // 30: Level 6 Interrupt Autovector
44, // 31: Level 7 Interrupt Autovector
34, // 32: TRAP #0
34, // 33: TRAP #1
34, // 34: TRAP #2
34, // 35: TRAP #3
34, // 36: TRAP #4
34, // 37: TRAP #5
34, // 38: TRAP #6
34, // 39: TRAP #7
34, // 40: TRAP #8
34, // 41: TRAP #9
34, // 42: TRAP #10
34, // 43: TRAP #11
34, // 44: TRAP #12
34, // 45: TRAP #13
34, // 46: TRAP #14
34, // 47: TRAP #15
4, // 48: FP Branch or Set on Unknown Condition
4, // 49: FP Inexact Result
4, // 50: FP Divide by Zero
4, // 51: FP Underflow
4, // 52: FP Operand Error
4, // 53: FP Overflow
4, // 54: FP Signaling NAN
4, // 55: FP Unimplemented Data Type
4, // 56: MMU Configuration Error
4, // 57: MMU Illegal Operation Error
4, // 58: MMU Access Level Violation Error
4, // 59: RESERVED
4, // 60: RESERVED
4, // 61: RESERVED
4, // 62: RESERVED
4, // 63: RESERVED
// 64-255: User Defined (all 4 cycles)
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
],
// 68010
[
40, // 0: Reset - Initial Stack Pointer
4, // 1: Reset - Initial Program Counter
126, // 2: Bus Error
126, // 3: Address Error
38, // 4: Illegal Instruction
44, // 5: Divide by Zero
44, // 6: CHK
34, // 7: TRAPV
38, // 8: Privilege Violation
38, // 9: Trace
4, // 10: 1010 (Line-A)
4, // 11: 1111 (Line-F)
4, // 12: RESERVED
4, // 13: Coprocessor Protocol Violation
4, // 14: Format Error
44, // 15: Uninitialized Interrupt
4, // 16: RESERVED
4, // 17: RESERVED
4, // 18: RESERVED
4, // 19: RESERVED
4, // 20: RESERVED
4, // 21: RESERVED
4, // 22: RESERVED
4, // 23: RESERVED
46, // 24: Spurious Interrupt
46, // 25: Level 1 Interrupt Autovector
46, // 26: Level 2 Interrupt Autovector
46, // 27: Level 3 Interrupt Autovector
46, // 28: Level 4 Interrupt Autovector
46, // 29: Level 5 Interrupt Autovector
46, // 30: Level 6 Interrupt Autovector
46, // 31: Level 7 Interrupt Autovector
38, // 32: TRAP #0
38, // 33: TRAP #1
38, // 34: TRAP #2
38, // 35: TRAP #3
38, // 36: TRAP #4
38, // 37: TRAP #5
38, // 38: TRAP #6
38, // 39: TRAP #7
38, // 40: TRAP #8
38, // 41: TRAP #9
38, // 42: TRAP #10
38, // 43: TRAP #11
38, // 44: TRAP #12
38, // 45: TRAP #13
38, // 46: TRAP #14
38, // 47: TRAP #15
4, // 48-63: FP/MMU (unemulated)
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // 64-255: User Defined
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
],
// 68020
[
4, // 0: Reset - Initial Stack Pointer
4, // 1: Reset - Initial Program Counter
50, // 2: Bus Error
50, // 3: Address Error
20, // 4: Illegal Instruction
38, // 5: Divide by Zero
40, // 6: CHK
20, // 7: TRAPV
34, // 8: Privilege Violation
25, // 9: Trace
20, // 10: 1010 (Line-A)
20, // 11: 1111 (Line-F)
4, // 12: RESERVED
4, // 13: Coprocessor Protocol Violation
4, // 14: Format Error
30, // 15: Uninitialized Interrupt
4, // 16: RESERVED
4, // 17: RESERVED
4, // 18: RESERVED
4, // 19: RESERVED
4, // 20: RESERVED
4, // 21: RESERVED
4, // 22: RESERVED
4, // 23: RESERVED
30, // 24: Spurious Interrupt
30, // 25: Level 1 Interrupt Autovector
30, // 26: Level 2 Interrupt Autovector
30, // 27: Level 3 Interrupt Autovector
30, // 28: Level 4 Interrupt Autovector
30, // 29: Level 5 Interrupt Autovector
30, // 30: Level 6 Interrupt Autovector
30, // 31: Level 7 Interrupt Autovector
20, // 32: TRAP #0
20, // 33: TRAP #1
20, // 34: TRAP #2
20, // 35: TRAP #3
20, // 36: TRAP #4
20, // 37: TRAP #5
20, // 38: TRAP #6
20, // 39: TRAP #7
20, // 40: TRAP #8
20, // 41: TRAP #9
20, // 42: TRAP #10
20, // 43: TRAP #11
20, // 44: TRAP #12
20, // 45: TRAP #13
20, // 46: TRAP #14
20, // 47: TRAP #15
4, // 48-63: FP/MMU
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // 64-255: User Defined
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
],
// 68030 (same as 68020)
[
4, // 0: Reset - Initial Stack Pointer
4, // 1: Reset - Initial Program Counter
50, // 2: Bus Error
50, // 3: Address Error
20, // 4: Illegal Instruction
38, // 5: Divide by Zero
40, // 6: CHK
20, // 7: TRAPV
34, // 8: Privilege Violation
25, // 9: Trace
20, // 10: 1010 (Line-A)
20, // 11: 1111 (Line-F)
4, // 12: RESERVED
4, // 13: Coprocessor Protocol Violation
4, // 14: Format Error
30, // 15: Uninitialized Interrupt
4, // 16: RESERVED
4, // 17: RESERVED
4, // 18: RESERVED
4, // 19: RESERVED
4, // 20: RESERVED
4, // 21: RESERVED
4, // 22: RESERVED
4, // 23: RESERVED
30, // 24: Spurious Interrupt
30, // 25: Level 1 Interrupt Autovector
30, // 26: Level 2 Interrupt Autovector
30, // 27: Level 3 Interrupt Autovector
30, // 28: Level 4 Interrupt Autovector
30, // 29: Level 5 Interrupt Autovector
30, // 30: Level 6 Interrupt Autovector
30, // 31: Level 7 Interrupt Autovector
20, // 32: TRAP #0
20, // 33: TRAP #1
20, // 34: TRAP #2
20, // 35: TRAP #3
20, // 36: TRAP #4
20, // 37: TRAP #5
20, // 38: TRAP #6
20, // 39: TRAP #7
20, // 40: TRAP #8
20, // 41: TRAP #9
20, // 42: TRAP #10
20, // 43: TRAP #11
20, // 44: TRAP #12
20, // 45: TRAP #13
20, // 46: TRAP #14
20, // 47: TRAP #15
4, // 48-63: FP/MMU
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // 64-255: User Defined
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
],
// 68040 (TODO: these values are approximate)
[
4, // 0: Reset - Initial Stack Pointer
4, // 1: Reset - Initial Program Counter
50, // 2: Bus Error
50, // 3: Address Error
20, // 4: Illegal Instruction
38, // 5: Divide by Zero
40, // 6: CHK
20, // 7: TRAPV
34, // 8: Privilege Violation
25, // 9: Trace
20, // 10: 1010 (Line-A)
20, // 11: 1111 (Line-F)
4, // 12: RESERVED
4, // 13: Coprocessor Protocol Violation
4, // 14: Format Error
30, // 15: Uninitialized Interrupt
4, // 16: RESERVED
4, // 17: RESERVED
4, // 18: RESERVED
4, // 19: RESERVED
4, // 20: RESERVED
4, // 21: RESERVED
4, // 22: RESERVED
4, // 23: RESERVED
30, // 24: Spurious Interrupt
30, // 25: Level 1 Interrupt Autovector
30, // 26: Level 2 Interrupt Autovector
30, // 27: Level 3 Interrupt Autovector
30, // 28: Level 4 Interrupt Autovector
30, // 29: Level 5 Interrupt Autovector
30, // 30: Level 6 Interrupt Autovector
30, // 31: Level 7 Interrupt Autovector
20, // 32: TRAP #0
20, // 33: TRAP #1
20, // 34: TRAP #2
20, // 35: TRAP #3
20, // 36: TRAP #4
20, // 37: TRAP #5
20, // 38: TRAP #6
20, // 39: TRAP #7
20, // 40: TRAP #8
20, // 41: TRAP #9
20, // 42: TRAP #10
20, // 43: TRAP #11
20, // 44: TRAP #12
20, // 45: TRAP #13
20, // 46: TRAP #14
20, // 47: TRAP #15
4, // 48-63: FP/MMU
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // 64-255: User Defined
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
],
];