GE-115 Emulator
An Emulator of the General Electrics GE-115 computer
printer.h
Go to the documentation of this file.
1/*
2 * printer.h - Integrated printer / console-typewriter peripheral (channel 2).
3 *
4 * Pragmatic model: gemu does not drive the channel-2 (rSI) per-character
5 * transfer states at signal level, so a print/typewriter PER leaves the CPU
6 * suspended in the org-phase external request-wait (state b8, rSA idle). This
7 * peripheral detects that stall and completes the operation the way the real
8 * channel-2 unit would — by asserting the unit-ready condition (PUC2, which
9 * makes DU97 true) and the CPU-active request (RC00) so the machine's OWN
10 * state_b8 microcode (CU01/CU13/CU14/CU06) routes B8 -> alpha with the CPU
11 * context intact. No state is forced from outside.
12 *
13 * Output is a real per-character transfer: an output PER's order block (entry at
14 * state c8, base = rV1; {z, cmd, len_hi, len_lo, buf_hi, buf_lo}) arms the
15 * transfer engine when the command is a put (bit 7) with a plausible length, and
16 * the rSI output microcode (state 02, CE16) drains mem[buf..] over channel 2 to
17 * the sink, each byte rendered through the GE 100-series graphic set (gecode.c) —
18 * the machine's own code, not ASCII. A channel-2 PER that parks at the b8 wait
19 * but is NOT an armed data transfer (a control/order PER, e.g. funktionalcpu's
20 * banner/report) is completed but prints nothing.
21 *
22 * Two-way: kbd[] is the operator-keyboard input queue (printer_feed_key); the
23 * wasm/interactive front-end pushes typed characters here.
24 */
25#ifndef PRINTER_H
26#define PRINTER_H
27
28#include "ge.h"
29
30/* Register the integrated printer/typewriter on channel 2. Sets
31 * ge->integrated_printer.present = 1 so the channel-2 print-wait is completed
32 * (interactive/wasm runs). Bootstrap/reader tests that do not call this leave
33 * present == 0 and are unaffected. Returns 0 on success, -1 on error. */
34int printer_register(struct ge *ge);
35
36/* Begin a channel-2 OUTPUT transfer: print `length` characters starting at
37 * memory address `buffer`. The printer then requests a channel-2 cycle per
38 * character (RC02 + rSI state 0x02) so the machine's microcode drains the buffer
39 * to the printer. `line_mode` appends a paper break when the transfer ends;
40 * this is used by the line printer's WRITE order but not by the console
41 * typewriter PUT path. (Seam for the org-phase PER hook; also used directly by
42 * tests.) */
43void printer_begin_output(struct ge *ge, uint16_t buffer, int length, int line_mode);
44
45/* Push one operator-keyboard byte into the input queue (two-way chat). */
46void printer_feed_key(struct ge *ge, uint8_t c);
47
48/* Number of captured printed characters currently in the paper-feed buffer. */
49int printer_output_len(struct ge *ge);
50
51/* Pointer to the captured printed characters (NUL-terminated view via len). */
52const char *printer_output(struct ge *ge);
53
54/* Clear the captured paper-feed buffer (e.g. after the front-end drained it). */
55void printer_output_clear(struct ge *ge);
56
57#endif /* PRINTER_H */
int printer_output_len(struct ge *ge)
Definition printer.c:393
void printer_begin_output(struct ge *ge, uint16_t buffer, int length, int line_mode)
Definition printer.c:373
int printer_register(struct ge *ge)
Definition printer.c:349
const char * printer_output(struct ge *ge)
Definition printer.c:398
void printer_feed_key(struct ge *ge, uint8_t c)
Definition printer.c:383
void printer_output_clear(struct ge *ge)
Definition printer.c:403
The entire state of the emulated system, including registers, memory, peripherals and timings.
Definition ge.h:96