GE-115 Emulator
An Emulator of the General Electrics GE-115 computer
msl-states.c
Go to the documentation of this file.
1#include <stdint.h>
2#include "bit.h"
3#include "msl-timings.h"
4#include "signals.h"
5
6#define MSL_COMMANDS_INCLUDED_BY_MSL_STATES
7#include "msl-commands.c"
8#undef MSL_COMMANDS_INCLUDED_BY_MSL_STATES
9
10#ifndef MSL_STATES_INCLUDED_BY_MSL_TIMINGS
11# error This file should be include by msl-timings.c and not compiled directly
12#endif
13
14/* The states below transcribe the micro-sequencer flow-chart foldouts
15 * (drawing 14023130, CPU[7] = Volume 7 schematics). docs/flowchart-sheets.md
16 * maps each sheet -> the state(s) here and records the per-state fidelity audit
17 * (which states are faithful per-clock transcriptions vs. functionally-correct
18 * hybrids that call the alu_* helpers). Sheet citations are noted on each chart. */
19
20/* Common Conditions */
21/* ----------------- */
22
23static uint8_t not_RO00(struct ge *ge) { return !BIT(ge->rRO, 0); }
24static uint8_t not_RO01(struct ge *ge) { return !BIT(ge->rRO, 1); }
25static uint8_t not_RO02(struct ge *ge) { return !BIT(ge->rRO, 2); }
26static uint8_t not_RO03(struct ge *ge) { return !BIT(ge->rRO, 3); }
27static uint8_t not_RO04(struct ge *ge) { return !BIT(ge->rRO, 4); }
28static uint8_t not_RO05(struct ge *ge) { return !BIT(ge->rRO, 5); }
29static uint8_t not_RO06(struct ge *ge) { return !BIT(ge->rRO, 6); }
30static uint8_t not_RO07(struct ge *ge) { return !BIT(ge->rRO, 7); }
31
32/* Address modify flag (bit 15 of the operand address = L2 bit 7 once the
33 * addr-hi byte has been read into L2). Used to route operand fetch into the
34 * modified-address indexing micro-cycle. (SIG(L207)/SIG(not_L207) are defined
35 * later in this file for the TPER/CPER path; these mirror them but are visible
36 * to the alpha-phase states below.) */
37static uint8_t addr_modified(struct ge *ge) { return BIT(ge->rL2, 7); }
38static uint8_t addr_absolute(struct ge *ge) { return !BIT(ge->rL2, 7); }
39
40/* Initialitiation */
41/* --------------- */
42
43// to state E2+E3 if !AINI
44// C8 if AINI
45
46static uint8_t AINI(struct ge *ge) { return ge->AINI; }
47static uint8_t not_AINI(struct ge *ge) { return !AINI(ge); }
48
49/* TODO: "jumpers" configuration.
50 *
51 * This is the configuration without any "configuration" jumper connector
52 * in backplane position E04.
53 * It is possible to change the configuration by plugging either a PONT2N
54 * or PONT2P in that slot, for this available configurations:
55 *
56 * E04 || FUL2 | FUL3 || Connectors for loading
57 * -------++------+------++-------------------------
58 * EMPTY || 1 | 1 || 2 and 3
59 * PONT2N || 1 | 0 || 2 and 4
60 * PONT2P || 0 | 1 || 4 and 3
61 *
62 * (detailed ch. 002)
63 *
64 * NOTE: test for the initial load assume FUL2 = FUL3 = 1.
65 */
66SIG(FUL2) { return 1; }
67SIG(FUL3) { return 1; }
68
69static uint8_t state_80_TO30_CO96(struct ge *ge) {
70 return (ge->ALOI && !FUL2(ge)) || (!ge->ALOI && !FUL3(ge));
71}
72
73static uint8_t state_80_TO30_CO97(struct ge *ge) {
74 return ge->ALOI && FUL2(ge);
75}
76
77static const struct msl_timing_chart state_80[] = {
78 { TO30, CI19, 0, DI28A0 },
79 { TO30, CO96, state_80_TO30_CO96 },
80 { TO30, CO97, state_80_TO30_CO97 },
81 { TO40, CO00, 0 },
82 { TO40, CO02, 0 },
83 { TO50, CI32, 0, DI28A0 },
84 { TO70, CI62, 0 },
85 { TO70, CI67, 0, DI28B0 },
86 { TI05, CI05, 0, DI28B0 },
87 { TI05, CI08, 0 },
88 { TI06, CI76, 0 },
89 { TI06, CI80, 0 },
90 { TI06, CI81, 0 },
91 { TI06, CI82, 0 },
92 { TI06, CU01, not_AINI },
93 { TI06, CU03, AINI },
94 { TI06, CU05, not_AINI },
95 { TI06, CU06, 0 },
96 { END_OF_STATUS, 0, 0 }
97};
98
99// Alpha phase
100
101// (to state F0 if RINT & !FA06
102// E0 if !RINT | FA06)
103
104static uint8_t state_E2_E3_TO80_CI89(struct ge *ge) {
105 /* (deltaRO = HLT + ASIN(ATOC+!ADIR)) */
106 return ge->rRO == HLT_OPCODE;
107}
108
109static uint8_t state_E2_E3_TI06_CI82(struct ge *ge) {
110 return ge->rRO == PER_OPCODE;
111}
112
113static uint8_t state_E2_E3_TI06_CU04(struct ge *ge) {
114 return ge->RINT && !BIT(ge->ffFA, 6);
115}
116
117static const struct msl_timing_chart state_E2_E3[] = {
118 { TO10, CO10, 0 },
119 { TO10, CO41, 0, DI12A0 },
120 { TO25, CO30, 0, DI12A0 },
121 { TO40, CO02, 0, DI18B0 },
122 { TO70, CI67, 0, DI12A0 },
123 { TO70, CI62, 0, DI12A0 },
124 { TO80, CI89, state_E2_E3_TO80_CI89 },
125 { TI05, CI08, 0 },
126 { TI06, CI80, 0 },
127 /* Reset FI01. Present in the per-clock timing table (14024137 fo.10/11,
128 * CPU[7] p61: "TI06 CI81 CI81A0 = EC73A0") but was missing here. FI01 is set
129 * only by forcing (state 08) / the b1 peripheral path, so the instruction
130 * fetch clearing it is a no-op for normal CPU flow (verified: deck + tests
131 * stay green). EC73A0 isn't transcribed; like the sibling CI80/CI83 resets
132 * (table cond DI18B0 = the in-state decode) it is treated as unconditional. */
133 { TI06, CI81, 0 },
134 { TI06, CI82, state_E2_E3_TI06_CI82 },
135 { TI06, CI83, 0 },
136 { TI06, CU04, state_E2_E3_TI06_CU04 },
137 { TI06, CU10, 0 },
138 { TI06, CU11, 0, DI18A0 },
139 { END_OF_STATUS, 0, 0 }
140};
141
142// to state E4 if FO06 | FO07
143// 64+65 if !(FO06 | FO07)
144
145static uint8_t state_E0_TI06_CU17(struct ge *ge) {
146 return !(BIT(ge->rFO, 6) || BIT(ge->rFO, 7));
147}
148
149static const struct msl_timing_chart state_E0[] = {
150 { TO10, CO12, 0, DI17A0 },
151 { TO10, CO41, 0, DI12A0 },
152 { TO25, CO30, 0, DI12A0 },
153 { TO40, CO00, 0, DI17A0 },
154 { TO70, CI67, 0, DI12A0 },
155 { TO70, CI62, 0, DI12A0 },
156 { TO80, CI39, 0 },
157 { TI05, CI05, 0, DI17A0 },
158 { TI06, CU02, 0 },
159 { TI06, CU17, state_E0_TI06_CU17 },
160 { END_OF_STATUS, 0, 0 }
161};
162
163// SS (Storage-to-Storage) data ops: opcode list from opcodes.h.
164// These are 6-byte instructions (opcode, LL, A1hi, A1lo, A2hi, A2lo).
165// Operands are loaded by the E4->E6->E5->E7 micro-loop:
166// E4 -> E6 (first pass, loads V1/V2 base), E5 (loads V1 from A1),
167// E7 (CI02 at TI05 loads V2 from A2), then EXEC_SS + SS_TO_ALPHA at TI06.
168// V1 = destination address, V2 = source address, L1 = length byte.
169static uint8_t is_ss_data_op(struct ge *ge) {
170 switch (ge->rFO) {
171 case MVC_OPCODE:
172 case NC_OPCODE:
173 case CMC_OPCODE:
174 case OC_OPCODE:
175 case XC_OPCODE:
176 case UPK_OPCODE:
177 case PK_OPCODE:
178 case TL_OPCODE:
179 case EDT_OPCODE:
180 case MVP_OPCODE:
181 case CMP_OPCODE:
182 case AP_OPCODE:
183 case SP_OPCODE:
184 case MP_OPCODE:
185 case DP_OPCODE:
186 case PKS_OPCODE:
187 case UPKS_OPCODE:
188 case AB_OPCODE:
189 case SB_OPCODE:
190 case AD_OPCODE:
191 case SD_OPCODE:
192 case MVQ_OPCODE:
193 case CMQ_OPCODE:
194 case SR_OPCODE:
195 case SL_OPCODE:
196 return 1;
197 default:
198 return 0;
199 }
200}
201
202// to state E6
203
204/* E4 reads the FIRST operand's high byte (A1hi), exactly as E5 reads A2hi; CI60
205 * (ni4 = top quartet = modifier+bit15) fires on /R007 (= not_RO07), matching the
206 * E5 box (CPU[7] flow chart 14023130). The original `return 0` stub never loaded
207 * it, so for absolute addresses the SS destination lost its high quartet and
208 * writes fell into segment 0; restoring the /R007 gating fixes that. (For the
209 * modified case the hardware zeroes V4 and indexes in ED|EC|EF|EE — transcribed
210 * in reference_operand_fetch_flowchart, to be implemented cycle-accurately.) */
211static uint8_t state_E4_TO70_CI60(struct ge *ge) { return not_RO07(ge); }
212
213static const struct msl_timing_chart state_E4[] = {
214 { TO10, CO10, 0, DI60A0 },
215 { TO10, CO41, 0, DI60A0 },
216 { TO25, CO30, 0, DI12A0 },
217 { TO40, CO00, 0, DI60A0 },
218 { TO70, CI67, 0, DI12A0 },
219 { TO70, CI62, 0, DI12A0 },
220 { TO70, CI65, 0, DI19A0 },
221 { TO70, CI60, state_E4_TO70_CI60 },
222 { TI05, CI02, 0 },
223 { TI06, CI06, 0 },
224 { TI06, CU01, 0, DI60A0 },
225 { END_OF_STATUS, 0, 0 }
226};
227
228// to state E5 if !L207 & (FO07 & FO06)
229// ED+EC if L207 (modified-address indexing cycle, not yet implemented)
230// 64+65 if !L207 & (!FO07 | !FO06)
231
232static uint8_t state_E6_TO80_CI38(struct ge *ge) { /* DO01? */ return 0; }
233static uint8_t state_E6_TI06_CU03(struct ge *ge) { return BIT(ge->rL2, 7); }
234
235static uint8_t state_E6_TI06_CU17(struct ge *ge) {
236 return (!BIT(ge->rL2, 7) &&
237 (!BIT(ge->rFO, 7) || !BIT(ge->rFO, 6)));
238}
239
240static const struct msl_timing_chart state_E6[] = {
241 { TO10, CO10, 0, DI60A0 },
242 { TO10, CO41, 0, DI60A0 },
243 { TO25, CO30, 0, DI12A0 },
244 { TO30, CI12, 0 },
245 { TO40, CO00, 0, DI60A0 },
246 { TO70, CI67, 0, DI12A0 },
247 { TO70, CI62, 0, DI12A0 },
248 { TO80, CI38, state_E6_TO80_CI38 },
249 { TI05, CI01, 0 },
250 { TI05, CI02, 0 },
251 { TI06, CU00, 0, DI20A0 },
252 { TI06, CU03, state_E6_TI06_CU03, EC56A0 },
253
254 /* in the manual this is CU10, but it maybe a mistake.. there's no way to reach
255 * the alpha states if we don't reset this bit 1 instead of bit 0 */
256 { TI06, CU11, 0 },
257
258 { TI06, CU17, state_E6_TI06_CU17 },
259
260 /* Modified first operand (L207 = address bit 15): enter the indexing
261 * micro-cycle (ED|EC -> EF|EE). INDEX_OP1 sets SA00 (first operand) and
262 * forces the next state to 0xec, overriding the CU bits above. */
263 { TI06, INDEX_OP1, addr_modified },
264 { END_OF_STATUS, 0, 0 }
265};
266
267// to state E7
268
269static const struct msl_timing_chart state_E5[] = {
270 { TO10, CO10, 0, DI60A0 },
271 { TO10, CO41, 0, DI60A0 },
272 { TO25, CO30, 0, DI12A0 },
273 { TO40, CO00, 0, DI60A0 },
274 { TO70, CI67, 0, DI12A0 },
275 { TO70, CI62, 0, DI12A0 },
276 { TO70, CI65, 0, DI19A0 },
277 { TO70, CI60, not_RO07 }, /* ni4 [/R007]: top quartet from RO only
278 * for absolute (CPU[7] E5 box) */
279 { TI05, CI02, 0 },
280 { TI06, CI06, 0 },
281 { TI06, CU01, 0, DI60A0 },
282 { END_OF_STATUS, 0, 0 }
283};
284
285// to state 64+65 if !L207
286// ED+EC if L207
287
288static uint8_t state_E7_TO80_CI38(struct ge *ge) { return 1; /* DO01 ?!? */ }
289static uint8_t state_E7_TI06_CU03(struct ge *ge) { return BIT(ge->rL2, 7); }
290
291static uint8_t state_E7_TI06_CU17(struct ge *ge) {
292 return BIT(ge->rL2, 7) && (BIT(ge->rFO, 7) || BIT(ge->rFO, 6));
293}
294
295static const struct msl_timing_chart state_E7[] = {
296 { TO10, CO10, 0, DI60A0 },
297 { TO10, CO41, 0, DI60A0 },
298 { TO25, CO30, 0, DI12A0 },
299 { TO30, CI12, 0 },
300 { TO40, CO00, 0, DI60A0 },
301 { TO70, CI67, 0, DI12A0 },
302 { TO70, CI62, 0 },
303 { TO80, CI38, state_E7_TO80_CI38 },
304 { TI05, CI02, 0 },
305 { TI06, CU00, 0, DI20A0 },
306 { TI06, CU03, 0, EC56A0 },
307 { TI06, CU10, 0 },
308 { TI06, CU17, state_E7_TI06_CU17 },
309 /* Mechanism B (hybrid one-shot): execute SS op here at TI06, after CI02 at
310 * TI05 has loaded V2 (source address) and V1 (destination address) was loaded
311 * during the preceding E5 pass. SS_TO_ALPHA overrides the future state to
312 * e2 (alpha), breaking out of the operand-fetch micro-loop.
313 *
314 * Only when the second operand is ABSOLUTE (not_L207). A modified second
315 * operand instead enters the indexing micro-cycle via INDEX_OP2 (SA00 = 0,
316 * no V1 copy); the SS op is then executed by INDEX_DONE in state EF|EE once
317 * V2 holds the resolved source address. */
320 { TI06, INDEX_OP2, addr_modified },
321 { END_OF_STATUS, 0, 0 }
322};
323
324/* Modified-Address Indexing Micro-Cycle */
325/* ------------------------------------- */
326
327/* Entered from E6 (operand 1) or E7 (operand 2) when the address is modified
328 * (L207 = bit 15 of the address field). Faithful to flow chart dwg 14023130:
329 *
330 * ED|EC — compute EA = change_register[N] + displacement into V2, and copy
331 * it to V1 for the first operand (SA00). (EXEC_INDEX fuses the
332 * flow chart's low-byte add ED|EC and high-byte/carry add EF|EE into
333 * one hybrid step; the two sheets survive as two states so the
334 * control flow still mirrors the chart.)
335 * EF|EE — route onward (INDEX_DONE):
336 * first operand of a two-address (PMM) op -> fetch/index op 2 (E5)
337 * SS data op, both operands resolved -> EXEC_SS, then alpha
338 * single-address op (data or jump) -> beta (0x64) to run it
339 */
340static uint8_t is_pmm(struct ge *ge) { return BIT(ge->rFO, 6) && BIT(ge->rFO, 7); }
341
342static void INDEX_DONE(struct ge *ge) {
343 if (ge->SA00 && is_pmm(ge)) {
344 /* first operand of a two-address op resolved -> go fetch operand 2 */
345 ge->SA00 = 0;
346 ge->future_state = 0xe5;
347 } else if (is_ss_data_op(ge)) {
348 /* both SS operands resolved -> execute and return to alpha */
349 EXEC_SS(ge);
350 ge->future_state = 0xe2;
351 } else {
352 /* single-address op (data op or jump) -> execute in beta */
353 ge->future_state = 0x64;
354 }
355}
356
357static const struct msl_timing_chart state_ED_EC[] = {
358 { TI06, EXEC_INDEX, 0 },
359 { TI06, INDEX_NEXT, 0 }, /* -> EF|EE (0xee) */
360 { END_OF_STATUS, 0, 0 }
361};
362
363static const struct msl_timing_chart state_EF_EE[] = {
364 { TI06, INDEX_DONE, 0 },
365 { END_OF_STATUS, 0, 0 }
366};
367
368/* Interruption + LPSR */
369/* ------------------- */
370
371/* Flow charts 14023130C "INTERRUPTION" (CPU[7] render-pg 26) and 14023130D
372 * "LPSR SEQUENCE" (render-pg 27). Entered from alpha (e2/e3) when INTE =
373 * RINT & /MASC routes there (the existing CU04 path: 0xE2 -> 0xF0). The graph
374 * F0 -> D2 -> D3 -> D0 -> D1 -> C2 -> C3 -> C0 -> C1 -> alpha saves the current
375 * PSR to 0x0300 and loads the new PSR (handler) from 0x0304. Each box is one
376 * hybrid command (INT_*, msl-commands.c) issued at TI06 that performs its byte
377 * transfer + V1 walk + routing; the states are otherwise inert. The earlier
378 * `INTE` diamond and CU04 routing already existed — only these target states
379 * were missing (empty slots). RINT is never asserted by the deck/tests, so the
380 * path is dormant there; tests/exec.c drives it explicitly. */
381static const struct msl_timing_chart state_F0[] = { { TI06, INT_F0, 0 }, { END_OF_STATUS, 0, 0 } };
382static const struct msl_timing_chart state_D2[] = { { TI06, INT_D2, 0 }, { END_OF_STATUS, 0, 0 } };
383static const struct msl_timing_chart state_D3[] = { { TI06, INT_D3, 0 }, { END_OF_STATUS, 0, 0 } };
384static const struct msl_timing_chart state_D0[] = { { TI06, INT_D0, 0 }, { END_OF_STATUS, 0, 0 } };
385static const struct msl_timing_chart state_D1[] = { { TI06, INT_D1, 0 }, { END_OF_STATUS, 0, 0 } };
386static const struct msl_timing_chart state_C2[] = { { TI06, INT_C2, 0 }, { END_OF_STATUS, 0, 0 } };
387static const struct msl_timing_chart state_C3[] = { { TI06, INT_C3, 0 }, { END_OF_STATUS, 0, 0 } };
388static const struct msl_timing_chart state_C0[] = { { TI06, INT_C0, 0 }, { END_OF_STATUS, 0, 0 } };
389static const struct msl_timing_chart state_C1[] = { { TI06, INT_C1, 0 }, { END_OF_STATUS, 0, 0 } };
390
391/* Beta Phase */
392/* ---------- */
393
394static uint8_t jc_js1_js2_jie(struct ge *ge) {
395 return ((ge->rFO == JC_OPCODE) ||
396 (ge->rFO == JU_OPCODE) ||
397 (ge->rFO == JCC_OPCODE) ||
398 (ge->rFO == JRT_OPCODE) ||
399 (ge->rFO == JS1_OPCODE && (ge->rL1 & 0xFF) ==JS1_2NDCHAR) ||
400 (ge->rFO == JS2_OPCODE && (ge->rL1 & 0xFF) ==JS2_2NDCHAR) ||
401 (ge->rFO == JIE_OPCODE && (ge->rL1 & 0xFF) ==JIE_2NDCHAR));
402}
403
404static uint8_t lon_loll(struct ge *ge) {
405 /* The 2nd char is an 8-bit field; mask L1 to its low byte (in real execution
406 * L1's high byte carries leftover bits, unlike the console-forced case). */
407 return ((ge->rFO == LON_OPCODE && (ge->rL1 & 0xFF) == LON_2NDCHAR) ||
408 (ge->rFO == LOLL_OPCODE && (ge->rL1 & 0xFF) == LOLL_OPCODE));
409}
410
411static uint8_t ins(struct ge *ge) {
412 return ge->rFO == INS_OPCODE && (ge->rL1 & 0xFF) ==INS_2NDCHAR;
413}
414
415static uint8_t jie(struct ge *ge) {
416 return ge->rFO == JIE_OPCODE && (ge->rL1 & 0xFF) ==JIE_2NDCHAR;
417}
418
419static uint8_t ens(struct ge *ge) {
420 return ge->rFO == ENS_OPCODE && (ge->rL1 & 0xFF) ==ENS_2NDCHAR;
421}
422
423static uint8_t loff(struct ge *ge) {
424 return ge->rFO == LOFF_OPCODE && (ge->rL1 & 0xFF) ==LOFF_2NDCHAR;
425}
426
427static uint8_t jc_js1_js2_jie_condition_verified(struct ge *ge) {
428 return ge->AVER && jc_js1_js2_jie(ge);
429}
430
431static uint8_t nop(struct ge *ge) {
432 return ge->rFO == NOP2_OPCODE;
433}
434
435static uint8_t is_jrt(struct ge *ge) {
436 return ge->rFO == JRT_OPCODE;
437}
438
439/* PM/SI immediate-format data ops executed in beta via the ALU helpers.
440 * After operand fetch these arrive in beta with V1=address, L1=immediate. */
441static uint8_t is_mvi(struct ge *ge) { return ge->rFO == MVI_OPCODE; }
442static uint8_t is_ni (struct ge *ge) { return ge->rFO == NI_OPCODE; }
443static uint8_t is_ci (struct ge *ge) { return ge->rFO == CI_OPCODE; }
444static uint8_t is_cmi(struct ge *ge) { return ge->rFO == CMI_OPCODE; }
445static uint8_t is_xi (struct ge *ge) { return ge->rFO == XI_OPCODE; }
446static uint8_t is_tm (struct ge *ge) { return ge->rFO == TM_OPCODE; }
447static uint8_t pm_imm_exec(struct ge *ge) {
448 return is_mvi(ge) || is_ni(ge) || is_ci(ge) || is_cmi(ge) || is_xi(ge) || is_tm(ge);
449}
450
451/* PM register ops (change registers, memory-mapped at 240+N*2): arrive in
452 * beta with V1=I1 address, L1=register-code aux char. */
453static uint8_t is_lr (struct ge *ge) { return ge->rFO == LR_OPCODE; }
454static uint8_t is_str(struct ge *ge) { return ge->rFO == STR_OPCODE; }
455static uint8_t is_cmr(struct ge *ge) { return ge->rFO == CMR_OPCODE; }
456static uint8_t is_amr(struct ge *ge) { return ge->rFO == AMR_OPCODE; }
457static uint8_t is_smr(struct ge *ge) { return ge->rFO == SMR_OPCODE; }
458static uint8_t is_la (struct ge *ge) { return ge->rFO == LA_OPCODE; }
459static uint8_t is_lpsr(struct ge *ge) { return ge->rFO == LPSR_OPCODE; }
460static uint8_t pm_reg_exec(struct ge *ge) {
461 return is_lr(ge) || is_str(ge) || is_cmr(ge) || is_amr(ge) || is_smr(ge) || is_la(ge);
462}
463
465 return jc_js1_js2_jie(ge) || lon_loll(ge) || loff(ge) || ins(ge) || ens(ge) || nop(ge)
467}
468
469/* PER - PERI: conditions from fo. 46 */
470
471static uint8_t per_peri(struct ge *ge) {
472 return ((ge->rFO == PER_OPCODE) ||
473 (ge->rFO == PERI_OPCODE) ||
474 (ge->rFO == RDC_OPCODE));
475}
476
477static uint8_t per_peri_TO25_CO30(struct ge *ge) {
478 return per_peri(ge) && !BIT(ge->rFO, 1);
479}
480
481/* EPER "examine" operation: Z character (in L2) = 0xC0 (bits 7,6 set).
482 * (TPER read Z=0x00 -> bit7=0; "set by-pass" Z=0x80 -> bit6=0.) */
483static uint8_t is_eper_examine(struct ge *ge) {
484 return BIT(ge->rL2, 7) && BIT(ge->rL2, 6);
485}
486
487/* Beta phase. The per-opcode beta recipes are flow charts 14023130E (JU/JC/JRT/
488 * JS/JE), the JS/JC/NOP/HLT/INS/ENS/LON/LOFF/LOLL sheet (render-pg 28), the
489 * LR/AMR/CMR/SMR/STR sheet (render-pg 30), 14023130O (NI/XI/OI/TM, render-pg 31),
490 * the CMI/CHI sheet (render-pg 38) and the EXECUTIVE-PHASE data-op sheets
491 * (render-pg 44-45). gemu implements these HYBRIDLY: the MSL drives routing here
492 * while the operation is performed once by an alu_* helper (EXEC_*), rather than
493 * transcribing each sheet's per-clock datapath. Functionally validated by
494 * tests/exec.c + the deck + cc; not cycle-accurate. See docs/flowchart-sheets.md. */
495static const struct msl_timing_chart state_64_65[] = {
496 { TO10, CO10, jc_js1_js2_jie },
497 { TO10, CO18, per_peri },
498 { TO10, CO95, per_peri, DE07A0 },
499 { TO10, CO96, per_peri, DE07A0 },
500 { TO10, CO97, per_peri, DE07A0 },
501 { TO20, CI87, lon_loll },
502 { TO20, CI77, ins },
503 { TO25, CO30, per_peri_TO25_CO30, DE08A0 },
504 { TO30, CI12, jc_js1_js2_jie },
505 { TO40, CO01, jc_js1_js2_jie },
506 { TO60, CO35, jie },
507 { TO60, CI38, jc_js1_js2_jie }, /* set AVER = verified_condition before the TI05 jump */
509 { TO65, EXEC_MVI, is_mvi },
510 { TO65, EXEC_NI, is_ni },
511 { TO65, EXEC_CI, is_ci },
512 { TO65, EXEC_CMI, is_cmi },
513 { TO65, EXEC_XI, is_xi },
514 { TO65, EXEC_TM, is_tm },
515 { TO65, EXEC_LR, is_lr },
516 { TO65, EXEC_STR, is_str },
517 { TO65, EXEC_CMR, is_cmr },
518 { TO65, EXEC_AMR, is_amr },
519 { TO65, EXEC_SMR, is_smr },
520 { TO65, EXEC_LA, is_la },
521 { TO65, EXEC_LPSR, is_lpsr },
522 { TO65, JRT_LINK, is_jrt },
523 { TO70, CI78, ens },
524 { TO70, CI62, per_peri, DE07A0 },
525 { TO70, CI67, per_peri, DE07A0 },
526 { TO89, CI88, loff },
527 { TI05, CI05, per_peri_TO25_CO30, DE08A0 },
530 { TI06, CU10, 0 },
531 { TI06, CU07, DE00A0 },
532 { TI06, CU12, 0 },
533 { TI06, CU15, per_peri },
534 { TI06, CU03, per_peri },
535 { END_OF_STATUS, 0, 0 },
536};
537
538/* Display */
539/* ------- */
540
541static uint8_t state_00_TO10_CO10(struct ge *ge) { return AF32(ge) || AF42(ge); }
542static uint8_t state_00_TO10_CO11(struct ge *ge) { return AF31(ge) || AF41(ge) || AF51(ge); }
543static uint8_t state_00_TO30_CI15(struct ge *ge) { return !AF20(ge) && !AF40(ge); }
544static uint8_t state_00_TO50_CI33(struct ge *ge) { return !AF20(ge) && !AF21(ge) && !AF40(ge); }
545
546/* Flow chart 14023130A "DISPLAY SEQUENCE" (CPU[7] render-pg 24). Verified
547 * row-by-row; the chart's `V3->BO [AF36]` is a scan artifact for `[AF30]`. */
548static const struct msl_timing_chart state_00[] = {
549 { TO10, CO10, state_00_TO10_CO10 }, /* RS_NORM or RS_PO */
550 { TO10, CO11, state_00_TO10_CO11 }, /* RS_V1 or RS_V1_SCR or RS_V1_LETT */
551 { TO10, CO12, AF50 }, /* RS_V2 */
552 { TO10, CO13, AF30 }, /* RS_V3 */
553 { TO10, CO14, AF10 }, /* RS_V4 */
554 { TO30, CI15, state_00_TO30_CI15 }, /* not RS_L3 and not RS_R1_L2 */
555 { TO30, CI17, AF20 }, /* RES_L3 */
556 { TO30, CI21, AF40 }, /* RS_R1_R2 */
557 { TO30, CI16, AF40 }, /* RS_V1_SCR */
558 { TO50, CI33, state_00_TO50_CI33 }, /* not RS_L3 and not RS_L1 and not RS_R1_L2 */
559 { TI06, CU07, 0 },
560 { END_OF_STATUS, 0, 0 }
561};
562
563/* Forcing */
564/* ------- */
565
566static uint8_t AF52_not_RO00(struct ge *ge) { return AF52(ge) && not_RO00(ge); }
567static uint8_t AF52_not_RO01(struct ge *ge) { return AF52(ge) && not_RO01(ge); }
568static uint8_t AF52_not_RO02(struct ge *ge) { return AF52(ge) && not_RO02(ge); }
569static uint8_t AF52_not_RO03(struct ge *ge) { return AF52(ge) && not_RO03(ge); }
570static uint8_t AF52_not_RO04(struct ge *ge) { return AF52(ge) && not_RO04(ge); }
571static uint8_t AF52_not_RO05(struct ge *ge) { return AF52(ge) && not_RO05(ge); }
572static uint8_t AF52_not_RO06(struct ge *ge) { return AF52(ge) && not_RO06(ge); }
573static uint8_t AF52_not_RO07(struct ge *ge) { return AF52(ge) && not_RO07(ge); }
574
575/* Flow chart 14023130B "FORCING SEQUENCE" (CPU[7] render-pg 25). States match
576 * + tests/forcing.c passes; a few forcing-read brackets (CO30/CO31/CI20/CI33)
577 * need a higher-DPI/physical recheck (docs/flowchart-sheets.md). */
578static const struct msl_timing_chart state_08[] = {
579 { TO10, CO11, AF41, EC69A0 }, /* fo. 18 */
580 { TO10, CO11, AF51 },
581 { TO10, CO41, 0 },
582 { TO25, CO30, AF51 },
583 { TO25, CO31, AF41 },
584 { TO30, CI20, 0 },
585 { TO40, CO01, AF41, EC69A0 },
586 { TO40, CO01, AF51 },
587 { TO50, CO48, AF52 },
588 /* NO -> BO */
589 { TO50, CI33, AF41 },
590 { TO50, CI33, AF43 },
591 { TO64, CO49, AF52_not_RO07 },
592 { TO70, CI62, AF51, EC70A0 },
593 { TO70, CI67, AF51 }, /* fo. 19 */
594 { TI05, CI04, AF10 },
595 { TI05, CI02, AF50 },
596 { TI05, CI05, AF21 },
597 { TI05, CI05, AF51 },
598 { TI05, CI01, AF31 },
599 { TI05, CI00, AF42 },
600 { TI05, CI08, AF53 },
601 { TI06, CI07, AF20 },
602 { TI06, CI03, AF30 },
603 { TI06, CI06, AF40 },
604 { TI06, CI09, AF40 },
605 { TI06, CI70, AF52 },
606 { TI06, CI71, AF52 },
607 { TI06, CI72, AF52 },
608 { TI06, CI73, AF52 }, /* fo. 20 */
609 { TI06, CI74, AF52 },
610 { TI06, CI75, AF52 },
611 { TI06, CI76, AF52 },
612 { TI06, CI80, AF52_not_RO00 },
613 { TI06, CI81, AF52_not_RO01 },
614 { TI06, CI82, AF52_not_RO02 },
615 { TI06, CI83, AF52_not_RO03 },
616 { TI06, CI84, AF52_not_RO04 },
617 { TI06, CI85, AF52_not_RO05 },
618 { TI06, CI86, AF52_not_RO06 },
619 { TI06, CU00, 0 },
620 { TI06, CU01, 0, DI57B0 },
621 { TI06, CU02, 0 },
622 { TI06, CU03, 0, DI57B0 },
623 { TI06, CU04, 0, DI57B0 },
624 { TI06, CU05, 0 },
625 { TI06, CU06, 0 },
626 { TI06, CU07, 0, DI57A0 },
627 { TI06, CU10, not_RO00 }, /* fo. 21 */
628 { TI06, CU11, not_RO01 },
629 { TI06, CU12, not_RO02 },
630 { TI06, CU13, not_RO03 },
631 { TI06, CU14, not_RO04 },
632 { TI06, CU15, not_RO05 },
633 { TI06, CU16, not_RO06 },
634 { TI06, CU17, not_RO07 },
635 { END_OF_STATUS, 0, 0 }
636};
637
638/* PER - PERI */
639/* ---------- */
640
641static uint8_t state_c8_TI06_CI85(struct ge *ge) {
642 /* !(selected_connector_busy || selected_channel_busy) */
643 return !(PUB01(ge) || DU92(ge));
644}
645
646/* PER-PERI preliminary phase, flow chart 14023130F (CPU[7] render-pg 32).
647 * State graph 64/65->c8->d8/d9/da/db->dc->cc and 80->(AINI)->c8|alpha verified
648 * via the CUxx future-state arithmetic; tests/initial-load.c locks the per-state
649 * register values. Peripheral-status decode (DU95/DU96/PCOV) is partial — PCOV
650 * is stubbed to 1. See docs/flowchart-sheets.md. */
651static const struct msl_timing_chart state_c8[] = {
652 { TO10, CO12, 0, DI97A0 },
653 { TO10, CO41, 0, DI97A0},
654 { TO25, CO30, not_AINI, ED70A0},
655 { TO40, CO02, 0, DI97A0 },
656 { TO70, CI62, 0, DI25A0 },
657 { TO70, CI67, 0, DI25A0 },
658 { TI06, CI06, 0 },
659 { TI06, CI75, 0, DI25A0 },
660 { TI06, CI84, 0, DI25A0 },
661 { TI06, CI85, state_c8_TI06_CI85 },
662 { TI06, CU04, 0 },
663 { END_OF_STATUS, 0, 0 },
664};
665
666static uint8_t state_d8_TO19_CE02(struct ge *ge) {
667 return !BIT(ge->ffFA, 5) && !BIT(ge->ffFA, 4);
668}
669
670static uint8_t state_d8_TO40_CO00(struct ge *ge) {
671 return BIT(ge->ffFA, 5) && !DU93(ge);
672}
673
674static const struct msl_timing_chart state_d8[] = {
675 { TO10, CO10, 0 },
676 { TO10, CO40, 0, DI21A0 }, // NOTE: both commands have same conditions ?!
677 { TO10, CO41, 0, DI21A0 }, // NOTE: it's like this in timing charts.
678 { TO19, CE02, state_d8_TO19_CE02 },
679 { TO30, CI15, 0, DI21A0 },
680 { TO40, CO00, state_d8_TO40_CO00 },
681 { TO50, CI33, 0, DI21A0 },
682 { TO50 /* PIPO */, CE01, 0 },
683 { TI06, CU00, 0, DI93A0},
684 { END_OF_STATUS, 0, 0 },
685};
686
687static uint8_t state_d9_TO40_CO00(struct ge *ge) {
688 return BIT(ge->ffFA, 5) && !DU93(ge);
689}
690
691static const struct msl_timing_chart state_d9[] = {
692 { TO10, CO10, 0 },
693 { TO10, CO40, 0, DI21A0 },
694 { TO10, CO41, 0, DI21A0},
695 { TO30, CI15, 0, DI21A0 },
696 { TO40, CO00, state_d9_TO40_CO00 },
697 { TO50, CI33, 0, DI21A0},
698 { TI06, CU00, 0, DI93A0},
699 { TI06, CU01, 0, DI94A0},
700 { TI06, CU10, 0 },
701 { END_OF_STATUS, 0, 0 },
702};
703
704static const struct msl_timing_chart state_da[] = {
705 { TO10, CO10, 0 },
706 { TO10, CO40, 0, DI21A0 },
707 { TO10, CO41, 0, DI21A0 },
708 { TO30, CI15, 0, DI21A0 },
709 { TO40, CO00, state_d9_TO40_CO00 },
710 { TO50, CI33, 0, DI21A0 },
711 { TI06, CU00, 0, DI93A0 },
712 { END_OF_STATUS, 0, 0 },
713};
714
715static const struct msl_timing_chart state_db[] = {
716 { TO10, CO10, 0 },
717 { TO10, CO40, 0, DI21A0 },
718 { TO10, CO41, 0, DI21A0 },
719 { TO30, CI15, 0, DI21A0 },
720 { TO40, CO00, state_d9_TO40_CO00 },
721 { TO50, CI33, 0, DI21A0 },
722 { TI06, CI74, 0, DI91A0 },
723 { TI06, CU00, 0, DI93A0 },
724 { TI06, CU10, 0 },
725 { TI06, CU01, 0, DI94A0 },
726 { TI06, CU11, 0, DI95A0 },
727 { TI06, CU12, 0 },
728 { TI06, CU02, state_d8_TO19_CE02 },
729 { END_OF_STATUS, 0, 0 },
730};
731
732/* needs to be 1 for the per preliminary phase to continue */
733SIG(PCOV) { return 1; }
734
735static uint8_t state_dc_TI06_CI70(struct ge *ge) {
736 return !PCOV(ge) && !BIT(ge->rL2, 2) && !AITE(ge);
737}
738
739static uint8_t state_dc_TI06_CU20(struct ge *ge) {
740 return BIT(ge->rL2, 0) && !BIT(ge->ffFA, 5);
741}
742
743static const struct msl_timing_chart state_dc[] = {
744 { TO10, CO13, 0 },
745 { TO30, CI19, 0 },
746 { TO30, CO90, 0 },
747 { TO40, CO01, 0 },
748 { TO50, CI32, 0, DI22A0 },
749 { TI06, CI70, state_dc_TI06_CI70 },
750 { TI06, CU14, 0, DI22A0 },
751 { TI06, CU20, state_dc_TI06_CU20 },
752 { END_OF_STATUS, 0, 0 },
753};
754
755static uint8_t state_cc_TO50_CE00(struct ge *ge) {
756 return !ge->PUC3;
757}
758
759
760static uint8_t state_cc_TI06_CU13(struct ge *ge) {
761 /* CU13 resets future_state bit 3. The original `|| FA00` term cleared bit 3
762 * on a unit-busy (FA00) exit, which sent CC -> 0xd2 (an interrupt-save
763 * state) instead of recycling to D8 to wait for the unit. Per the PER-PERI
764 * preliminary-phase flow chart (14023130F, CPU[7] render-pg 32): when FA05
765 * is clear and FA00 is set ("UNITA' OCCUPATA / UNIT BUSY") the sequence goes
766 * "again back to D8". Dropping FA00 here keeps bit 3 set so CC -> 0xd8 (with
767 * the CU11/CU04 below). The FA00=0 bootstrap path is unchanged. */
768 return (PCOV(ge) && DU96(ge) && !DU95(ge));
769}
770
771/* Unit-busy recycle: FA05 clear, FA00 set -> reset future_state bit 1 so the
772 * CC exit lands on 0xd8 (D8) rather than 0xda. (CU04 below sets bit 4.) */
773static uint8_t state_cc_TI06_CU11_busy(struct ge *ge) {
774 return !BIT(ge->ffFA, 5) && BIT(ge->ffFA, 0);
775}
776
777static uint8_t state_cc_TI06_CU05(struct ge *ge) {
778 return BIT(ge->ffFA, 5) || (!BIT(ge->ffFA, 0) && DU96(ge));
779}
780
781static uint8_t state_cc_TI06_CU04(struct ge *ge) {
782 return !BIT(ge->ffFA, 5) && BIT(ge->ffFA, 0);
783}
784
785static uint8_t state_cc_TI06_CI75(struct ge *ge) {
786 return (PCOV(ge) && DU96(ge) && !DU95(ge)) || BIT(ge->ffFA, 0);
787}
788
789static uint8_t state_cc_TI06_CU01(struct ge *ge) {
790 return BIT(ge->ffFA, 5) || !BIT(ge->ffFA, 9) ;
791}
792
793static const struct msl_timing_chart state_cc[] = {
794 { TO10, CO12, 0, DI97A0 },
795 { TO10, CO41, 0, DI97A0 },
796 { TO25, CO30, not_AINI, ED70A0 },
797 { TO30, CI19, 0, DI24A0 },
798 { TO30, CO96, 0 },
799 { TO40, CO02, DI97A0 },
800 { TO50, CI32, AINI, 0 },
801 { TO50, CE01, 0 },
802 { TO50, CE00, state_cc_TO50_CE00 },
803 /* For an EPER examine, load the real channel-1 status into RO (after the
804 * memory read at TO50) so the DU95 no-error decode at TI06 is meaningful. */
806 /* TODO: CI75 seems conditioned also on the type of peri operation (e.g. TPER/SPER ecc) */
807 { TI06, CI75, state_cc_TI06_CI75 },
808 { TI06, CU13, state_cc_TI06_CU13 },
809 { TI06, CU12, 0 },
810 { TI06, CU05, state_cc_TI06_CU05 },
811 { TI06, CU04, state_cc_TI06_CU04 },
812 { TI06, CU01, state_cc_TI06_CU01 },
813 { TI06, CU11, state_cc_TI06_CU11_busy }, /* FA00 unit-busy -> recycle to D8 */
814 { END_OF_STATUS, 0, 0 },
815};
816
817/* Channel-2 OUTPUT data-transfer (rSI state 02/03; flow chart 14023130₁, CPU[7]
818 * render-pg 36 "CHANNEL 2 DATA TRANSFER PHASE"). One character per RES2 cycle:
819 * NO <- V4 (CO14); memory read RO <- mem[VO=V4] (CO30); V4 <- V4+1 (CO41/CO04);
820 * "Load Printer Buffer" (CE16) hands RO to the integrated printer.
821 * Reached via NA_knot (RES2 -> rSA = rSI & 0x0f = 0x02) while the printer holds
822 * the channel-2 request; the per-character loop persists because the cycle leaves
823 * future_state = 0x02 and the channel-2 length terminates the request. */
824static const struct msl_timing_chart state_02[] = {
825 { TO10, CO14, 0 }, /* NO <- V4 (channel-2 operand addresser) */
826 { TO10, CO41, 0 }, /* counting network: V4 + 1 on NI */
827 { TO25, CO30, 0 }, /* memory read: RO <- mem[VO = V4] */
828 { TO40, CO04, 0 }, /* V4 <- NI (advance to next byte) */
829 { TI06, CE16, 0 }, /* Load Printer Buffer: emit RO to channel 2 */
830 { END_OF_STATUS, 0, 0 },
831};
832
833/* Channel-2 INPUT data-transfer (rSI state 0C|0E; CPU[7] sheet 36 "CHANNEL 2
834 * DATA TRANSFER PHASE"). One byte per RES2 cycle from the integrated reader:
835 * VO <- V4 (CO14); V4+1 -> V4 (CO41/CO04 — card/photo reader; a magnetic
836 * reader [PELM] would decrement); NE -> RO (CI34, the channel-2 input byte via
837 * NE_knot when the reader-input select PIB21 is asserted); RO -> mem[VO=V4]
838 * (CO31 WRITE, commits at TO65). Reached via NA_knot (RES2 -> rSA = rSI&0x0f =
839 * 0x0c) while the reader holds the channel-2 request RC02; per the sheet-36
840 * diamond a reader (PC22) byte returns to B8 to await the next request.
841 * The page-36 RO->RI and the [~PC22] external-error arming are printer/compare
842 * concerns (states 04|06); the bare reader read is the five commands below. */
843static const struct msl_timing_chart state_0c[] = {
844 { TO10, CO14, 0 }, /* VO <- V4 (channel-2 operand addresser) */
845 { TO10, CO41, 0 }, /* counting network: NI = V4 + 1 */
846 { TO25, CI34, 0 }, /* NE -> RO: latch the channel-2 input byte */
847 { TO25, CO31, 0 }, /* arm memory WRITE (commits TO65: mem[VO=V4] <- RO) */
848 { TO40, CO04, 0 }, /* V4 <- NI (advance to next byte) */
849 { END_OF_STATUS, 0, 0 },
850};
851
852/* TPER - CPER */
853/* ----------- */
854
855SIG(L207) { return BIT(ge->rL2, 7); }
856SIG(not_L207) { return !L207(ge); }
857
858static uint8_t state_ca_TO80_CE18(struct ge *ge) {
859 return L207(ge) && (!BIT(ge->rL1, 7) || BIT(ge->rL1, 6) || !BIT(ge->rL1, 0));
860}
861
862static const struct msl_timing_chart state_ca[] = {
863 { TO19, CE08, L207 },
864 { TO65, CE03, 0 },
865 { TO80, CE18, state_ca_TO80_CE18 },
866 { TI06, CU16, not_L207 },
867 { TI06, CU05, 0 },
868 { TI06, CU13, L207 },
869 { TI06, CU11, not_L207 },
870 { TI10, CE10, L207 },
871 { END_OF_STATUS, 0, 0 },
872};
873
874static const struct msl_timing_chart state_a8[] = {
875 { TO10, CO12, 0, DI97A0 },
876 { TO10, CO41, 0, DI97A0 },
877 { TO25, CO30, not_AINI, ED70A0 },
878 { TO30, CI19, 0, DI29A0 },
879 { TO40, CO02, 0, DI97A0 },
880 { TO70, CI60, 0, DI86A0 },
881 { TO70, CI65, 0, DI86A0 },
882 { TI05, CI05, 0, DI87A0 },
883 { TI06, CU00, 0, DI93A0 },
884 { END_OF_STATUS, 0, 0 },
885};
886
887static const struct msl_timing_chart state_a9[] = {
888 { TO10, CO12, 0, DI97A0 },
889 { TO10, CO41, 0, DI97A0 },
890 { TO25, CO30, not_AINI, ED70A0 },
891 { TO30, CI19, 0, DI29A0 },
892 { TO30, CI15, 0, DI84A0 },
893 { TO30, CO97, AINI },
894 { TO40, CO02, 0, DI97A0 },
895 { TO50, CI32, AINI, ED75A0 },
896 { TO70, CI62, 0, ED79A0 },
897 { TO70, CI67, 0, ED79A0 },
898 { TI05, CI05, 0, DI87A0 },
899 { TI06, CI07, PC031 },
900 { TI06, CU00, 0, DI93A0},
901 { TI06, CU10, 0 },
902 { TI06, CU01, DI94A0 },
903 { END_OF_STATUS, 0, 0 },
904};
905
906static const struct msl_timing_chart state_aa[] = {
907 { TO10, CO12, 0, DI97A0 },
908 { TO10, CO41, 0, DI97A0 },
909 { TO25, CO30, not_AINI, ED70A0 },
910 { TO30, CI19, 0, DI29A0 },
911 { TO40, CO02, 0, DI97A0 },
912 { TO70, CI60, 0, DI86A0 },
913 { TO70, CI65, 0, DI86A0 },
914 { TI05, CI01, 0 },
915 { TI06, CU00, 0, DI93A0},
916 { END_OF_STATUS, 0, 0 },
917};
918
919static uint8_t state_ab_TO70_CI62(struct ge *ge) { return !(PC111(ge) && PC211(ge)); }
920
921static uint8_t state_ab_TO80_CE18(struct ge *ge) {
922 /* this equation is different in the timing charts documentation (fo. 58),
923 * and in the cpu PDS documentation (fo. 218) it seems the PDS is the right
924 * one. */
925 return !(PC121(ge) || PC111(ge) || PC211(ge));
926}
927
928static uint8_t state_ab_TI05_CI04(struct ge *ge) { return BIT(ge->rL2, 0); }
929static uint8_t state_ab_TI05_CI03(struct ge *ge) { return PC031(ge); }
930
931static const struct msl_timing_chart state_ab[] = {
932 { TO10, CO12, 0, DI97A0 },
933 { TO10, CO41, 0, DI97A0 },
934 { TO19, CE07, 0 }, /* no clock in documentation! */
935 { TO19, CE08, 0 },
936 { TO25, CO30, not_AINI, ED70A0 },
937 { TO30, CI19, 0, DI29A0 },
938 { TO30, CI11, 0 },
939 { TO40, CO02, 0, DI97A0 },
940 { TO70, CI62, state_ab_TO70_CI62, ED79A0 },
941 { TO70, CI67, state_ab_TO70_CI62, ED79A0 },
942 { TO80, CE18, state_ab_TO80_CE18 },
943 { TI05, CI01, 0 },
944 { TI05, CI04, state_ab_TI05_CI04 },
945 { TI05, CI03, state_ab_TI05_CI03 },
946 { TI06, CU00, 0, DI93A0},
947 { TI06, CU10, 0 },
948 { TI06, CU01, 0, DI94A0},
949 { TI06, CU11, 0, DI95A0},
950 { TI06, CU04, 0, DI85A0},
951 { TI10, CE10, 0 },
952 { END_OF_STATUS, 0, 0 },
953};
954
955
956static uint8_t state_b8_TI06_CI72(struct ge *ge) { return BIT(ge->rL2, 0) && BIT(ge->rL2, 3); }
957static uint8_t DU97_or_DU98(struct ge *ge) { return DU97(ge) || DU98(ge); }
958static uint8_t state_b8_TI10_CE09(struct ge *ge) { return !BIT(ge->ffFA, 0) && !BIT(ge->rL2, 3) && !ge->RACI; }
959
960/* State b8 is the org-phase external request-wait for a channel-2 transfer.
961 * The natural exit to alpha is gated on DU97 (= PUC2 ^ L2.3): when the channel-2
962 * unit signals "ready/done" (PUC2), CU01/CU13/CU14/CU06 build the PER-completion
963 * future_state and the sequencer returns to alpha with the CPU context intact.
964 * gemu does not drive channel-2 timing at signal level, so for an integrated
965 * printer/typewriter the printer peripheral (printer.c) asserts PUC2 (and the
966 * CPU-active request RC00) at this wait; the completion is then performed by the
967 * machine's own microcode here, NOT by forcing the state from outside. The
968 * bootstrap/reader tests register no printer and never assert PUC2, so they are
969 * unaffected. See the LPSR/TPER channel-2 flow charts (B8 -> E2|E3 via DU97). */
970static const struct msl_timing_chart state_b8[] = {
971 { TI06, CI72, state_b8_TI06_CI72 },
972 { TI06, CI70, 0 },
973 { TI06, CU01, DU97_or_DU98 },
974 { TI06, CU13, DU97 },
975 { TI06, CU14, DU97_or_DU98 },
976 { TI06, CU06, DU97_or_DU98 },
977 { TI10, CE09, state_b8_TI10_CE09 },
978 { END_OF_STATUS, 0, 0 },
979};
980
981SIG(L204) { return BIT(ge->rL2, 4); }
982SIG(L205) { return BIT(ge->rL2, 5); }
983SIG(L206) { return BIT(ge->rL2, 6); }
984
985
986SIG(FA01) { return BIT(ge->ffFA, 1); }
987SIG(not_FA01) { return !FA01(ge); }
988
989static const struct msl_timing_chart state_b1[] = {
990 { TO10, CO11 },
991 { TO10, CO41 },
992 { TO10, CO40, L205 },
993 { TO25, CO31, FA01 },
994 { TO30, CI15, not_FA01 },
995 { TO30, CI12, FA01 },
996 { TO30, CI41 },
997 { TO40, CO01, FA01 },
998 { TO50, CI33, FA01 },
999 { TO80, CE18 },
1000 { TI05, CI05, not_FA01 },
1001 { TI06, CI71 },
1002 { TI06, CI81, FA01 },
1003 { TI06, CU03 },
1004 { TI06, CU10 },
1005 { END_OF_STATUS },
1006};
1007
1008
1009SIG(RIG1) { return ge->RIG1; }
1010SIG(RIG3) { return ge->RIG3; }
1011
1012/* RENIA/RILIA: channel-1 read length-count "not exhausted". The length is in L1,
1013 * decremented per character (CI15->count->CI05; CPU[7] B9 timing), and a
1014 * length-counted transfer ends at L1+1 chars (CPU[4] §5.8.4.3a) — i.e. when L1
1015 * underflows to all ones (RL1U1, ch.128).
1016 *
1017 * RENIA is the faithful terminal-count equation, gated by L204 (the order-block
1018 * "length-counted transfer" bit, rL2.4): it drops to 0 only when an actively
1019 * length-counted transfer has reached terminal. This is INERT for every read
1020 * gemu currently performs: the bootstrap/initial-load reads keep L204=0 and L1
1021 * constant at the order length (the per-character L1 decrement is not yet wired
1022 * into the b1/b9 read datapath), so they continue to end on FININ (RIG1)
1023 * byte-identically. Enabling true length termination needs that L1 decrement
1024 * wired first — tracked as the remaining datapath gap. (Equation/decode covered
1025 * by reader_signals.rl1u1_terminal_decode; inertness by the bootstrap reads.) */
1026SIG(RENIA) { return !(RL1U1(ge) && L204(ge)); }
1027SIG(RILIA) { return 1; } // 2nd-length count (decimal SS transfers) — not exercised
1028
1029SIG(RIG1A) { return !ge->RIG1; }
1030SIG(RIVE1) { return !(RIG1A(ge) && RENIA(ge) && RILIA(ge)); }
1032SIG(RIVE) { return RIVE1(ge); }
1033
1034SIG(not_L206) { return !L206(ge); }
1035
1036static uint8_t state_b9_TO25_CO31(struct ge *ge) { return !BIT(ge->ffFA, 1) && !BIT(ge->rL2, 6); }
1037static uint8_t state_b9_TO30_CI12(struct ge *ge) { return !L204(ge) && !L206(ge); }
1038
1039/* the original timingchart and the flow chart disagree, RIG1 is spelt "AIGI" in
1040 * the timings, but RIG1 in the flow, also timings use L206 and flow use L205... */
1041static uint8_t state_b9_TO40_CO01(struct ge *ge) { return (L204(ge) || (!BIT(ge->ffFA, 1) && RIG1(ge))) && !L206(ge); }
1042
1043static uint8_t state_b9_TO70_CI67(struct ge *ge) { return BIT(ge->ffFA, 1) && !L206(ge); }
1044static uint8_t state_b9_TO70_CI66(struct ge *ge) { return !BIT(ge->ffFA, 1) && !L204(ge) && !L206(ge); }
1045static uint8_t state_b9_TO80_CE05(struct ge *ge) { return !PC121(ge) && !L206(ge); }
1046static uint8_t state_b9_TI06_CU13(struct ge *ge) { return !L204(ge) && !L206(ge); }
1047static uint8_t state_b9_TI10_CE09(struct ge *ge) { return !RIVE(ge) && !PC121(ge) && !L206(ge); }
1048
1049static const struct msl_timing_chart state_b9[] = {
1050 { TO10, CO11 },
1051 { TO10, CO41 },
1052 { TO10, CO40, L205 },
1053 { TO25, CO31, state_b9_TO25_CO31 },
1054 { TO30, CI15, L204 },
1055 { TO30, CI41, L204 },
1056 { TO30, CI40, L204 },
1057 { TO30, CI12, state_b9_TO30_CI12 },
1058 { TO40, CO01, state_b9_TO40_CO01 },
1059 { TO50, CI34, not_L206 },
1060 { TO70, CI67, state_b9_TO70_CI67 },
1061 { TO70, CI66, state_b9_TO70_CI66 },
1062 { TO80, CE18, L204 },
1063 { TO80, CE05, state_b9_TO80_CE05 },
1064 { TO65, CE11, not_L206 },
1065 { TI05, CI05, L204 },
1066 { TI05, CI02, not_L206 },
1067 { TI06, CU13, state_b9_TI06_CU13 },
1068 { TI10, CE09, state_b9_TI10_CE09 },
1069 { END_OF_STATUS },
1070};
1071
1072/* Write-back condition for states ea/eb.
1073 *
1074 * The original condition read BIT(rL2,7) || PC011, but that causes a
1075 * spurious mem[V2]=0 write when the machine reaches state_ea via the
1076 * peripheral-load path (b8-WAIT → ea). During a channel-1 INPUT
1077 * (bootstrap/load) operation PC011=1 and rL2[7]=0, so the old condition
1078 * fired unconditionally and clobbered the just-loaded data.
1079 *
1080 * The write-back is only meaningful for OUTPUT transfers (rL2 bit 7 = L207
1081 * set), where the CPU had previously read memory destructively and now needs
1082 * to restore it. For INPUT transfers (peripheral → memory, L207=0) no
1083 * destructive read occurred, so no write-back is needed.
1084 *
1085 * Rename: the function used BIT(rL2,7) which is L207 (output-transfer flag),
1086 * not L206 (bit 6). Correct the name and drop the spurious PC011 term.
1087 */
1088static uint8_t L207_output_writeback(struct ge *ge) { return BIT(ge->rL2, 7); }
1089
1090static const struct msl_timing_chart state_ea[] = {
1091 { TO10, CO18, 0 },
1092 { TO10, CO97, 0, DI11A0 },
1093 { TO10, CO96, 0, DI11A0 },
1094 { TO10, CO95, 0, DI11A0 },
1095 { TO10, CO94, 0 },
1096 { TO10, CO93, 0, DI11A0 },
1097 { TO10, CO92, 0, DI11A0 },
1098 { TO10, CO91, 0 },
1099 { TO10, CO90, 0, DI11A0 },
1100 { TO10, CO40, 0, DI11A0 },
1101 { TO10, CO41, 0, DI11A0 },
1102 { TO25, CO31, L207_output_writeback },
1103 { TO30, CI11, 0 },
1104 { TO40, CO02, 0, DI11A0 },
1105 { TO50, CI33, 0, DI83A0 },
1106 { TI06, CU00, 0 },
1107 { END_OF_STATUS, 0, 0 },
1108};
1109
1110
1111static uint8_t state_eb_TI06_CI75(struct ge *ge) {
1112 return ((RIG3(ge) && BIT(ge->rL2, 7)) ||
1113 (RIG1(ge) && PC011(ge) && !ge->RACI));
1114}
1115
1116static uint8_t state_eb_TI06_CE19(struct ge *ge) { return 0; }
1117
1118static const struct msl_timing_chart state_eb[] = {
1119 { TO10, CO12, 0, DA25A0 },
1120 { TO10, CO97, 0, DI11A0 },
1121 { TO10, CO96, 0, DI11A0 },
1122 { TO10, CO95, 0, DI11A0 },
1123 { TO10, CO94, 0 },
1124 { TO10, CO93, 0, DI11A0 },
1125 { TO10, CO92, 0, DI11A0 },
1126 { TO10, CO91, 0 },
1127 { TO10, CO90, 0, DI11A0 },
1128 { TO10, CO04, 0, DI11A0 },
1129 { TO10, CO41, 0, DI11A0 },
1130 { TO25, CO31, L207_output_writeback },
1131 { TO30, CI11, 0 },
1132 { TO40, CO02, 0, DI11A0 },
1133 { TO50, CI32, 0, DI82A0 },
1134 { TO50, CE06, L207 },
1135 { TI06, CI75, state_eb_TI06_CI75, ED91A0 },
1136 { TI06, CE19, state_eb_TI06_CE19 },
1137 { TI06, CU00, 0 },
1138 { TI06, CU13, 0, DI82A0 },
1139 { END_OF_STATUS, 0, 0 },
1140};
Bit manipulation helpers.
#define BIT(V, X)
Definition bit.h:9
static void EXEC_NI(struct ge *ge)
static void INT_F0(struct ge *ge)
static void INT_C3(struct ge *ge)
static void CI73(struct ge *ge)
static void CE08(struct ge *ge)
static void CI02(struct ge *ge)
static void CI08(struct ge *ge)
static void EXEC_SMR(struct ge *ge)
static void CE01(struct ge *ge)
static void CU05(struct ge *ge)
static void CI39(struct ge *ge)
static void INT_D3(struct ge *ge)
static void INT_C2(struct ge *ge)
static void CO49(struct ge *ge)
static void CO04(struct ge *ge)
static void CE11(struct ge *ge)
static void CO14(struct ge *ge)
static void CE18(struct ge *ge)
static void CI21(struct ge *ge)
static void CI20(struct ge *ge)
static void CO00(struct ge *ge)
static void CU12(struct ge *ge)
static void CI00s(struct ge *ge)
static void CI66(struct ge *ge)
static void CI19(struct ge *ge)
static void CE10(struct ge *ge)
static void CI74(struct ge *ge)
static void CI17(struct ge *ge)
static void CU00(struct ge *ge)
static void CO35(struct ge *ge)
static void CI15(struct ge *ge)
static void INT_D1(struct ge *ge)
static void EXEC_STR(struct ge *ge)
static void CU06(struct ge *ge)
static void CE03(struct ge *ge)
static void CI70(struct ge *ge)
static void CU07(struct ge *ge)
static void INT_C0(struct ge *ge)
static void INDEX_NEXT(struct ge *ge)
static void CE00(struct ge *ge)
static void CO01(struct ge *ge)
static void CI11(struct ge *ge)
static void INT_D2(struct ge *ge)
static void CU02(struct ge *ge)
static void CI06(struct ge *ge)
static void CI32(struct ge *ge)
static void CI65(struct ge *ge)
static void CI75(struct ge *ge)
static void EXEC_INDEX(struct ge *ge)
static void CU13(struct ge *ge)
static void CE07(struct ge *ge)
static void INT_D0(struct ge *ge)
static void CI80(struct ge *ge)
static void CI07(struct ge *ge)
static void EXEC_AMR(struct ge *ge)
static void CI81(struct ge *ge)
static void CU17(struct ge *ge)
static void CO96(struct ge *ge)
static void INDEX_OP2(struct ge *ge)
static void CI60(struct ge *ge)
static void EXEC_CMI(struct ge *ge)
static void EXEC_TM(struct ge *ge)
static void CI86(struct ge *ge)
static void CE06(struct ge *ge)
static void CO94(struct ge *ge)
static void CU20(struct ge *ge)
static void CO48(struct ge *ge)
static void CE16(struct ge *ge)
static void CO91(struct ge *ge)
static void EXEC_MVI(struct ge *ge)
static void CI05(struct ge *ge)
static void CI82(struct ge *ge)
static void CE09(struct ge *ge)
static void CI84(struct ge *ge)
static void CI72(struct ge *ge)
static void CU01(struct ge *ge)
static void CO90(struct ge *ge)
static void EXEC_CI(struct ge *ge)
static void SS_TO_ALPHA(struct ge *ge)
static void CE02(struct ge *ge)
static void EXEC_LR(struct ge *ge)
static void CI04(struct ge *ge)
static void CI88(struct ge *ge)
static void CI83(struct ge *ge)
static void CI41(struct ge *ge)
static void CO18(struct ge *ge)
static void CO40(struct ge *ge)
static void CI09(struct ge *ge)
static void CI89(struct ge *ge)
static void CU10(struct ge *ge)
static void CI62(struct ge *ge)
static void CI38(struct ge *ge)
static void CI03(struct ge *ge)
static void CI77(struct ge *ge)
static void CU14(struct ge *ge)
static void CO11(struct ge *ge)
static void EXEC_LPSR(struct ge *ge)
static void CU16(struct ge *ge)
static void CO12(struct ge *ge)
static void CI87(struct ge *ge)
static void CI85(struct ge *ge)
static void CO97(struct ge *ge)
static void CO30(struct ge *ge)
static void CI67(struct ge *ge)
static void CI40(struct ge *ge)
static void CI00(struct ge *ge)
static void CI33(struct ge *ge)
static void CO41(struct ge *ge)
static void CO92(struct ge *ge)
static void EXEC_XI(struct ge *ge)
static void CO13(struct ge *ge)
static void EXEC_CMR(struct ge *ge)
static void CO10(struct ge *ge)
static void CO31(struct ge *ge)
static void CE05(struct ge *ge)
static void CU11(struct ge *ge)
static void EXEC_SS(struct ge *ge)
static void INDEX_OP1(struct ge *ge)
static void CU03(struct ge *ge)
static void CE19(struct ge *ge)
static void CO93(struct ge *ge)
static void CI76(struct ge *ge)
static void EXEC_LA(struct ge *ge)
static void INT_C1(struct ge *ge)
static void CO95(struct ge *ge)
static void CE_chan1_status(struct ge *ge)
static void CI34(struct ge *ge)
static void CI16(struct ge *ge)
static void CI12(struct ge *ge)
static void CI78(struct ge *ge)
static void CI71(struct ge *ge)
static void CO02(struct ge *ge)
static void CU15(struct ge *ge)
static void CU04(struct ge *ge)
static void CI01(struct ge *ge)
static void JRT_LINK(struct ge *ge)
static uint8_t state_E2_E3_TI06_CI82(struct ge *ge)
Definition msl-states.c:109
static uint8_t is_ci(struct ge *ge)
Definition msl-states.c:443
static uint8_t jc_js1_js2_jie_lon_loll_loff_ins_ens_nop(struct ge *ge)
Definition msl-states.c:464
static uint8_t AF52_not_RO07(struct ge *ge)
Definition msl-states.c:573
static uint8_t state_E7_TI06_CU17(struct ge *ge)
Definition msl-states.c:291
static uint8_t not_RO06(struct ge *ge)
Definition msl-states.c:29
static uint8_t state_ab_TI05_CI04(struct ge *ge)
Definition msl-states.c:928
static uint8_t state_00_TO50_CI33(struct ge *ge)
Definition msl-states.c:544
static uint8_t state_cc_TI06_CU11_busy(struct ge *ge)
Definition msl-states.c:773
static uint8_t state_cc_TI06_CU04(struct ge *ge)
Definition msl-states.c:781
static uint8_t is_mvi(struct ge *ge)
Definition msl-states.c:441
static uint8_t is_la(struct ge *ge)
Definition msl-states.c:458
static uint8_t addr_absolute(struct ge *ge)
Definition msl-states.c:38
static uint8_t is_smr(struct ge *ge)
Definition msl-states.c:457
static uint8_t state_b9_TO40_CO01(struct ge *ge)
static uint8_t L207_output_writeback(struct ge *ge)
static uint8_t state_dc_TI06_CI70(struct ge *ge)
Definition msl-states.c:735
static const struct msl_timing_chart state_E7[]
Definition msl-states.c:295
static const struct msl_timing_chart state_cc[]
Definition msl-states.c:793
static const struct msl_timing_chart state_db[]
Definition msl-states.c:715
static uint8_t state_80_TO30_CO97(struct ge *ge)
Definition msl-states.c:73
static const struct msl_timing_chart state_80[]
Definition msl-states.c:77
static uint8_t state_00_TO30_CI15(struct ge *ge)
Definition msl-states.c:543
static uint8_t ins(struct ge *ge)
Definition msl-states.c:411
static const struct msl_timing_chart state_d8[]
Definition msl-states.c:674
static uint8_t is_lr(struct ge *ge)
Definition msl-states.c:453
static const struct msl_timing_chart state_D3[]
Definition msl-states.c:383
static uint8_t state_ca_TO80_CE18(struct ge *ge)
Definition msl-states.c:858
static uint8_t state_c8_TI06_CI85(struct ge *ge)
Definition msl-states.c:641
static const struct msl_timing_chart state_E2_E3[]
Definition msl-states.c:117
static uint8_t state_b8_TI06_CI72(struct ge *ge)
Definition msl-states.c:956
static uint8_t lon_loll(struct ge *ge)
Definition msl-states.c:404
static uint8_t state_b9_TO70_CI66(struct ge *ge)
static uint8_t is_ni(struct ge *ge)
Definition msl-states.c:442
static uint8_t state_E4_TO70_CI60(struct ge *ge)
Definition msl-states.c:211
static uint8_t not_RO03(struct ge *ge)
Definition msl-states.c:26
static const struct msl_timing_chart state_C2[]
Definition msl-states.c:386
static uint8_t is_amr(struct ge *ge)
Definition msl-states.c:456
static uint8_t state_eb_TI06_CE19(struct ge *ge)
static uint8_t AF52_not_RO00(struct ge *ge)
Definition msl-states.c:566
static const struct msl_timing_chart state_ea[]
static uint8_t not_RO00(struct ge *ge)
Definition msl-states.c:23
static const struct msl_timing_chart state_E6[]
Definition msl-states.c:240
static uint8_t state_b9_TO30_CI12(struct ge *ge)
static const struct msl_timing_chart state_0c[]
Definition msl-states.c:843
static const struct msl_timing_chart state_D2[]
Definition msl-states.c:382
static uint8_t state_b9_TO80_CE05(struct ge *ge)
static const struct msl_timing_chart state_EF_EE[]
Definition msl-states.c:363
static uint8_t state_eb_TI06_CI75(struct ge *ge)
static const struct msl_timing_chart state_D0[]
Definition msl-states.c:384
static uint8_t state_cc_TI06_CI75(struct ge *ge)
Definition msl-states.c:785
static uint8_t AF52_not_RO05(struct ge *ge)
Definition msl-states.c:571
static const struct msl_timing_chart state_C3[]
Definition msl-states.c:387
static const struct msl_timing_chart state_c8[]
Definition msl-states.c:651
static const struct msl_timing_chart state_02[]
Definition msl-states.c:824
static uint8_t pm_imm_exec(struct ge *ge)
Definition msl-states.c:447
static const struct msl_timing_chart state_ca[]
Definition msl-states.c:862
static const struct msl_timing_chart state_F0[]
Definition msl-states.c:381
static uint8_t state_E0_TI06_CU17(struct ge *ge)
Definition msl-states.c:145
static uint8_t state_dc_TI06_CU20(struct ge *ge)
Definition msl-states.c:739
static uint8_t state_b8_TI10_CE09(struct ge *ge)
Definition msl-states.c:958
static const struct msl_timing_chart state_08[]
Definition msl-states.c:578
static uint8_t state_E6_TO80_CI38(struct ge *ge)
Definition msl-states.c:232
static const struct msl_timing_chart state_da[]
Definition msl-states.c:704
static uint8_t state_cc_TI06_CU05(struct ge *ge)
Definition msl-states.c:777
static uint8_t is_tm(struct ge *ge)
Definition msl-states.c:446
static const struct msl_timing_chart state_aa[]
Definition msl-states.c:906
static uint8_t loff(struct ge *ge)
Definition msl-states.c:423
static const struct msl_timing_chart state_E5[]
Definition msl-states.c:269
static uint8_t not_RO01(struct ge *ge)
Definition msl-states.c:24
static uint8_t is_cmr(struct ge *ge)
Definition msl-states.c:455
static const struct msl_timing_chart state_E0[]
Definition msl-states.c:149
static uint8_t is_pmm(struct ge *ge)
Definition msl-states.c:340
static uint8_t not_RO07(struct ge *ge)
Definition msl-states.c:30
static const struct msl_timing_chart state_d9[]
Definition msl-states.c:691
static const struct msl_timing_chart state_ab[]
Definition msl-states.c:931
static uint8_t state_d9_TO40_CO00(struct ge *ge)
Definition msl-states.c:687
static uint8_t not_RO05(struct ge *ge)
Definition msl-states.c:28
static const struct msl_timing_chart state_ED_EC[]
Definition msl-states.c:357
static const struct msl_timing_chart state_C0[]
Definition msl-states.c:388
static uint8_t state_E6_TI06_CU17(struct ge *ge)
Definition msl-states.c:235
static uint8_t state_b9_TI06_CU13(struct ge *ge)
static const struct msl_timing_chart state_a9[]
Definition msl-states.c:887
static uint8_t jc_js1_js2_jie_condition_verified(struct ge *ge)
Definition msl-states.c:427
static uint8_t state_ab_TO80_CE18(struct ge *ge)
Definition msl-states.c:921
static uint8_t DU97_or_DU98(struct ge *ge)
Definition msl-states.c:957
static uint8_t AINI(struct ge *ge)
Definition msl-states.c:46
static const struct msl_timing_chart state_C1[]
Definition msl-states.c:389
static uint8_t is_str(struct ge *ge)
Definition msl-states.c:454
static uint8_t state_cc_TI06_CU01(struct ge *ge)
Definition msl-states.c:789
static uint8_t per_peri(struct ge *ge)
Definition msl-states.c:471
static uint8_t is_ss_data_op(struct ge *ge)
Definition msl-states.c:169
static uint8_t state_d8_TO40_CO00(struct ge *ge)
Definition msl-states.c:670
static uint8_t state_ab_TI05_CI03(struct ge *ge)
Definition msl-states.c:929
static uint8_t jie(struct ge *ge)
Definition msl-states.c:415
static uint8_t is_eper_examine(struct ge *ge)
Definition msl-states.c:483
static uint8_t is_lpsr(struct ge *ge)
Definition msl-states.c:459
static uint8_t state_b9_TI10_CE09(struct ge *ge)
static uint8_t state_b9_TO25_CO31(struct ge *ge)
static uint8_t state_00_TO10_CO11(struct ge *ge)
Definition msl-states.c:542
static uint8_t state_80_TO30_CO96(struct ge *ge)
Definition msl-states.c:69
static uint8_t state_E7_TI06_CU03(struct ge *ge)
Definition msl-states.c:289
static uint8_t state_E2_E3_TI06_CU04(struct ge *ge)
Definition msl-states.c:113
static uint8_t addr_modified(struct ge *ge)
Definition msl-states.c:37
static uint8_t state_ab_TO70_CI62(struct ge *ge)
Definition msl-states.c:919
static uint8_t AF52_not_RO06(struct ge *ge)
Definition msl-states.c:572
static uint8_t state_00_TO10_CO10(struct ge *ge)
Definition msl-states.c:541
static uint8_t jc_js1_js2_jie(struct ge *ge)
Definition msl-states.c:394
static uint8_t per_peri_TO25_CO30(struct ge *ge)
Definition msl-states.c:477
static uint8_t state_E2_E3_TO80_CI89(struct ge *ge)
Definition msl-states.c:104
static uint8_t AF52_not_RO01(struct ge *ge)
Definition msl-states.c:567
static uint8_t state_cc_TI06_CU13(struct ge *ge)
Definition msl-states.c:760
static uint8_t AF52_not_RO02(struct ge *ge)
Definition msl-states.c:568
static uint8_t not_RO04(struct ge *ge)
Definition msl-states.c:27
static uint8_t state_d8_TO19_CE02(struct ge *ge)
Definition msl-states.c:666
static void INDEX_DONE(struct ge *ge)
Definition msl-states.c:342
static const struct msl_timing_chart state_E4[]
Definition msl-states.c:213
static uint8_t AF52_not_RO04(struct ge *ge)
Definition msl-states.c:570
static uint8_t state_E7_TO80_CI38(struct ge *ge)
Definition msl-states.c:288
static uint8_t state_E6_TI06_CU03(struct ge *ge)
Definition msl-states.c:233
static const struct msl_timing_chart state_64_65[]
Definition msl-states.c:495
static const struct msl_timing_chart state_00[]
Definition msl-states.c:548
static const struct msl_timing_chart state_b8[]
Definition msl-states.c:970
static uint8_t nop(struct ge *ge)
Definition msl-states.c:431
static const struct msl_timing_chart state_D1[]
Definition msl-states.c:385
static const struct msl_timing_chart state_a8[]
Definition msl-states.c:874
static uint8_t ens(struct ge *ge)
Definition msl-states.c:419
static uint8_t not_RO02(struct ge *ge)
Definition msl-states.c:25
static uint8_t is_jrt(struct ge *ge)
Definition msl-states.c:435
static uint8_t is_xi(struct ge *ge)
Definition msl-states.c:445
static uint8_t not_AINI(struct ge *ge)
Definition msl-states.c:47
static const struct msl_timing_chart state_b9[]
static uint8_t state_b9_TO70_CI67(struct ge *ge)
static const struct msl_timing_chart state_dc[]
Definition msl-states.c:743
static uint8_t pm_reg_exec(struct ge *ge)
Definition msl-states.c:460
static uint8_t is_cmi(struct ge *ge)
Definition msl-states.c:444
static const struct msl_timing_chart state_b1[]
Definition msl-states.c:989
static const struct msl_timing_chart state_eb[]
static uint8_t AF52_not_RO03(struct ge *ge)
Definition msl-states.c:569
static uint8_t state_cc_TO50_CE00(struct ge *ge)
Definition msl-states.c:755
#define JCC_OPCODE
Definition opcodes.h:41
#define LON_OPCODE
Definition opcodes.h:18
#define LOFF_OPCODE
Definition opcodes.h:15
#define SP_OPCODE
Definition opcodes.h:75
#define ENS_OPCODE
Definition opcodes.h:9
#define AB_OPCODE
Definition opcodes.h:84
#define LPSR_OPCODE
Definition opcodes.h:50
#define XC_OPCODE
Definition opcodes.h:65
#define NC_OPCODE
Definition opcodes.h:62
#define SD_OPCODE
Definition opcodes.h:83
#define LOFF_2NDCHAR
Definition opcodes.h:16
#define SL_OPCODE
Definition opcodes.h:69
#define CMP_OPCODE
Definition opcodes.h:73
#define MP_OPCODE
Definition opcodes.h:76
#define PERI_OPCODE
Definition opcodes.h:49
#define LON_2NDCHAR
Definition opcodes.h:19
#define CMC_OPCODE
Definition opcodes.h:63
#define UPK_OPCODE
Definition opcodes.h:66
#define NI_OPCODE
Definition opcodes.h:45
#define JS1_2NDCHAR
Definition opcodes.h:36
#define INS_OPCODE
Definition opcodes.h:12
#define INS_2NDCHAR
Definition opcodes.h:13
#define PKS_OPCODE
Definition opcodes.h:78
#define STR_OPCODE
Definition opcodes.h:53
#define AD_OPCODE
Definition opcodes.h:82
#define JRT_OPCODE
Definition opcodes.h:38
#define OC_OPCODE
Definition opcodes.h:64
#define DP_OPCODE
Definition opcodes.h:77
#define SB_OPCODE
Definition opcodes.h:85
#define HLT_OPCODE
Definition opcodes.h:25
#define JIE_OPCODE
Definition opcodes.h:29
#define XI_OPCODE
Definition opcodes.h:48
#define LR_OPCODE
Definition opcodes.h:54
#define JC_OPCODE
Definition opcodes.h:39
#define PER_OPCODE
Definition opcodes.h:51
#define CMI_OPCODE
Definition opcodes.h:46
#define MVC_OPCODE
Definition opcodes.h:61
#define AP_OPCODE
Definition opcodes.h:74
#define JS2_OPCODE
Definition opcodes.h:32
#define EDT_OPCODE
Definition opcodes.h:71
#define MVI_OPCODE
Definition opcodes.h:44
#define SMR_OPCODE
Definition opcodes.h:57
#define PK_OPCODE
Definition opcodes.h:68
#define NOP2_OPCODE
Definition opcodes.h:24
#define JU_OPCODE
Definition opcodes.h:40
#define SR_OPCODE
Definition opcodes.h:67
#define TL_OPCODE
Definition opcodes.h:70
#define MVQ_OPCODE
Definition opcodes.h:80
#define MVP_OPCODE
Definition opcodes.h:72
#define LOLL_OPCODE
Definition opcodes.h:21
#define JS1_OPCODE
Definition opcodes.h:35
#define AMR_OPCODE
Definition opcodes.h:56
#define LA_OPCODE
Definition opcodes.h:42
#define CI_OPCODE
Definition opcodes.h:47
#define CMQ_OPCODE
Definition opcodes.h:81
#define ENS_2NDCHAR
Definition opcodes.h:10
#define JS2_2NDCHAR
Definition opcodes.h:33
#define RDC_OPCODE
Definition opcodes.h:52
#define CMR_OPCODE
Definition opcodes.h:55
#define TM_OPCODE
Definition opcodes.h:43
#define JIE_2NDCHAR
Definition opcodes.h:30
#define UPKS_OPCODE
Definition opcodes.h:79
Signals.
#define SIG(name)
Definition signals.h:17
The entire state of the emulated system, including registers, memory, peripherals and timings.
Definition ge.h:96
uint8_t RINT
Definition ge.h:364
uint8_t ALOI
Load connector selection.
Definition ge.h:285
uint8_t AINI
Program Loading.
Definition ge.h:278
uint8_t ffFA
Special conditions register 2.
Definition ge.h:263
uint8_t future_state
Future state.
Definition ge.h:546
uint16_t rRO
Multipurpose 8+1 bit register.
Definition ge.h:171
uint8_t PUC3
Channel 3 in transfer.
Definition ge.h:418
uint8_t rL2
Auxiliary register.
Definition ge.h:155
uint8_t AVER
Jump Condition Verified.
Definition ge.h:343
uint8_t RACI
Rejected Command.
Definition ge.h:532
uint16_t rL1
Length of the operand.
Definition ge.h:154
uint8_t RIG1
End from controller 1.
Definition ge.h:527
uint8_t RIG3
Definition ge.h:529
uint8_t rFO
Current function code.
Definition ge.h:195
uint8_t SA00
First-vs-second operand flag for address modification.
Definition ge.h:354
Timing chart row.
Definition msl-timings.h:15