GE-115 Emulator
An Emulator of the General Electrics GE-115 computer
connector34.h
Go to the documentation of this file.
1#ifndef CONNECTOR34_H
2#define CONNECTOR34_H
3
4#include <stdint.h>
5
6/*
7 * Shared core for Standard-GE-100 controllers on the CPU's standard connectors
8 * 3 and 4 — the attach point for Disk (DSS 156-157) and Tape (MTC/MTH) units.
9 *
10 * The CPU side (connector selection PC13A/PC14A from the latched PB06/PB07, the
11 * channel-1 read datapath through NE_knot, and the PER/CPER/TPER micro-sequence)
12 * is already in the emulator; what was missing is a device that listens on the
13 * ST3/ST4 connector line bundle and reacts. This core registers a single ge_peri
14 * whose on_clock drives that reaction, and device modules (disk.c, tape.c)
15 * register against it through the ge_std_device vtable.
16 *
17 * Fidelity: functional / channel-API level (NOT the pin-level Standard-GE-100
18 * handshake — spec 300740110 is not yet extracted). Data moves at the channel
19 * level: input bytes are presented on the connector lines so the CPU's own
20 * channel-1 loop writes them to memory.
21 *
22 * Scope: direct attach only (no MPA-130 fan-out). The 8-bit unit name decodes
23 * as: top two bits = connector (00->3, 01->4, 10->2, 11->1); low six bits =
24 * unit number (0..63).
25 */
26
27struct ge;
28struct ge_connector;
29struct ge_std_device;
30
31/* The reaction the CPU reads back (FA04/FA05/PECO) after a peripheral op. */
32typedef enum {
33 STD_ACCEPTED_NO_END = 0, /* command accepted, op performed, no "end" */
34 STD_ACCEPTED_END = 1, /* command accepted, op ended with "end" from PU */
35 STD_NOT_ACCEPTED = 2, /* command not accepted (rejected) */
36 STD_NOT_POSSIBLE = 3, /* operation not possible (bad unit / parameter) */
37 STD_BUSY = 4, /* unit/controller busy -> PECO, recycle and wait */
39
40/* Decoded unit name targeted by the current PER. */
42 uint8_t connector; /* 3 or 4 (also 2/1 for completeness) */
43 uint8_t unit; /* 0..63 (low six bits of the name byte) */
44};
45
46/*
47 * A device module (disk.c, tape.c) implements this vtable and attaches to a
48 * connector with connector34_attach().
49 */
51 const char *name;
52 void *ctx; /* device-private state */
53
54 /* Does this device own un.unit on its connector? (A multiple controller —
55 * e.g. tape — claims a whole range of unit numbers.) */
56 int (*claims)(void *ctx, struct std_unitname un);
57
58 /* CPER: a command/order byte has been delivered to the unit. Returns the
59 * reaction. May be NULL (then the core assumes STD_ACCEPTED_END). */
60 std_reaction (*command)(struct ge *, void *ctx, struct std_unitname un,
61 uint8_t order);
62
63 /* TPER data transfer at the channel-API level.
64 * dir 0 = input (device -> CPU): fill buf[0..*len-1], set *len to the
65 * number of bytes available (clamped to cap).
66 * dir 1 = output (CPU -> device): consume buf[0..*len-1].
67 * Returns the reaction. May be NULL (no transfer). */
68 std_reaction (*transfer)(struct ge *, void *ctx, struct std_unitname un,
69 int dir, uint8_t *buf, uint16_t *len, uint16_t cap);
70
71 /* Optional per-cycle housekeeping (seek/motion timers). May be NULL. */
72 void (*tick)(struct ge *, void *ctx);
73
74 struct ge_std_device *next; /* core-managed list link */
75};
76
77/* Create the core and register its peri. Idempotent. */
78int connector34_init(struct ge *ge);
79
80/* Attach a device to connector 3 or 4. */
81int connector34_attach(struct ge *ge, struct ge_std_device *dev, uint8_t connector);
82
83/* Decode the unit name captured for the current PER (top bits -> connector,
84 * low six bits -> unit). */
85struct std_unitname connector34_decode(struct ge *ge);
86
87/* Declare access latency for the current operation, callable from a device's
88 * command()/transfer() hook. The core then delays the data transfer by `ticks`
89 * machine cycles (the PER waits at its channel-1 request, RC00 held), modelling
90 * disk seek / tape motion time. */
91void connector34_set_busy(struct ge *ge, unsigned ticks);
92
93/* Raise an end-of-operation interrupt (connectors 3/4 are interrupt-enableable).
94 * Callable from a device's command()/transfer() hook. Sets RINT; the machine
95 * vectors at the next alpha (if unmasked, MASC=0) through the PSR save/restore
96 * at 0x0300/0x0304 (= decimal 768-775). The interrupt fires only once the PER
97 * has returned to alpha, so a synchronous transfer still completes first.
98 * NOTE: this is the interrupt-on-completion primitive; true overlap (CPU
99 * computing on channel 1 while the device transfers on channel 2/3) needs the
100 * channel-2/3 transfer micro-flow, which is future work. */
101void connector34_raise_interrupt(struct ge *ge);
102
103/* Forwarded by reader.c's connector_send_tu00() when a CPER/order byte is
104 * clocked to the selected connector. Internal seam — not for device modules. */
105void connector34_deliver_order(struct ge *ge, struct ge_connector *conn);
106
107#endif /* CONNECTOR34_H */
void connector34_deliver_order(struct ge *ge, struct ge_connector *conn)
int connector34_init(struct ge *ge)
int connector34_attach(struct ge *ge, struct ge_std_device *dev, uint8_t connector)
struct std_unitname connector34_decode(struct ge *ge)
Definition connector34.c:94
void connector34_raise_interrupt(struct ge *ge)
void connector34_set_busy(struct ge *ge, unsigned ticks)
std_reaction
Definition connector34.h:32
@ STD_ACCEPTED_END
Definition connector34.h:34
@ STD_BUSY
Definition connector34.h:37
@ STD_NOT_ACCEPTED
Definition connector34.h:35
@ STD_ACCEPTED_NO_END
Definition connector34.h:33
@ STD_NOT_POSSIBLE
Definition connector34.h:36
void(* tick)(struct ge *, void *ctx)
Definition connector34.h:72
int(* claims)(void *ctx, struct std_unitname un)
Definition connector34.h:56
struct ge_std_device * next
Definition connector34.h:74
const char * name
Definition connector34.h:51
std_reaction(* command)(struct ge *, void *ctx, struct std_unitname un, uint8_t order)
Definition connector34.h:60
std_reaction(* transfer)(struct ge *, void *ctx, struct std_unitname un, int dir, uint8_t *buf, uint16_t *len, uint16_t cap)
Definition connector34.h:68
The entire state of the emulated system, including registers, memory, peripherals and timings.
Definition ge.h:96
uint8_t unit
Definition connector34.h:43
uint8_t connector
Definition connector34.h:42