GE-115 Emulator
An Emulator of the General Electrics GE-115 computer
cardreader.h
Go to the documentation of this file.
1#ifndef CARDREADER_H
2#define CARDREADER_H
3
4/*
5 * cardreader.h - Connector-2 punch-card-reader peripheral for the GE-120 emulator.
6 *
7 * Registers a peripheral that automatically feeds a .cap punch-card deck into
8 * the CPU via the existing integrated-reader handshake (reader_setup_to_send /
9 * reader_clear_sending), so the machine can load software without the test
10 * harness manually calling those functions.
11 *
12 * Usage:
13 * ge_init(&g);
14 * ge_clear(&g);
15 * ge_load_1(&g); // select connector 2
16 * ge_load(&g);
17 * cardreader_register(&g, "/path/to/deck.cap", TC_NORMAL);
18 * ge_start(&g);
19 * // run cycles normally; the peripheral feeds bytes automatically
20 */
21
22#include "ge.h"
23#include "transcode.h"
24
25/*
26 * cardreader_register - load a .cap deck and register the card reader
27 * peripheral on the GE instance.
28 *
29 * @ge: the emulator instance to attach to
30 * @cap_path: filesystem path of the .cap deck file
31 * @mode: TC_NORMAL (Hollerith transcoding) or TC_BINARY (raw passthrough)
32 *
33 * On success returns 0 and the peripheral is active. Returns -1 if the
34 * deck file cannot be opened/parsed, or if memory allocation fails.
35 *
36 * The peripheral feeds columns one at a time, presenting each transcoded
37 * byte to the integrated reader strobe (lu08) when the machine is ready
38 * (lu08 == 0). Cards with zero columns are skipped. The 'end' flag is
39 * raised on the very last column of the last non-empty card, mirroring the
40 * behaviour of the manual bootstrap in tests/initial-load.c.
41 *
42 * deinit: the peripheral frees all deck memory when ge_deinit is called.
43 */
44int cardreader_register(struct ge *ge, const char *cap_path,
45 enum transcode_mode mode);
46
47/*
48 * cardreader_register_from - like cardreader_register, but starts feeding at
49 * card index `first_card` (skipping any empty cards from there).
50 *
51 * Used to skip a deck's title card and the non-matching loader cards. For the
52 * "130 CPU FUNCTIONAL TEST" deck: card 0 = title, cards 1-4 = the four loaders
53 * (the HOLLERITH card-reader loader has row-8 punched in column 3), cards 5+ =
54 * program, last card = summary. Booting a HOLLERITH card reader starts at the
55 * matching loader card; it then reads the program cards itself.
56 */
57int cardreader_register_from(struct ge *ge, const char *cap_path,
58 enum transcode_mode mode, int first_card);
59
60/*
61 * cardreader_register_packed - register a SELF-LOADING SMAC deck whose cards
62 * hold the program as full COLBIN bytes (1 column -> 1 byte).
63 *
64 * The channel-1 input-transfer microcode packs two presented nibbles into one
65 * memory byte, so each card byte is fed as a hi-then-lo nibble pair and the
66 * packer rebuilds it intact. This lets the deck's own loader chain run via the
67 * reader: the bootstrap card's PERs read each subsequent card and its MVCs
68 * relocate the payload to its embedded load address. `mode` is the per-byte
69 * decode (TC_COLBIN for these decks).
70 */
71int cardreader_register_packed(struct ge *ge, const char *cap_path,
72 enum transcode_mode mode);
73
74#endif /* CARDREADER_H */
int cardreader_register_packed(struct ge *ge, const char *cap_path, enum transcode_mode mode)
Definition cardreader.c:458
int cardreader_register(struct ge *ge, const char *cap_path, enum transcode_mode mode)
Definition cardreader.c:442
int cardreader_register_from(struct ge *ge, const char *cap_path, enum transcode_mode mode, int first_card)
Definition cardreader.c:448
The entire state of the emulated system, including registers, memory, peripherals and timings.
Definition ge.h:96
transcode_mode
Definition transcode.h:18