11#ifndef MSL_COMMANDS_INCLUDED_BY_MSL_STATES
12# error This file should be include by msl-states.c and not compiled directly
15#define CC { ge_log(LOG_ERR, "implement command %s\n", __FUNCTION__); }
147 return (uint16_t)((
ge->
mem[a] << 8) |
ge->
mem[(uint16_t)(a + 1)]);
157 if (a >= 240 && a <= 254 && !(a & 1))
168 return (uint16_t)((
ge->
mem[(uint16_t)(a - 1)] << 8) |
ge->
mem[a]);
220 uint8_t n = (
ge->
rL2 >> 4) & 7;
221 uint16_t disp =
ge->
rV2 & 0x0FFFu;
222 uint16_t ea = (uint16_t)(
cr_base(
ge, n) + disp);
272 uint16_t len = (uint16_t)((
ge->
rL1 & 0xff) + 1);
273 uint8_t alen = ((
ge->
rL1 >> 4) & 0xf) + 1;
274 uint8_t blen = (
ge->
rL1 & 0x0f) + 1;
279 uint16_t dst =
ge->
rV1 & 0x7FFFu;
280 uint16_t src =
ge->
rV2 & 0x7FFFu;
317 alu_ap(
ge, dst, alen-1, src, blen-1);
320 alu_sp(
ge, dst, alen-1, src, blen-1);
323 alu_mp(
ge, dst, alen-1, src, blen-1);
326 alu_dp(
ge, dst, alen-1, src, blen-1);
366 uint16_t r7 = (uint16_t)((
ge->
mem[0xFE] << 8) |
ge->
mem[0xFF]);
373 uint16_t r7 = (uint16_t)((
ge->
mem[0xFE] << 8) |
ge->
mem[0xFF]);
520 uint8_t RECIA = !(CE031 && PC011(
ge));
521 uint8_t RECI1 = !RECIA;
525 if (TO651 && RECI1) {
554 if (TO191 && PC011(
ge)) {
601 uint8_t TU03A = !(RT111 && PC121(
ge));
602 uint8_t TU03 = !TU03A;
651 if (TO801 && RIUC(
ge)) {
658 if (TO801 && RESI(
ge)) {
665 if (TO801 && RES2(
ge)) {
672 if (TO801 && RES3(
ge)) {
728static uint8_t
int_parity(uint8_t b) {
return (__builtin_popcount(b) & 1) ? 0 : 1; }
743 uint8_t st = (uint8_t)((
BIT(
ge->
ffFA, 4) << 5) |
void alu_ad(struct ge *ge, uint16_t a_addr, uint8_t a_len, uint16_t b_addr, uint8_t b_len)
AD – Add Decimal (opcode 0xFA).
void alu_sb(struct ge *ge, uint16_t a_addr, uint8_t a_len, uint16_t b_addr, uint8_t b_len)
SB – Subtract Binary (opcode 0xFF).
void alu_sd(struct ge *ge, uint16_t a_addr, uint8_t a_len, uint16_t b_addr, uint8_t b_len)
SD – Subtract Decimal (opcode 0xFB).
void alu_ab(struct ge *ge, uint16_t a_addr, uint8_t a_len, uint16_t b_addr, uint8_t b_len)
AB – Add Binary (opcode 0xFE).
Binary and decimal (unpacked) arithmetic helpers for the GE-120/130.
void alu_mvp(struct ge *ge, uint16_t a, uint8_t alen, uint16_t b, uint8_t blen)
MVP 0xE8 Move Packed: op1 = op2 (sign preserved from op2); CC set.
void alu_sp(struct ge *ge, uint16_t a, uint8_t alen, uint16_t b, uint8_t blen)
SP 0xEB Subtract Packed: op1 = op1 - op2; CC set.
void alu_upks(struct ge *ge, uint16_t dst, uint8_t dlen, uint16_t src, uint8_t slen)
UPKS 0xEF Unpack with Sign: packed op2 → zoned op1; zone always 0x4.
void alu_upk(struct ge *ge, uint16_t dst, uint8_t dlen, uint16_t src, uint8_t slen)
UPK 0xD8 Unpack: packed op2 → zoned op1 (no sign processing; zone of each result byte is taken from t...
void alu_pks(struct ge *ge, uint16_t dst, uint8_t dlen, uint16_t src, uint8_t slen)
PKS 0xEE Pack with Sign: zoned op2 → packed op1; sign from zone of rightmost source byte (zone 0xA → ...
void alu_mp(struct ge *ge, uint16_t a, uint8_t alen, uint16_t b, uint8_t blen)
MP 0xEC Multiply Packed: op1 = op1 * op2; CC set.
void alu_cmp(struct ge *ge, uint16_t a, uint8_t alen, uint16_t b, uint8_t blen)
CMP 0xE9 Compare Packed (algebraic, no operand change); CC set.
void alu_pk(struct ge *ge, uint16_t dst, uint8_t dlen, uint16_t src, uint8_t slen)
PK 0xDA Pack: zoned op2 → packed op1 (no sign processing).
void alu_edt(struct ge *ge, uint16_t pattern, uint8_t plen, uint16_t src)
EDT 0xDE Edit packed source into pattern at op1.
void alu_ap(struct ge *ge, uint16_t a, uint8_t alen, uint16_t b, uint8_t blen)
AP 0xEA Add Packed: op1 = op1 + op2; CC set.
void alu_dp(struct ge *ge, uint16_t a, uint8_t alen, uint16_t b, uint8_t blen)
DP 0xED Divide Packed: op1[left L1-L2 chars] = quotient, op1[right L2+1 chars] = remainder; CC set.
GE-130 packed/signed decimal ALU helpers.
void alu_tl(struct ge *ge, uint16_t a, uint8_t len, uint16_t table)
alu_tl – Translate (TL, §5.5.3.3, "TR" in manual)
void alu_ni(struct ge *ge, uint16_t addr, uint8_t imm)
alu_ni – AND Immediate (NI, §5.6.3.2)
void alu_nc(struct ge *ge, uint16_t a, uint16_t b, uint8_t len)
alu_nc – AND Characters (NC, §5.5.3.9)
void alu_oc(struct ge *ge, uint16_t a, uint16_t b, uint8_t len)
alu_oc – OR Characters (OC, §5.5.3.8)
void alu_cmc(struct ge *ge, uint16_t a, uint16_t b, uint8_t len)
alu_cmc – Compare Characters (CMC, §5.5.3.2)
void alu_ci(struct ge *ge, uint16_t addr, uint8_t imm)
alu_ci – Compare Immediate (CMI, §5.5.5.1)
void alu_xc(struct ge *ge, uint16_t a, uint16_t b, uint8_t len)
alu_xc – Exclusive-OR Characters (XC, §5.5.3.7)
void alu_oi(struct ge *ge, uint16_t addr, uint8_t imm)
void alu_mvc(struct ge *ge, uint16_t dst, uint16_t src, uint16_t len)
alu_mvc – Move Characters (MVC, §5.5.3.1)
void alu_xi(struct ge *ge, uint16_t addr, uint8_t imm)
alu_xi – Exclusive-OR Immediate (XI, §5.6.3.3)
void alu_mvi(struct ge *ge, uint16_t addr, uint8_t imm)
alu_mvi – Move Immediate (MVI, §5.5.5.2)
void alu_tm(struct ge *ge, uint16_t addr, uint8_t mask)
alu_tm – Test under Mask (TM, §5.6.3.4)
GE-120/130 ALU logical and string-move primitives.
void alu_mvq(struct ge *ge, uint16_t dst, uint16_t src, uint8_t len)
alu_mvq - Move Quartets (MVQ, 0xF8)
void alu_cmq(struct ge *ge, uint16_t a, uint16_t b, uint8_t len)
alu_cmq - Compare Quartets (CMQ, 0xF9)
void alu_cmr(struct ge *ge, uint16_t reg_val, uint16_t value)
alu_cmr - Compare Memory to Register (CMR, 0xBD)
void alu_sr(struct ge *ge, uint16_t *r7, uint16_t field, uint16_t len, uint8_t model)
alu_sr - Search Right (SR, 0xD9)
void alu_smr(struct ge *ge, uint16_t *reg, uint16_t value)
alu_smr - Subtract Memory from Register (SMR, 0xBF)
void alu_sl(struct ge *ge, uint16_t *r7, uint16_t field, uint16_t len, uint8_t model)
alu_sl - Search Left (SL, 0xDB)
void alu_amr(struct ge *ge, uint16_t *reg, uint16_t value)
alu_amr - Add Memory to Register (AMR, 0xBE)
ALU helpers for GE-120/GE-130 register and memory-field operations.
Bit manipulation helpers.
void channel_accept_output(struct ge *ge, struct ge_channel *ch, uint8_t c)
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...
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.
static uint16_t NE_knot(struct ge *ge)
NE Knot.
void ge_log(ge_log_type type, const char *format,...)
Log message.
@ LOG_ERR
Emulator unrecoverable condition.
@ LOG_FUTURE
Future state network debug.
@ LOG_PERI
Peripherals IO.
static void EXEC_NI(struct ge *ge)
static void INT_F0(struct ge *ge)
static void INT_C3(struct ge *ge)
static void CI73(struct ge *ge)
static void CE08(struct ge *ge)
static void CI02(struct ge *ge)
static uint16_t eff_v1_l2(struct ge *ge)
static void CI08(struct ge *ge)
static void EXEC_SMR(struct ge *ge)
static void CE01(struct ge *ge)
static void CU05(struct ge *ge)
static void CI63(struct ge *ge)
static void CI39(struct ge *ge)
static void INT_D3(struct ge *ge)
static void INT_C2(struct ge *ge)
static void CO49(struct ge *ge)
static void CO04(struct ge *ge)
static void CE11(struct ge *ge)
static void CO14(struct ge *ge)
static void CE18(struct ge *ge)
static void CI21(struct ge *ge)
static void CI20(struct ge *ge)
static void CO00(struct ge *ge)
static void CU12(struct ge *ge)
static void CI00s(struct ge *ge)
static void CI66(struct ge *ge)
static void CI19(struct ge *ge)
static void CE10(struct ge *ge)
static void CI74(struct ge *ge)
static void CI17(struct ge *ge)
static void CU00(struct ge *ge)
static void CO35(struct ge *ge)
static void CI15(struct ge *ge)
static void INT_D1(struct ge *ge)
static void EXEC_STR(struct ge *ge)
static void CU06(struct ge *ge)
static void CE03(struct ge *ge)
static void CI70(struct ge *ge)
static void CU07(struct ge *ge)
static void INT_C0(struct ge *ge)
static void INDEX_NEXT(struct ge *ge)
static void CE00(struct ge *ge)
static void CO01(struct ge *ge)
static void CI11(struct ge *ge)
static void INT_D2(struct ge *ge)
static void CU02(struct ge *ge)
static void CI06(struct ge *ge)
static void CI32(struct ge *ge)
static void CI65(struct ge *ge)
static void CO03(struct ge *ge)
static void CI75(struct ge *ge)
static void int_store(struct ge *ge, uint16_t a, uint8_t b)
static void EXEC_INDEX(struct ge *ge)
static void CU13(struct ge *ge)
static void CE07(struct ge *ge)
static void INT_D0(struct ge *ge)
static void CI80(struct ge *ge)
static void CI07(struct ge *ge)
static void EXEC_AMR(struct ge *ge)
static void CI81(struct ge *ge)
static void CU17(struct ge *ge)
static void CO96(struct ge *ge)
static void INDEX_OP2(struct ge *ge)
static void CI60(struct ge *ge)
static void EXEC_CMI(struct ge *ge)
static void EXEC_TM(struct ge *ge)
static void CI86(struct ge *ge)
static void CE06(struct ge *ge)
static void CO94(struct ge *ge)
static void CU20(struct ge *ge)
static void CO48(struct ge *ge)
static void CI64(struct ge *ge)
static void CI68(struct ge *ge)
static void CE16(struct ge *ge)
static void CO91(struct ge *ge)
static void EXEC_MVI(struct ge *ge)
static void CI05(struct ge *ge)
static void CI82(struct ge *ge)
static void CE09(struct ge *ge)
static void CI84(struct ge *ge)
static uint16_t reg_addr_of(struct ge *ge)
static void CI72(struct ge *ge)
static void CU01(struct ge *ge)
static uint16_t mem_rd16_op(struct ge *ge, uint16_t a)
static void CO90(struct ge *ge)
static void EXEC_CI(struct ge *ge)
static void SS_TO_ALPHA(struct ge *ge)
static void CE02(struct ge *ge)
static void EXEC_LR(struct ge *ge)
static void CI04(struct ge *ge)
static void CI88(struct ge *ge)
static void CI83(struct ge *ge)
static void CI41(struct ge *ge)
static void mem_wr16_op(struct ge *ge, uint16_t a, uint16_t v)
static void CO18(struct ge *ge)
static void CO40(struct ge *ge)
static void CI09(struct ge *ge)
static void CI89(struct ge *ge)
static void CU10(struct ge *ge)
static void CI62(struct ge *ge)
static void CI38(struct ge *ge)
static void CI69(struct ge *ge)
static void CI03(struct ge *ge)
static void CI77(struct ge *ge)
static void CU14(struct ge *ge)
static void CO11(struct ge *ge)
static void EXEC_LPSR(struct ge *ge)
static void CU16(struct ge *ge)
static void CO12(struct ge *ge)
static uint8_t int_parity(uint8_t b)
static void CI87(struct ge *ge)
static void CI85(struct ge *ge)
static void CO97(struct ge *ge)
static void CO30(struct ge *ge)
static void CI67(struct ge *ge)
static void CO16(struct ge *ge)
static void CI40(struct ge *ge)
static void CI00(struct ge *ge)
static void CI33(struct ge *ge)
static void CO41(struct ge *ge)
static void CO92(struct ge *ge)
static void EXEC_XI(struct ge *ge)
static void cr_wr16(struct ge *ge, uint16_t a, uint16_t v)
static void CO13(struct ge *ge)
static void EXEC_CMR(struct ge *ge)
static void CI61(struct ge *ge)
static void CO10(struct ge *ge)
static void CO31(struct ge *ge)
static uint16_t cr_base(struct ge *ge, int n)
static void CE05(struct ge *ge)
static uint16_t cr_rd16(struct ge *ge, uint16_t a)
static void CU11(struct ge *ge)
static void EXEC_SS(struct ge *ge)
static void INDEX_OP1(struct ge *ge)
static void CU03(struct ge *ge)
static void CE19(struct ge *ge)
static void CO93(struct ge *ge)
static void CI76(struct ge *ge)
static void EXEC_LA(struct ge *ge)
static void INT_C1(struct ge *ge)
static void CO95(struct ge *ge)
static void CE_chan1_status(struct ge *ge)
static void CI34(struct ge *ge)
static void CI16(struct ge *ge)
static void CI12(struct ge *ge)
static void CI78(struct ge *ge)
static void CI71(struct ge *ge)
static void CO02(struct ge *ge)
static void CU15(struct ge *ge)
static void CU04(struct ge *ge)
static void CI01(struct ge *ge)
static void JRT_LINK(struct ge *ge)
void reader_send_tu10(struct ge *ge)
void connector_send_tu00(struct ge *ge, struct ge_connector *conn)
void reader_send_tu00(struct ge *ge)
uint16_t ACON
Stops on jump condition not verified.
uint16_t ACOV
Stops on jump condition verified.
struct ge_counting_network::cmds cmds
enum ge_knot_no::@1 force_mode
The entire state of the emulated system, including registers, memory, peripherals and timings.
uint8_t ALAM
Operator Call.
uint8_t AINI
Program Loading.
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 PIC1
Selection Channel 1.
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
uint8_t inject_chan1_status
Channel-1 peripheral status override for error injection.
uint16_t rV1
Addresser for the first operand.
uint8_t rSO
Main sequencer.
uint16_t rRO
Multipurpose 8+1 bit register.
struct ge_counting_network counting_network
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.
uint8_t rRI
Photoprint register 8-bit register used to store the photodisc codes.
uint8_t PB06
Unconditionally stores L106.
uint8_t RC01
Asynchronous Channel 1 Cycle Request.
enum ge::@3 memory_command
struct ge_knot_ni kNI
Knot driven by counting network, or by the UA to store the result of the operation.
uint8_t mem[MEM_SIZE]
The memory of the emulated system.
uint8_t AVER
Jump Condition Verified.
struct ge_channel channel2
Integrated channel 2 (CAN2) line bundle — shared by the integrated reader (input),...
uint8_t RAVI
VICU Support.
uint8_t RACI
Rejected Command.
uint16_t rV4
Addresser for external instructions using channel 2.
uint8_t RASI
Channel 1 in transfer.
uint16_t rL1
Length of the operand.
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 RIG1
End from controller 1.
uint8_t rSI
Peripheral unit sequencer.
uint8_t RC03
Asynchronous Channel 3 Cycle Request.
uint8_t PB26
Stores L106 if channel 2 is selected.
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[].
uint8_t PB07
Unconditionally stores L106.
uint16_t rV3
Addresser for external instructions using channel 3.
uint8_t TO50_did_CI32_or_CI33
Workaround for pulse TO50.
uint8_t rFO
Current function code.
uint16_t cr_cache[8]
Change/segment-register CACHE used for modified-address resolution.
uint8_t SA00
First-vs-second operand flag for address modification.