GE-115 Emulator
An Emulator of the General Electrics GE-115 computer
reader.h
Go to the documentation of this file.
1#ifndef READER
2#define READER
3
4#include <stdint.h>
5
6#include "transcode.h" /* enum transcode_mode (the CPU-selected read mode) */
7
8struct ge;
9
10/*
11 * The integrated card reader on connector 2 / channel 1, modelled signal-by-
12 * signal against the COCA connector (see docs/signals/01-coca-connector.md).
13 * The data path
14 * (lu08/fini/data) is the working base; the remaining 1-bit fields are the
15 * other COCA pins, each a discrete modelled wire (reader->CPU status and
16 * CPU->reader command/mode). They are added inert and wired up phase by phase.
17 */
19 /* --- data path (base) --- */
20 uint8_t lu08:1; /* LU08N : character-ready strobe */
21 uint8_t fini:1; /* FININ : end-of-read, raised with the last char */
22 uint8_t data; /* LU00N-LU07N : the transcoded character byte */
23
24 /* --- reader -> CPU status lines --- */
25 uint8_t fiden:1; /* FIDEN : end-of-sequence (deck exhausted), L1·03 */
26 uint8_t lupor:1; /* LUPOR : reader free / ready, L1·07 (= LUPO1) */
27 uint8_t luren:1; /* LUREN : error (transcoder / jam), L1·09 */
28 uint8_t lusen:1; /* LUSEN : out-of-service, L1·04 (strap) */
29 uint8_t lenon:1; /* LENON : "not operable", L1·13 (strap) */
30 uint8_t lesab:1; /* LESAB : reader present / selected, L1·15 (strap)*/
31 uint8_t pom01:1; /* POM01 : binary-mode (by-pass) indicator, M1·12 */
32
33 /* These two are real reader wires but live on the harness sub-connectors
34 * (BI20 on 1253-2, PICON on 1251·24), NOT on the COCA slots I1/L1/M1 that
35 * carry everything above. A board attaching at the COCA slots -- like the
36 * Pico reader -- never sees them, which is why the firmware has no
37 * equivalent. Modelled here for observability. */
38 uint8_t bi20:1; /* BI20 : binary-read 2nd-nibble aux clock */
39 uint8_t picon:1; /* PICON : first-column check */
40
41 /* --- CPU -> reader command / mode lines (latched on this side) --- */
42 uint8_t tu00:1; /* TU00N : read-strobe clock for RE data */
43 uint8_t tu03:1; /* TU03N : card-feed / advance clock */
44 uint8_t rifan:1; /* RIFAN : card reject / eject */
45 uint8_t regen:1; /* REGEN : general clear / reset */
46 uint8_t sesen:1; /* SESEN : put-in-manual */
47 uint8_t cocon:1; /* COCON : mode-select clock (latches the decode) */
48 uint8_t mode_n001:1;/* N001 : normal-mode decode */
49 uint8_t mode_n002:1;/* N002 */
50 uint8_t mode_debi:1;/* DEBI : binary-read (by-pass) decode */
51 uint8_t mode_mi01:1;/* MI01 : mixed-mode decode */
52 uint8_t mode_mi02:1;/* MI02 */
53
54 /* Read mode the CPU has selected, latched by COCON. While active_valid==0
55 * (the CPU has not driven a mode) the cardreader peripheral falls back to
56 * its harness-registered transcode mode; once the CPU issues a COCON latch
57 * active_mode takes over. */
59 uint8_t active_valid:1;
60
61 /* --- command latch (rpi-pico-card-reader src/feeder.c) ---
62 *
63 * A read command does NOT strobe anything. It is latched here; the card is
64 * presented when the CPU's TU03N feed arrives, which on the bench is the
65 * order the wire actually shows (command, then feed, then strobes). Feeding
66 * on the command instead loses the card to a channel that is not armed yet.
67 */
68 uint8_t cmd_pending:1; /* a read command is latched, awaiting the feed */
69 uint8_t cmd_reject:1; /* 0x48 card reject: drop this card, no transfer */
70
71 /* Commands the reader does not implement. Counted rather than acted on, so
72 * an unexpected order shows up in a trace instead of disturbing the feed. */
73 uint16_t anomalies;
74};
75
76void reader_setup_to_send(struct ge *ge, uint8_t data, uint8_t end);
77void reader_clear_sending(struct ge *ge);
78
79void reader_send_tu00(struct ge *);
80void reader_send_tu10(struct ge *);
81
82uint8_t reader_get_LU08(struct ge *);
83uint8_t reader_get_LUPO1(struct ge *);
84uint8_t reader_get_FINI1(struct ge *);
85
87 const char *name;
88
89 uint8_t data;
90
91 uint8_t mare:1;
92 uint8_t te10:1;
93 uint8_t te20:1;
94 uint8_t te30:1;
95 uint8_t fine:1;
96};
97
98void connector_setup_to_send(struct ge *, struct ge_connector *, uint8_t, uint8_t);
99void connector_send_tu00(struct ge *, struct ge_connector *);
101
102uint8_t connector_get_MARE(struct ge_connector *);
103uint8_t connector_get_TE10(struct ge_connector *);
104uint8_t connector_get_TE20(struct ge_connector *);
105uint8_t connector_get_TE30(struct ge_connector *);
106uint8_t connector_get_FINE(struct ge_connector *);
107
108#endif
109
void connector_send_tu00(struct ge *, struct ge_connector *)
Definition reader.c:274
void reader_setup_to_send(struct ge *ge, uint8_t data, uint8_t end)
Definition reader.c:116
uint8_t connector_get_TE20(struct ge_connector *)
Definition reader.c:223
uint8_t reader_get_LU08(struct ge *)
Definition reader.c:185
uint8_t connector_get_FINE(struct ge_connector *)
Definition reader.c:235
uint8_t reader_get_FINI1(struct ge *)
Definition reader.c:205
void connector_setup_to_send(struct ge *, struct ge_connector *, uint8_t, uint8_t)
Definition reader.c:241
uint8_t connector_get_TE30(struct ge_connector *)
Definition reader.c:229
void reader_send_tu10(struct ge *)
Definition reader.c:167
uint8_t reader_get_LUPO1(struct ge *)
Definition reader.c:198
void reader_clear_sending(struct ge *ge)
Definition reader.c:162
uint8_t connector_get_TE10(struct ge_connector *)
Definition reader.c:217
uint8_t connector_get_MARE(struct ge_connector *)
Definition reader.c:211
void reader_send_tu00(struct ge *)
Definition reader.c:43
void connector_clear_sending(struct ge_connector *)
Definition reader.c:265
uint8_t te20
Definition reader.h:93
uint8_t mare
Definition reader.h:91
uint8_t data
Definition reader.h:89
uint8_t te30
Definition reader.h:94
uint8_t fine
Definition reader.h:95
const char * name
Definition reader.h:87
uint8_t te10
Definition reader.h:92
uint8_t mode_debi
Definition reader.h:50
enum transcode_mode active_mode
Definition reader.h:58
uint8_t cmd_pending
Definition reader.h:68
uint8_t mode_mi01
Definition reader.h:51
uint16_t anomalies
Definition reader.h:73
uint8_t mode_n001
Definition reader.h:48
uint8_t cmd_reject
Definition reader.h:69
uint8_t active_valid
Definition reader.h:59
uint8_t mode_n002
Definition reader.h:49
uint8_t mode_mi02
Definition reader.h:52
The entire state of the emulated system, including registers, memory, peripherals and timings.
Definition ge.h:172
transcode_mode
Definition transcode.h:18