GE-115 Emulator
An Emulator of the General Electrics GE-115 computer
ge.c
Go to the documentation of this file.
1#include <stdint.h>
2#include <stddef.h>
3#include <string.h>
4#include <unistd.h>
5#include "ge.h"
6#include "signals.h"
7#include "msl.h"
8#include "console_socket.h"
9#include "peripherical.h"
10#include "log.h"
11
12#define MAX_PROGRAM_STORAGE_WORDS 129
13
14void ge_init(struct ge *ge)
15{
16 memset(ge, 0, sizeof(*ge));
17 /* Strapped as the machine at Electric Dreams, per the physical card
18 * identification of 2026-07-21: 0618034Z reads PONT2N on the board, and
19 * 0618035V is electrically a PONT2N as well (different part code, same
20 * strap). E03 = PONT2N is the UCE 468 row of TAB.1 (2 usec, MAX), so
21 * the assumed model survives the re-identification; F03 = PONT2N flips
22 * TAB.2 to "interruption enabled on connector 3" (it was modelled as
23 * connector 4). E04/F04 are believed empty, pending a physical check.
24 *
25 * (2026-07-21: the F03 card was found and restuffed; all four option
26 * sockets hold the same 4-bridge card type, annotated PONT2N.
27 * 2026-07-22: the cards' own catalog drawing was found -- cp10F dwg
28 * 015 433 91 -- and settles the type: PONT 2N is a FOUR-bridge recipe
29 * (holes 3/20/21/25) shorting pins {1,2,4,7} to 17, PONT 2P likewise
30 * four bridges differing in one (pin 3 for pin 4). The in-machine
31 * cards match the 2N recipe, which retires the {1,3,4}-union reading;
32 * the pure-N strapping below stands. Final electrical seal: pin 1<->4
33 * beeps (2N) and pin 1<->3 does not. docs/hardware-options.md.)
34 *
35 * Card 05, the memory-capacity pair, is the machine's OWNER's reading
36 * (2026-07-31): the boards say **32K**, which is TAB.1's printed
37 * {E05, F05} = {PONT2N, PONT2P} row -- UCE 464, (VAMA2,VEMB6,VAMC2) =
38 * (0,0,0) -- and it agrees with the physical build (2x MEM470 mounted,
39 * Q30/Q31 read amplifiers populated: docs/hardware-options.md). It
40 * supersedes the 2026-07-21 photo reading of BOTH 05 cards as PONT2N,
41 * which landed off the ch.001 table at (1,0,0) and bounded the machine
42 * at 16K -- a bound that made every deck stop short of the memory it
43 * has, and that no printed row defines. If a card is ever re-buzzed and
44 * F05 really is a 2N, flip it back here and the ch.080 gates will bound
45 * the machine again without anything else changing. */
46 ge->options.E03 = PONT_2N; /* UCE 468: 2 usec, MAX */
47 ge->options.F03 = PONT_2N; /* interruption enabled on connector 3 */
48 ge->options.F04 = PONT_NONE; /* empty = the interrupts-enabled variant */
49 ge->options.E04 = PONT_NONE; /* loading enabled on connectors 2 and 3 */
50 ge->options.E05 = PONT_2N; /* UCE 464: 32K core, TAB.1's {N,P} row */
51 ge->options.F05 = PONT_2P; /* -> (VAMA2,VEMB6,VAMC2) = (0,0,0) */
52
53 ge->ALTO = 1; /* stopped until CLEAR + START */
54 ge->powered = 1;
56
57 ge->ST3.name = "ST3";
58 ge->ST4.name = "ST4";
59
60 ge->channel2.name = "CAN2";
61
62 /* Power-on, and ONLY power-on, establishes the identity change registers.
63 * They are core cells at 0x00F0-0x00FE; core retains, so CLEAR must not
64 * touch them (see ge_clear). A machine that has been powered up all day
65 * holds whatever the last program left there -- which is exactly how the
66 * bench found a compiled program's frame pointer landing at 0x0600 instead
67 * of the assumed 0x6000. */
69}
70
71/*
72 * Resolve every strapped option and report it once, at CLEAR.
73 *
74 * The FUL / FEL / VAM / INES signals are not free-standing settings: each is
75 * a level produced by a jumper card in a backplane connector, so the only
76 * thing that is really configured is which cards are fitted where. This maps
77 * that to the signals the logic actually reads, which is what you want when
78 * comparing gemu against a physical machine -- the levels here should match
79 * what a meter reads on the corresponding connector pins.
80 *
81 * cp06 ch.001 (memory capacity) and ch.002 (version, loading, interruptions);
82 * see docs/hardware-options.md.
83 */
84static const char *pont_name(enum ge_pont p)
85{
86 switch (p) {
87 case PONT_2N: return "PONT2N";
88 case PONT_2P: return "PONT2P";
89 default: return "(empty)";
90 }
91}
92
93void ge_log_options(struct ge *ge)
94{
95 {
96 /* Capacity is the gate-derived ch.080 bound, which is defined for
97 * every strap combination; flag the ones the ch.001 table does not
98 * print, since they are configurations the factory never shipped. */
99 uint8_t a = VAMA2(ge), b = VEMB6(ge), c = VAMC2(ge);
100 uint8_t printed = (a && b) || (!a && !b) || (a && !b && c);
101 ge_log(LOG_DEBUG, "options: UCE %u processor, %u ns cycle, %s set; "
102 "%uK core%s\n",
104 ge_cpu_version_uce(ge) == 466 ? "MIN" : "MAX",
106 printed ? "" : " (off-table straps, bound per ch.080)");
107 }
108
109 ge_log(LOG_DEBUG, "options: straps E03=%s E04=%s E05=%s "
110 "F03=%s F04=%s F05=%s S42=%s\n",
114 ge->options.S42_diag ? "DIAG" : "normal");
115
116 /* ch.002: loading, version and the FUL4 pair. */
117 ge_log(LOG_DEBUG, "options: FUL26=%u FUL36=%u -> load on connectors %s; "
118 "FEL06=%u FEL16=%u FUL4G=%u FUL4F=%u\n",
119 FUL26(ge), FUL36(ge),
120 FUL26(ge) ? (FUL36(ge) ? "2 and 3" : "2 and 4") : "4 and 3",
121 FEL06(ge), FEL16(ge), FUL4G(ge), FUL4F(ge));
122
123 /* ch.002 TAB.2: interruption-enabled connectors. */
124 ge_log(LOG_DEBUG, "options: INES3=%u INES4=%u -> interruptions %s\n",
125 INES3(ge), INES4(ge),
126 (INES3(ge) && INES4(ge)) ? "on connectors 3 and 4" :
127 INES3(ge) ? "on connector 3" :
128 INES4(ge) ? "on connector 4" : "disabled");
129
130 /* ch.001: memory capacity selection. */
131 ge_log(LOG_DEBUG, "options: VAMA2=%u VEMB6=%u VAMC2=%u "
132 "(VAMA1=%u VAMB1=%u VAMC1=%u)\n",
133 VAMA2(ge), VEMB6(ge), VAMC2(ge),
134 VAMA1(ge), VAMB1(ge), VAMC1(ge));
135}
136
137void ge_clear(struct ge *ge)
138{
139 ge->AINI = 0;
140 ge->ALAM = 0;
141 ge->PODI = 0;
142 ge->ADIR = 0;
143 ge->ACIC = 1;
144
145 /* After the powering on of the machine the timing starts pressing the
146 * "CLEAR" switch (cpu fo. 99). The delay line runs; the CPU does not --
147 * ALTO is set just below, and START (cpu fo. 97) is what releases it. */
148
149 /* (One of) the possible set conditions (is): or with
150 * "CLEAR" and.. (cpu fo. 98) */
151 ge->ALTO = 1;
152
153 /* By pressing "CLEAR" tje FF RC01, RC02, RC03 are reset and the FF
154 * RC00 is set. (cpu fo. 115) */
155 ge->RC00 = 1;
156 ge->RC01 = 0;
157 ge->RC02 = 0;
158 ge->RC03 = 0;
159
160 /* REGEN: general clear of the integrated-reader command/mode latches (the
161 * controller's reset line). Pulse `regen` and drop the CPU->reader command
162 * lines + the CPU-selected read mode so a CLEAR returns the reader to its
163 * power-up state. (Inert: the data path and the harness-selected transcode
164 * mode are unaffected; active_valid==0 keeps the harness mode in force.) */
177 ge->integrated_reader.luren = 0; /* transcoder/jam error: an error condition */
178 ge->PEC1_pending = 0;
179
180 /* "Clears all error conditions" (CPU[4] §3.3). These are the two the
181 * operator panel shows, and the reason the manual says CLEAR is *required*
182 * after MEM CHECK: the fault latches are what stops the subsystem, and
183 * nothing else in the machine takes them down. MEM CHECK is the parity
184 * fault (pulse.c on_TO50), INV ADD the address-past-installed-core fault
185 * (both memory phases) -- neither is a momentary condition, so leaving them
186 * standing across a CLEAR left the panel lit for a fault the operator had
187 * already acknowledged. */
188 ge->mem_check = 0;
189 ge->inv_add = 0;
190
191 /* The condition flip-flops are part of the preset state: FI carries the
192 * 2-bit condition code the jumps test (alu_cc.c) and FA its console-visible
193 * copy, and a machine just cleared must not answer a JC with the last
194 * program's result. */
195 ge->ffFI = 0;
196 ge->ffFA = 0;
197 ge->JE = 0;
198
199 /* The channel latches go with them. RIG1 is "end from controller 1", set
200 * when a transfer's last character arrives (reader.c, with FININ) and
201 * normally taken down by CE03 inside the next order -- which the load
202 * sequence never issues. Left standing it says the transfer that has not
203 * started yet has already finished, so the IPL reads nothing: a second deck
204 * could not be loaded without powering the machine off, which is not a
205 * machine anyone could work with. The operator loads deck after deck, and
206 * CLEAR between them is what makes that possible. RACI (rejected command)
207 * and RECE (selection check) are error conditions in the same breath. */
208 ge->RIG1 = 0;
209 ge->RIG3 = 0;
210 ge->RACI = 0;
211 ge->RAVI = 0;
212 ge->RECE = 0;
213 ge->PEC1 = 0;
214
215 /* And the working registers, which is the rest of what "presets the CPU to
216 * a defined state" has to mean. They are not core: V1-V4 stage operand
217 * addresses within a cycle, L1-L3 lengths, FO the opcode being executed, RO
218 * the memory data register (cleared at TO20 of every cycle anyway). The
219 * program addresser PO is deliberately NOT among them -- the first START
220 * after CLEAR runs the program from where it is parked.
221 *
222 * This is what a second LOAD needs. The bootstrap builds its order out of
223 * the knot, and the knot is fed by these: with the last run's values still
224 * in them the load read an order of 0x41 -- one bit off "read unchanged",
225 * an anomaly at the reader -- and the machine sat in the input wait having
226 * asked for nothing. A machine you cannot load twice without switching it
227 * off is not the machine. */
228 ge->rV1 = ge->rV2 = ge->rV3 = ge->rV4 = 0;
229 ge->rL1 = ge->rL3 = 0;
230 ge->rL2 = 0;
231 ge->rFO = 0;
232 ge->rRO = 0;
233 ge->rBO = 0;
234
235 /* The program addresser goes to zero with them, and this is the row that
236 * makes CLEAR -> LOAD -> START work twice.
237 *
238 * LOAD "sets AINI and nothing else" (CPU[4] §3.3), so it is CLEAR that has
239 * to leave the machine somewhere the bootstrap can start: the IPL reads one
240 * card to 0x0000 and executes it there, and gemu builds the load's
241 * addresses out of the knot, which the display sequence feeds with PO. With
242 * the last program's PO still standing -- 0x010c, where print.cap halts --
243 * the load went looking for its order block up there and asked the reader
244 * for 0x41 instead of 0x40: one bit off "read unchanged", an anomaly at the
245 * reader, and the machine sat in the input wait having asked for nothing.
246 * A deck could be loaded once per power-on.
247 *
248 * Resuming a halted program is unaffected: that is START on its own, which
249 * is what an operator presses. CLEAR is how you say start over -- and the
250 * engineer keying an address into PO does it after the CLEAR, not before. */
251 ge->rPO = 0;
252
253 /* And the defined state the sequencer is preset TO is the display state.
254 *
255 * This is the one that bites the operator. A HLT parks the machine
256 * mid-phase -- SO = e0 with the halted instruction still in FO -- and
257 * without this the stale phase survives the CLEAR: the next START finishes
258 * the OLD instruction, consuming whatever the operator has just forced into
259 * PO as its operand address, and the program runs from two bytes past
260 * wherever it was told to start. Changing PO from the console then does
261 * nothing, which is not what the panel is for (CPU[4] §4.2's rotary table
262 * exists to key PO and run from it).
263 *
264 * 00 is where a stopped GE-120 sits: the display sequence, which is what
265 * puts the registers on the panel lamps. Its chart ends in CU07 -> 0x80,
266 * Initialisation, and 0x80 goes to c8 with AINI set (LOAD pressed) or to
267 * the alpha phase without it -- so one START after a CLEAR either runs the
268 * load or fetches the next instruction AT PO, which is exactly what §3.3
269 * says the first START after CLEAR does. */
270 ge->rSO = 0x00;
271 ge->rSA = 0x00;
272 ge->future_state = 0x00;
273
274 /* CLEAR does NOT clear core. It "presets CPU + peripherals to a defined
275 * state" (CPU[4] §3.3) -- flip-flops, not memory. The change registers live
276 * in core at 0x00F0-0x00FE and survive, along with every other byte the
277 * last program wrote. Seeding them here would invent a reset identity the
278 * machine does not have; ge_init does it once, at power-on. */
279
281}
282
283/* Seed the eight change / segment-base registers to their identity defaults
284 * N<<12: change register N is the 16-bit big-endian word at mem[240+2N], and
285 * an instruction address with modifier N (address bits 12-14) resolves to
286 * displacement + base[N]. With these defaults a bare 12-bit displacement
287 * carrying modifier N addresses segment N (0x1000*N ..), so a program's paged
288 * addresses (e.g. JU 0x172a) resolve to their full load addresses; programs
289 * may reload a base via LR/LA for paged access.
290 *
291 * Called by ge_clear (reset) and re-applied after a direct binary image load,
292 * because a contiguous image spanning the 0x00F0-0x00FF window would otherwise
293 * overwrite the bases (with its own bytes, or zeros in reconstructed gaps). */
295{
296 for (int n = 0; n < 8; n++) {
297 uint16_t v = (uint16_t)(n << 12);
298 ge->mem[240 + 2 * n] = (uint8_t)(v >> 8);
299 ge->mem[240 + 2 * n + 1] = (uint8_t)(v & 0xff);
300 ge->cr_cache[n] = v; /* seed the addressing cache to match */
301 }
302}
303
304/* odd-parity bit for a byte: 1 if the byte has an even number of set bits
305 * (so data+parity is odd). Mirrors odd_parity() in pulse.c. */
306static inline uint8_t ge_odd_parity(uint8_t data)
307{
308 return __builtin_parity(data) ? 0 : 1;
309}
310
311/* Store a byte to memory the way every real write does: data + generated odd
312 * parity + mark written. The microcoded path (pulse.c on_TO65) does this for
313 * itself (and honours the INCE check-bit forcing); this helper is for the
314 * hybrid ALU/SS execution helpers (alu_*.c) and the change-register store,
315 * which write ge->mem[] directly and would otherwise leave stale parity and
316 * trip a false MEM CHECK on read-back. */
317void ge_mem_store8(struct ge *ge, uint16_t addr, uint8_t val)
318{
319 ge->mem[addr] = val;
320 ge->mem_parity[addr] = ge_odd_parity(val);
321 ge->mem_written[addr] = 1;
322}
323
324/* Write a flat image into core at `origin`, priming the parity store and
325 * marking the cells written, so reads of it parity-check cleanly.
326 *
327 * NOT A LOAD PATH. The machine takes programs from cards and from nothing else.
328 * This is the bench engineer's hand: test scaffolding, and the model behind the
329 * maintenance panel's memory key-in. Returns 0, or -1 past installed memory. */
330int ge_load_image(struct ge *ge, const uint8_t *image, size_t size,
331 uint16_t origin)
332{
333 uint32_t max = ge->mem_size ? ge->mem_size : MEM_SIZE;
334
335 if (image == NULL && size != 0)
336 return -1;
337 if ((uint32_t)origin + (uint32_t)size > max)
338 return -1;
339
340 for (size_t i = 0; i < size; i++) {
341 uint16_t a = (uint16_t)(origin + i);
342 ge->mem[a] = image[i];
343 ge->mem_parity[a] = ge_odd_parity(image[i]);
344 ge->mem_written[a] = 1;
345 }
346 return 0;
347}
348
349/* Force the sequencer into the alpha (fetch) phase at `entry`.
350 *
351 * NOT A MACHINE OPERATION -- there is no console control that does this. The
352 * real entry is the IPL: CLEAR, LOAD1/2, LOAD, START walks 00 -> 80 -> c8 ...
353 * -> e3 and begins executing the one card it read, at address 0. This helper
354 * exists so unit tests can start a fragment mid-machine without a deck. */
355void ge_enter(struct ge *ge, uint16_t entry)
356{
357 ge->rPO = entry;
358 ge->rSO = 0xe2; /* alpha phase: fetch the instruction at PO */
359 ge->rSA = 0xe2;
360}
361
362void ge_load(struct ge *ge)
363{
364 /* When pressing LOAD button, AINI is set. If AINI is set, the state 80
365 * (initialitiation) goes to state c8, starting the loading of the program
366 * (of max 129 words) from one of the peripherc unit. */
367
368 /* set AINI FF to 1 (pag. 96) */
369 ge->AINI = 1;
370}
371
372void ge_load_1(struct ge * ge)
373{
374 /* It is possible to choose one between the two units thus prepared
375 * positioning the operating console switch LOAD1/LOAD2 (The possible
376 * choices are: Conn.2/Conn.3; Conn.4/Conn.3; Conn.2/Conn.4).
377 *
378 * (cpu fo. 43) */
379
380 /* from the previous manual excerpt, ,i would have expected ALOI = 0t to
381 * be LOAD1 and ALOI = 1 to be LOAD2, but running the initial load tests,
382 * ALOI = 1 will result in the machine using the 0x80 unit name, which is
383 * connector 2, while ALOI = 0 results in a 0x00 unit name, which is
384 * connector 3. */
385
386 ge->ALOI = 1;
387}
388
389void ge_load_2(struct ge * ge)
390{
391 ge->ALOI = 0;
392}
393
394void ge_start(struct ge *ge)
395{
396 /* according to the cpu documents, we should set the flipflop ARES here to
397 * implement the initial loading of 80 into SO, however with the current
398 * implementation it's not needed */
399
400 ge->ALTO = 0; /* cpu fo. 97 */
401}
402
403static void ge_print_well_known_states(uint8_t state) {
404 const char *name;
405 switch (state) {
406 case 0x00:
407 name = "- Display sequence";
408 break;
409 case 0x08:
410 name = "- Forcing sequence";
411 break;
412 case 0x64:
413 case 0x65:
414 name = "- Beta Phase";
415 break;
416 case 0x80:
417 name = "- Initialitiation";
418 break;
419 case 0xE2:
420 case 0xE3:
421 name = "- Alpha Phase";
422 break;
423 case 0xF0:
424 name = "- Interruption";
425 break;
426 default:
427 name = "";
428 }
429
430 ge_log(LOG_STATES, "Running state %02x %s\n", state, name);
431}
432
433const char *ge_clock_name(enum clock c)
434{
435 switch (c) {
436 #define X(name) \
437 case name : \
438 return #name ;
440 #undef X
441 }
442
443 return "";
444}
445
447{
449 return;
451 "SO: %02x SA: %02x PO: %04x RO: %04x BO: %04x FO: %04x - "
452 "V1: %04x V2: %04x V3: %04x V4: %04x - "
453 "L1: %04x L2: %04x L3 : %04x\n",
454 ge->rSO, ge->rSA, ge->rPO, ge->rRO, ge->rBO, ge->rFO,
455 ge->rV1, ge->rV2, ge->rV3, ge->rV4,
456 ge->rL1, ge->rL2, ge->rL3);
457}
458
460{
462 "%s: "
463 "SO: %02x SA: %02x PO: %04x RO: %04x BO: %04x FO: %04x - "
464 "NO: %02x NI: %02x - "
465 "FA: %02x FI: %02x - "
466 "V1: %04x V2: %04x V3: %04x V4: %04x - "
467 "L1: %04x L2: %04x L3 : %04x\n",
469 ge->rSO, ge->rSA, ge->rPO, ge->rRO, ge->rBO, ge->rFO,
470 NO_knot(ge), NI_knot(ge),
471 ge->ffFA, ge->ffFI,
472 ge->rV1, ge->rV2, ge->rV3, ge->rV4,
473 ge->rL1, ge->rL2, ge->rL3);
474}
475
477{
478 ge->current_clock++;
479 if (ge->current_clock == END_OF_STATUS)
480 ge->current_clock = TO00;
481}
482
483uint8_t ge_clock_is_first(struct ge* ge)
484{
485 return ge->current_clock == TO00;
486}
487
488uint8_t ge_clock_is_last(struct ge* ge)
489{
490 return ge->current_clock == (END_OF_STATUS - 1);
491}
492
493int ge_run_pulse(struct ge *ge)
494{
495 int r;
496 const struct msl_timing_state *state;
497
498 if (ge_clock_is_first(ge)) {
499 r = ge_peri_on_clock(ge);
500 if (r != 0)
501 return r;
502
503 /* poll the connectors and try to set up the cpu state.
504 * should this be here? */
506 }
507
508 /* Execute common pulse machine logic */
509 pulse(ge);
510
511 /* Execute peripherals pulse callbacks */
513 if (r != 0)
514 return r;
515
516 /* Execute the commands from the timing charts */
517 state = msl_get_state(ge->rSA);
518
519 /* The state to execute gets loaded in SA at TO10 */
520 if (ge->current_clock == TO10)
522
523 if (!state) {
524 ge_log(LOG_ERR, "no timing charts found for state %02X\n", ge->rSA);
525 return 1;
526 }
527
528 /* Latch the instruction-start PC for the disassembly display. In the alpha
529 * fetch (e2/e3) PO addresses the opcode and is NOT advanced within the state
530 * (operand fetch / PO recomputation happens in the later e0/e4/e6 states), so
531 * this is the address of the instruction now executing. It stays put while
532 * operands are read and PO is recomputed (e.g. across a jump), so a UI
533 * highlight tracking it does not drift onto operand (DB) bytes or the next
534 * line — it only moves when the next instruction is actually fetched. */
535 if (ge->rSA == 0xe2 || ge->rSA == 0xe3)
536 ge->instr_pc = ge->rPO;
537
538 msl_run_state(ge, state);
539
540 if (ge_clock_is_last(ge)) {
543 }
544
546 return 0;
547}
548
549int ge_run_cycle(struct ge *ge)
550{
551 do {
552 int r = ge_run_pulse(ge);
553 if (r)
554 return r;
555 } while (!ge_clock_is_first(ge));
556
557 return 0;
558}
559
560int ge_deinit(struct ge *ge)
561{
563 return 0;
564}
565
567{
568 if (RA101(ge)) {
569 ge_log(LOG_READER, "RA101: signaling incoming data\n");
570 ge->RC01 = 1;
571 }
572}
573
574void fsn_last_clock(struct ge *ge)
575{
576 /* At the end of a CPU cycle the future-status network is stored in SO
577 * (cpu fo. 127), advancing the program sequencer one state.
578 *
579 * In maintenance forcing (rotary off NORM) the program sequencer is frozen:
580 * the manual (CPU[4] §4 "Maintenance Panel", dwg 30004122 fo. 35-37) says a
581 * forcing cycle writes the *register under exam* (displayed through BO), it
582 * does not step the program. So a forcing cycle must NOT advance SO — that
583 * is what lets the operator key an instruction across phases (force SO=E2,
584 * step to E0, force FO, step to the 0x64 beta, force L1, step to execute).
585 * The one exception is rotary position 13 (RS_SO), which forces SO/SI
586 * itself — that is how the operator sets the sequencer state.
587 *
588 * RICI ("disable next status") suppresses the advance in normal operation,
589 * letting a status be re-executed. */
590 uint8_t sel_norm = ge->register_selector == RS_NORM;
591 uint8_t sel_so = ge->register_selector == RS_SO;
592 uint8_t advance_so = sel_norm ? !ge->console_switches.RICI : sel_so;
593 if (ge->RIA0 && advance_so) {
594 ge_log(LOG_FUTURE, "last clock cpu, %02x in SO\n", ge->future_state);
595 ge->rSO = ge->future_state;
596 } else {
597 ge_log(LOG_FUTURE, "last clock cpu, SO held at %02x (RIA0 %d advance %d)\n",
598 ge->rSO, ge->RIA0, advance_so);
599 }
600
601 /* after the end of a cpu work cycle, (ALTO / ALS71=1) is set if
602 * the PAPA switch is inserted, or if the rotary switch is neither
603 * in the normal position, nor in position 8 for recording in
604 * memory ALSOA=0) (cpu fo. 98)
605 */
606 uint8_t is_papa = ge->console_switches.PAPA;
607 uint8_t is_norm = ge->register_selector == RS_NORM;
608 uint8_t is_scr = ge->register_selector == RS_V1_SCR;
609
610 /* PAPA steps the MICROSEQUENCES and is NOT gated by the program. The
611 * INS/ENS inhibit and the STOC override belong to the operator panel's
612 * STEP-BY-STEP switch (ASIN), which is a separate circuit stopping at each
613 * instruction through CI891 -- see ge.h ASIN and msl-states.c
614 * state_E2_E3_TO80_CI89. The two used to be one thing here, which made PAPA
615 * silently ignorable by any program that had issued INS. */
616 ge_log(LOG_FUTURE, " papa: %d, norm: %d, scr: %d ==> %d\n",
617 is_papa, is_norm, is_scr,
618 ge->RIA0 && (is_papa || !(is_norm || is_scr)));
619
620 if (ge->RIA0 && (is_papa || !(is_norm || is_scr)))
621 ge->ALTO = 1;
622
623 /* PATE stops the timing after every cycle of the delay line — a finer step
624 * than PAPA and, unlike PAPA, it is not gated by the CPU/channel cycle
625 * (RIA0/RIA2), so it does interfere with peripheral transfers. One START
626 * then runs exactly one delay-line cycle. (CPU[4] §4, fo.35) */
628 ge->ALTO = 1;
629
630 /* after the execution of a channel 2 cycle, load the first
631 * 4 bits of the future status network in SI. (cpu fo. 127) */
632 if (ge->RIA2) {
633 ge_log(LOG_FUTURE, "last clock ch2, %02x in SI\n", ge->future_state);
634 ge->rSI = ge->future_state;
635 }
636
637}
@ RS_V1_SCR
Definition console.h:16
@ RS_SO
Definition console.h:21
@ RS_NORM
Definition console.h:18
int ge_deinit(struct ge *ge)
Deinitialize the emulator.
Definition ge.c:560
void ge_seed_segment_bases(struct ge *ge)
Seed the eight change/segment-base registers (mem[240+2N]) to identity bases N<<12.
Definition ge.c:294
void ge_load_1(struct ge *ge)
Emulate the press of the "load 1" button in the console.
Definition ge.c:372
void ge_print_registers_nonverbose(struct ge *ge)
Definition ge.c:446
static void ge_print_well_known_states(uint8_t state)
Definition ge.c:403
void ge_clear(struct ge *ge)
Emulate the press of the "clear" button in the console.
Definition ge.c:137
int ge_run_cycle(struct ge *ge)
Run all GE "mastri" clock periods until next clock cycle.
Definition ge.c:549
void ge_clock_increment(struct ge *ge)
Definition ge.c:476
const char * ge_clock_name(enum clock c)
The clock period name name.
Definition ge.c:433
uint8_t ge_clock_is_first(struct ge *ge)
Definition ge.c:483
void ge_mem_store8(struct ge *ge, uint16_t addr, uint8_t val)
Store a byte with generated odd parity + mark-written (for the hybrid ALU/SS write paths that write g...
Definition ge.c:317
static const char * pont_name(enum ge_pont p)
Definition ge.c:84
void ge_load_2(struct ge *ge)
Emulate the press of the "load 2" button in the console.
Definition ge.c:389
void ge_enter(struct ge *ge, uint16_t entry)
Force the sequencer into the alpha (fetch) phase at entry.
Definition ge.c:355
uint8_t ge_clock_is_last(struct ge *ge)
Definition ge.c:488
static uint8_t ge_odd_parity(uint8_t data)
Definition ge.c:306
void ge_init(struct ge *ge)
Initialize the emulator.
Definition ge.c:14
int ge_run_pulse(struct ge *ge)
Run a single pulse (i.e. a single GE "mastri" clock periods)
Definition ge.c:493
void fsn_last_clock(struct ge *ge)
Commit the future state.
Definition ge.c:574
void ge_print_registers_verbose(struct ge *ge)
Definition ge.c:459
void ge_load(struct ge *ge)
Emulate the press of the "load" button in the console.
Definition ge.c:362
void ge_log_options(struct ge *ge)
Report the strapped configuration and every level it produces (LOG_DEBUG).
Definition ge.c:93
int ge_load_image(struct ge *ge, const uint8_t *image, size_t size, uint16_t origin)
Write a flat image into core at origin, priming the parity store.
Definition ge.c:330
void connectors_first_clock(struct ge *ge)
Definition ge.c:566
void ge_start(struct ge *ge)
Emulate the press of the "start" button in the console.
Definition ge.c:394
#define MEM_SIZE
Definition ge.h:12
#define ENUMERATE_CLOCKS
Definition ge.h:14
ge_pont
Backplane option connectors and the maintenance LAMPS switch.
Definition ge.h:139
@ PONT_NONE
Definition ge.h:139
@ PONT_2N
Definition ge.h:139
@ PONT_2P
Definition ge.h:139
void pulse(struct ge *ge)
Definition pulse.c:328
clock
Definition ge.h:38
static uint16_t NI_knot(struct ge *ge)
NI Knot.
Definition signals.h:362
static uint16_t NO_knot(struct ge *ge)
Knot driven by P0, V1, V2, V4, L1, R1, V3 and L3.
Definition signals.h:212
static uint16_t ge_memory_capacity_k(struct ge *ge)
Definition signals.h:629
static uint16_t ge_cycle_period_ns(const struct ge *ge)
Cycle period in nanoseconds for the strapped version.
Definition signals.h:530
static uint16_t ge_cpu_version_uce(const struct ge *ge)
Processor version: 466, 467 or 468 (cp06 ch.002 TAB.1).
Definition signals.h:522
void ge_log(ge_log_type type, const char *format,...)
Log message.
Definition log.c:122
uint8_t ge_log_enabled(ge_log_type type)
Check if a log type is enabled.
Definition log.c:137
@ LOG_REGS_V
Register trace per pulse.
Definition log.h:23
@ LOG_ERR
Emulator unrecoverable condition.
Definition log.h:18
@ LOG_FUTURE
Future state network debug.
Definition log.h:24
@ LOG_REGS
Register trace per cycle.
Definition log.h:20
@ LOG_STATES
State trace.
Definition log.h:21
@ LOG_DEBUG
General detailed debug information.
Definition log.h:19
@ LOG_READER
Integrated Reader.
Definition log.h:28
const struct msl_timing_state * msl_get_state(uint8_t SO)
Gets timing state␐␐␐␐␐␐␐␐␐.
Definition msl.c:9
void msl_run_state(struct ge *ge, const struct msl_timing_state *state)
Select the first matching manual-sheet variant for an instruction state.
Definition msl.c:52
int ge_peri_on_pulses(struct ge *ge)
Definition peripherical.c:7
int ge_peri_deinit(struct ge *ge)
int ge_peri_on_clock(struct ge *ge)
Signals.
const char * name
Definition channel.h:39
const char * name
Definition reader.h:87
uint16_t PATE
Stop after a cycle.
Definition console.h:89
uint16_t RICI
Disables next status.
Definition console.h:97
uint16_t PAPA
Step By Step execution.
Definition console.h:81
uint8_t mode_debi
Definition reader.h:50
uint8_t mode_mi01
Definition reader.h:51
uint8_t mode_n001
Definition reader.h:48
uint8_t active_valid
Definition reader.h:59
uint8_t mode_n002
Definition reader.h:49
uint8_t mode_mi02
Definition reader.h:52
enum ge_pont E03
E03: machine version, paired with F04 (TAB.1) – FEL06 / FEL16.
Definition ge.h:143
enum ge_pont F05
Definition ge.h:157
enum ge_pont F03
F03: which connectors may raise an interruption (TAB.2).
Definition ge.h:149
enum ge_pont E04
E04: which two connectors are enabled for the initial LOAD (TAB.3).
Definition ge.h:146
uint8_t S42_diag
S42 "LAMPS" on the maintenance panel, in position DIAG.
Definition ge.h:165
enum ge_pont E05
E05 / F05: memory capacity (cp06 ch.001, "SELEZIONE CAPACITA MEMORIA") – 8K through 32K.
Definition ge.h:156
enum ge_pont F04
F04: machine version straps – cycle period and performance (TAB.1).
Definition ge.h:152
The entire state of the emulated system, including registers, memory, peripherals and timings.
Definition ge.h:172
uint8_t ALAM
Operator Call.
Definition ge.h:431
uint16_t instr_pc
Instruction-start PC (display aid, not a real register).
Definition ge.h:199
uint8_t ALOI
Load connector selection.
Definition ge.h:384
uint8_t AINI
Program Loading.
Definition ge.h:377
struct ge_integrated_reader integrated_reader
The I/O interface for the integrated reader (RI)
Definition ge.h:744
struct ge_connector ST4
The I/O interface for the ST4 connector.
Definition ge.h:785
uint8_t ALTO
Stops internal cycles.
Definition ge.h:392
uint8_t ffFA
Special conditions register 2.
Definition ge.h:352
uint16_t rPO
Program addresser.
Definition ge.h:191
uint8_t future_state
Future state.
Definition ge.h:675
uint8_t inv_add
Invalid-address fault flag: set when rVO >= installed memory size.
Definition ge.h:729
uint8_t PODI
Slow delay line.
Definition ge.h:400
uint8_t mem_written[MEM_SIZE]
1 once a location has been written; prevents false MEM CHECK on cleared memory
Definition ge.h:701
enum ge_console_rotary register_selector
The current state of the console register rotary switch.
Definition ge.h:680
uint8_t RIA0
Synchronous CPU Cycle Request.
Definition ge.h:629
uint32_t mem_size
Installed memory size; 0 is treated as MEM_SIZE (full address space)
Definition ge.h:723
uint8_t RIA2
Synchronous Channel 2 Cycle Request.
Definition ge.h:643
uint8_t PEC1
Definition ge.h:549
uint16_t rV1
Addresser for the first operand.
Definition ge.h:201
uint8_t mem_check
Parity fault flag: set when a READ finds a parity mismatch on a previously-written location.
Definition ge.h:726
uint8_t rSO
Main sequencer.
Definition ge.h:309
uint16_t rRO
Multipurpose 8+1 bit register.
Definition ge.h:248
struct ge_console_switches console_switches
The current state of the console switches.
Definition ge.h:685
struct ge_connector ST3
The I/O interface for the ST3 connector.
Definition ge.h:780
uint8_t rL2
Auxiliary register.
Definition ge.h:232
uint8_t powered
Definition ge.h:175
uint8_t ffFI
Special conditions register 1.
Definition ge.h:342
uint8_t RC00
Asynchronous CPU Cycle Request.
Definition ge.h:574
uint16_t rBO
Default operator.
Definition ge.h:277
uint8_t RC01
Asynchronous Channel 1 Cycle Request.
Definition ge.h:587
uint8_t RECE
Selection Check Byte.
Definition ge.h:653
uint8_t mem[MEM_SIZE]
The memory of the emulated system.
Definition ge.h:695
struct ge_channel channel2
Integrated channel 2 (CAN2) line bundle — shared by the integrated reader (input),...
Definition ge.h:794
uint8_t RAVI
VICU Support.
Definition ge.h:664
uint8_t RACI
Rejected Command.
Definition ge.h:661
uint16_t rV4
Addresser for external instructions using channel 2.
Definition ge.h:204
uint16_t rL1
Length of the operand.
Definition ge.h:231
uint8_t rSA
Future state configuration.
Definition ge.h:331
uint8_t PEC1_pending
Definition ge.h:550
uint16_t rV2
Addresser for the second operand.
Definition ge.h:202
uint8_t RC02
Asynchronous Channel 2 Cycle Request.
Definition ge.h:602
uint8_t ADIR
Disable Step By Step.
Definition ge.h:456
struct ge_options options
Backplane straps and maintenance-panel options (cp06 ch.002).
Definition ge.h:178
uint8_t RIG1
End from controller 1.
Definition ge.h:656
uint8_t rSI
Peripheral unit sequencer.
Definition ge.h:323
uint8_t RC03
Asynchronous Channel 3 Cycle Request.
Definition ge.h:617
uint8_t JE
JE/AVER jump instruction exectuted.
Definition ge.h:497
uint8_t ACIC
Recycle delay line.
Definition ge.h:421
enum clock current_clock
Definition ge.h:174
uint16_t rL3
Length of operands involving channel 3.
Definition ge.h:233
uint8_t mem_parity[MEM_SIZE]
Stored odd-parity bit (1 bit per location) written alongside mem[].
Definition ge.h:698
uint8_t RIG3
Definition ge.h:658
uint16_t rV3
Addresser for external instructions using channel 3.
Definition ge.h:203
uint8_t rFO
Current function code.
Definition ge.h:284
uint16_t cr_cache[8]
Change/segment-register cache (kept in sync by the register instructions via cr_wr16 and by ge_seed_s...
Definition ge.h:217
Timing chart.
Definition msl-timings.h:65