GE-115 Emulator
An Emulator of the General Electrics GE-115 computer
msl.c
Go to the documentation of this file.
1#include <stdint.h>
2#include <stdio.h>
3
4#include "msl.h"
5#include "msl-timings.h"
6#include "log.h"
7#include "ge.h"
8
9struct msl_timing_state* msl_get_state(uint8_t SO)
10{
11 struct msl_timing_state *state = &msl_timings[SO];
12
13 return (!state->chart)
14 ? NULL
15 : state;
16}
17
18void msl_run_state(struct ge* ge, struct msl_timing_state *state)
19{
20 const struct msl_timing_chart *chart;
21 uint32_t i = 0;
22
23 do {
24 const char *clock_name = ge_clock_name(ge->current_clock);
25 chart = &state->chart[i++];
26
27 if (chart->clock != ge->current_clock)
28 continue;
29
31
32 if (chart->additional) {
33 if (!chart->additional(ge)) {
34 ge_log(LOG_CONDS, " time %-4s - additional false\n", clock_name);
35 continue;
36 }
37 ge_log(LOG_CONDS, " time %-4s - additional true\n", clock_name);
38 }
39
40 if (chart->condition) {
41 if (!chart->condition(ge)) {
42 ge_log(LOG_CONDS, " time %-4s - condition false\n", clock_name);
43 continue;
44 }
45 ge_log(LOG_CONDS, " time %-4s - condition true\n", clock_name);
46 }
47
48
50 chart->command(ge);
51 } while (chart->clock < END_OF_STATUS);
52}
const char * ge_clock_name(enum clock c)
The clock period name name.
Definition ge.c:233
void ge_print_registers_verbose(struct ge *ge)
Definition ge.c:259
void ge_log(ge_log_type type, const char *format,...)
Log message.
Definition log.c:122
@ LOG_CONDS
MSL conditions trace.
Definition log.h:22
@ LOG_CMDS
MSL commands trace.
Definition log.h:29
const char * msl_comment_for_command(msl_command_cb command)
struct msl_timing_state msl_timings[0xff]
Timing chart definitions.
Definition msl-timings.c:9
void msl_run_state(struct ge *ge, struct msl_timing_state *state)
Runs a machine state.
Definition msl.c:18
struct msl_timing_state * msl_get_state(uint8_t SO)
Gets timing state␐␐␐␐␐␐␐␐␐.
Definition msl.c:9
The entire state of the emulated system, including registers, memory, peripherals and timings.
Definition ge.h:96
enum clock current_clock
Definition ge.h:98
Timing chart row.
Definition msl-timings.h:15
msl_command_cb command
Pointer to the command function.
Definition msl-timings.h:20
uint8_t(* additional)(struct ge *)
Additional condition for the command.
Definition msl-timings.h:44
uint8_t(* condition)(struct ge *)
Condition for the command.
Definition msl-timings.h:32
enum clock clock
Clock at which the command should be perfomed.
Definition msl-timings.h:17
Timing chart.
Definition msl-timings.h:52
const struct msl_timing_chart * chart
Definition msl-timings.h:53