12#define MAX_PROGRAM_STORAGE_WORDS 129
16 memset(
ge, 0,
sizeof(*
ge));
85 for (
int n = 0; n < 8; n++) {
86 uint16_t v = (uint16_t)(n << 12);
87 ge->
mem[240 + 2 * n] = (uint8_t)(v >> 8);
88 ge->
mem[240 + 2 * n + 1] = (uint8_t)(v & 0xff);
95 if (program == NULL && size != 0)
102 memcpy(
ge->
mem, program, size);
110 return __builtin_parity(data) ? 0 : 1;
136 if (image == NULL && size != 0)
138 if ((uint32_t)origin + (uint32_t)size > max)
141 for (
size_t i = 0; i < size; i++) {
142 uint16_t a = (uint16_t)(origin + i);
143 ge->
mem[a] = image[i];
207 name =
"- Display sequence";
210 name =
"- Forcing sequence";
214 name =
"- Beta Phase";
217 name =
"- Initialitiation";
221 name =
"- Alpha Phase";
224 name =
"- Interruption";
251 "SO: %02x SA: %02x PO: %04x RO: %04x BO: %04x FO: %04x - "
252 "V1: %04x V2: %04x V3: %04x V4: %04x - "
253 "L1: %04x L2: %04x L3 : %04x\n",
263 "SO: %02x SA: %02x PO: %04x RO: %04x BO: %04x FO: %04x - "
264 "NO: %02x NI: %02x - "
265 "FA: %02x FI: %02x - "
266 "V1: %04x V2: %04x V3: %04x V4: %04x - "
267 "L1: %04x L2: %04x L3 : %04x\n",
393 if (
ge->
RIA0 && advance_so) {
397 ge_log(
LOG_FUTURE,
"last clock cpu, SO held at %02x (RIA0 %d advance %d)\n",
415 uint8_t papa_stop = is_papa && step_enabled;
417 is_papa, step_enabled, is_norm, is_scr,
418 ge->
RIA0 && (papa_stop || !(is_norm || is_scr)));
420 if (
ge->
RIA0 && (papa_stop || !(is_norm || is_scr)))
int ge_deinit(struct ge *ge)
Deinitialize the emulator.
void ge_seed_segment_bases(struct ge *ge)
Seed the eight change/segment-base registers (mem[240+2N]) to identity bases N<<12.
void ge_load_1(struct ge *ge)
Emulate the press of the "load 1" button in the console.
void ge_print_registers_nonverbose(struct ge *ge)
#define MAX_PROGRAM_STORAGE_WORDS
static void ge_print_well_known_states(uint8_t state)
void ge_clear(struct ge *ge)
Emulate the press of the "clear" button in the console.
int ge_run_cycle(struct ge *ge)
Run all GE "mastri" clock periods until next clock cycle.
void ge_clock_increment(struct ge *ge)
const char * ge_clock_name(enum clock c)
The clock period name name.
uint8_t ge_clock_is_first(struct ge *ge)
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...
void ge_load_2(struct ge *ge)
Emulate the press of the "load 2" button in the console.
void ge_enter(struct ge *ge, uint16_t entry)
Enter execution at entry: seed PO and drop into the alpha (fetch) phase, bypassing the peripheral LOA...
uint8_t ge_clock_is_last(struct ge *ge)
static uint8_t ge_odd_parity(uint8_t data)
void ge_init(struct ge *ge)
Initialize the emulator.
int ge_run_pulse(struct ge *ge)
Run a single pulse (i.e. a single GE "mastri" clock periods)
void fsn_last_clock(struct ge *ge)
Commit the future state.
void ge_print_registers_verbose(struct ge *ge)
void ge_load(struct ge *ge)
Emulate the press of the "load" button in the console.
int ge_load_image(struct ge *ge, const uint8_t *image, size_t size, uint16_t origin)
Load a flat image at origin (unified-format payload); origin-aware, not size-capped,...
int ge_load_program(struct ge *ge, uint8_t *program, uint8_t size)
Copy a program at the start of memory.
void connectors_first_clock(struct ge *ge)
void ge_start(struct ge *ge)
Emulate the press of the "start" button in the console.
void pulse(struct ge *ge)
static uint16_t NI_knot(struct ge *ge)
NI Knot.
static uint16_t NO_knot(struct ge *ge)
Knot driven by P0, V1, V2, V4, L1, R1, V3 and L3.
void ge_log(ge_log_type type, const char *format,...)
Log message.
uint8_t ge_log_enabled(ge_log_type type)
Check if a log type is enabled.
@ LOG_REGS_V
Register trace per pulse.
@ LOG_ERR
Emulator unrecoverable condition.
@ LOG_FUTURE
Future state network debug.
@ LOG_REGS
Register trace per cycle.
@ LOG_READER
Integrated Reader.
void msl_run_state(struct ge *ge, struct msl_timing_state *state)
Runs a machine state.
struct msl_timing_state * msl_get_state(uint8_t SO)
Gets timing state␐␐␐␐␐␐␐␐␐.
int ge_peri_on_pulses(struct ge *ge)
int ge_peri_deinit(struct ge *ge)
int ge_peri_on_clock(struct ge *ge)
uint16_t PATE
Stop after a cycle.
uint16_t RICI
Disables next status.
uint16_t PAPA
Step By Step execution.
The entire state of the emulated system, including registers, memory, peripherals and timings.
uint8_t ALAM
Operator Call.
uint16_t instr_pc
Instruction-start PC (display aid, not a real register).
uint8_t ALOI
Load connector selection.
uint8_t AINI
Program Loading.
struct ge_integrated_reader integrated_reader
The I/O interface for the integrated reader (RI)
struct ge_connector ST4
The I/O interface for the ST4 connector.
uint8_t ALTO
Stops internal cycles.
uint8_t ffFA
Special conditions register 2.
uint16_t rPO
Program addresser.
uint8_t future_state
Future state.
uint8_t PODI
Slow delay line.
uint8_t mem_written[MEM_SIZE]
1 once a location has been written; prevents false MEM CHECK on cleared memory
enum ge_console_rotary register_selector
The current state of the console register rotary switch.
uint8_t RIA0
Synchronous CPU Cycle Request.
uint32_t mem_size
Installed memory size; 0 is treated as MEM_SIZE (full address space)
uint8_t RIA2
Synchronous Channel 2 Cycle Request.
uint16_t rV1
Addresser for the first operand.
uint8_t rSO
Main sequencer.
uint16_t rRO
Multipurpose 8+1 bit register.
struct ge_console_switches console_switches
The current state of the console switches.
struct ge_connector ST3
The I/O interface for the ST3 connector.
uint8_t rL2
Auxiliary register.
uint8_t ffFI
Special conditions register 1.
uint8_t RC00
Asynchronous CPU Cycle Request.
uint16_t rBO
Default operator.
uint8_t RC01
Asynchronous Channel 1 Cycle Request.
uint8_t mem[MEM_SIZE]
The memory of the emulated system.
struct ge_channel channel2
Integrated channel 2 (CAN2) line bundle — shared by the integrated reader (input),...
uint16_t rV4
Addresser for external instructions using channel 2.
uint16_t rL1
Length of the operand.
uint8_t rSA
Future state configuration.
uint16_t rV2
Addresser for the second operand.
uint8_t RC02
Asynchronous Channel 2 Cycle Request.
uint8_t ADIR
Disable Step By Step.
uint8_t rSI
Peripheral unit sequencer.
uint8_t RC03
Asynchronous Channel 3 Cycle Request.
uint8_t ACIC
Recycle delay line.
uint16_t rL3
Length of operands involving channel 3.
uint8_t mem_parity[MEM_SIZE]
Stored odd-parity bit (1 bit per location) written alongside mem[].
uint16_t rV3
Addresser for external instructions using channel 3.
uint8_t rFO
Current function code.
uint16_t cr_cache[8]
Change/segment-register CACHE used for modified-address resolution.