GE-115 Emulator
An Emulator of the General Electrics GE-115 computer
alu_reg.h
Go to the documentation of this file.
1
67#ifndef ALU_REG_H
68#define ALU_REG_H
69
70#include <stdint.h>
71#include "ge.h"
72#include "alu_cc.h"
73
74/* -------------------------------------------------------------------------
75 * Register-load / store
76 * -------------------------------------------------------------------------
77 * All register operations work on 2-byte (16-bit) fields.
78 * Memory is addressed as individual bytes; the register holds the pair.
79 * The GE stores the MSB at the LOWER address (big-endian within the word).
80 */
81
93void alu_lr(struct ge *ge, uint16_t *reg, uint16_t addr);
94
106void alu_str(struct ge *ge, uint16_t reg_val, uint16_t addr);
107
108/* -------------------------------------------------------------------------
109 * Arithmetic / compare on registers
110 * -------------------------------------------------------------------------*/
111
133void alu_cmr(struct ge *ge, uint16_t reg_val, uint16_t value);
134
155void alu_amr(struct ge *ge, uint16_t *reg, uint16_t value);
156
177void alu_smr(struct ge *ge, uint16_t *reg, uint16_t value);
178
190void alu_la(struct ge *ge, uint16_t *reg, uint16_t addr);
191
192/* -------------------------------------------------------------------------
193 * Search instructions (SR/SL)
194 * -------------------------------------------------------------------------
195 * These are PMM-format (2-address) instructions.
196 * They scan a memory field for a model byte.
197 * The result address is deposited in register 7 (pointed to by r7).
198 * SR scans left-to-right; SL scans right-to-left.
199 * field = address of leftmost byte of search field.
200 * len = number of bytes to search (L1+1 in instruction encoding).
201 * model = the byte value to search for.
202 * Qualitative result: "not interested" per ยง5.5.4.
203 * -------------------------------------------------------------------------*/
204
219void alu_sr(struct ge *ge, uint16_t *r7,
220 uint16_t field, uint16_t len, uint8_t model);
221
242void alu_sl(struct ge *ge, uint16_t *r7,
243 uint16_t field, uint16_t len, uint8_t model);
244
245/* -------------------------------------------------------------------------
246 * Quartet instructions (MVQ / CMQ)
247 * -------------------------------------------------------------------------
248 * "Quartets" = decimal unpacked format. Each byte holds a zone nibble (high)
249 * and a digit nibble (low). MVQ/CMQ ignore the zone nibbles and operate only
250 * on the low 4 bits of each byte.
251 *
252 * Both instructions use the 2-address PMM format:
253 * dst = address of the rightmost byte of the destination field
254 * src = address of the rightmost byte of the source field
255 * len = number of bytes (L1+1 in instruction encoding)
256 * Operations proceed right-to-left (from rightmost to leftmost byte).
257 * -------------------------------------------------------------------------*/
258
284void alu_mvq(struct ge *ge, uint16_t dst, uint16_t src, uint8_t len);
285
308void alu_cmq(struct ge *ge, uint16_t a, uint16_t b, uint8_t len);
309
310#endif /* ALU_REG_H */
void alu_mvq(struct ge *ge, uint16_t dst, uint16_t src, uint8_t len)
alu_mvq - Move Quartets (MVQ, 0xF8)
Definition alu_reg.c:305
void alu_cmq(struct ge *ge, uint16_t a, uint16_t b, uint8_t len)
alu_cmq - Compare Quartets (CMQ, 0xF9)
Definition alu_reg.c:347
void alu_lr(struct ge *ge, uint16_t *reg, uint16_t addr)
alu_lr - Load Register (LR, 0xBC)
Definition alu_reg.c:48
void alu_cmr(struct ge *ge, uint16_t reg_val, uint16_t value)
alu_cmr - Compare Memory to Register (CMR, 0xBD)
Definition alu_reg.c:77
void alu_sr(struct ge *ge, uint16_t *r7, uint16_t field, uint16_t len, uint8_t model)
alu_sr - Search Right (SR, 0xD9)
Definition alu_reg.c:228
void alu_smr(struct ge *ge, uint16_t *reg, uint16_t value)
alu_smr - Subtract Memory from Register (SMR, 0xBF)
Definition alu_reg.c:162
void alu_la(struct ge *ge, uint16_t *reg, uint16_t addr)
alu_la - Load Address (LA, 0x68)
Definition alu_reg.c:207
void alu_sl(struct ge *ge, uint16_t *r7, uint16_t field, uint16_t len, uint8_t model)
alu_sl - Search Left (SL, 0xDB)
Definition alu_reg.c:263
void alu_str(struct ge *ge, uint16_t reg_val, uint16_t addr)
alu_str - Store Register (STR, 0x84)
Definition alu_reg.c:59
void alu_amr(struct ge *ge, uint16_t *reg, uint16_t value)
alu_amr - Add Memory to Register (AMR, 0xBE)
Definition alu_reg.c:110
The entire state of the emulated system, including registers, memory, peripherals and timings.
Definition ge.h:96