|
GE-115 Emulator
An Emulator of the General Electrics GE-115 computer
|
GE-120/130 ALU logical and string-move primitives. More...
#include "alu_logic.h"Go to the source code of this file.
Functions | |
| 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_mvi (struct ge *ge, uint16_t addr, uint8_t imm) |
| alu_mvi – Move Immediate (MVI, §5.5.5.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_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_ni (struct ge *ge, uint16_t addr, uint8_t imm) |
| alu_ni – AND Immediate (NI, §5.6.3.2) | |
| void | alu_oi (struct ge *ge, uint16_t addr, uint8_t imm) |
| void | alu_xi (struct ge *ge, uint16_t addr, uint8_t imm) |
| alu_xi – Exclusive-OR Immediate (XI, §5.6.3.3) | |
| 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_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_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.
See alu_logic.h for the full API documentation and condition-code conventions. All semantics are derived from the GE-130 Programmed Description Specification (cpu_6.txt), chapter 5.
CC encoding reminder (from alu_cc.h / alu_cc.c): alu_set_cc(ge, cc) stores the 2-bit value as: bit1 (FA04) = cc >> 1 bit0 (FA05) = cc & 1
For compare operations the GE-120 uses: cc=1 first < second (FA04=0, FA05=1) cc=2 equal (FA04=1, FA05=0) cc=3 first > second (FA04=1, FA05=1) cc=0 "not possible" (never written by these helpers)
For XC/XI/TM: cc=2 result all-zero cc=3 result non-zero
Definition in file alu_logic.c.
| void alu_ci | ( | struct ge * | ge, |
| uint16_t | addr, | ||
| uint8_t | imm | ||
| ) |
alu_ci – Compare Immediate (CMI, §5.5.5.1)
Compares the byte mem[@addr] (unsigned) with the immediate @imm (unsigned). Sets CC: cc = 1 mem[@addr] < @imm cc = 2 mem[@addr] == @imm cc = 3 mem[@addr] > @imm
Definition at line 180 of file alu_logic.c.
| void alu_cmc | ( | struct ge * | ge, |
| uint16_t | a, | ||
| uint16_t | b, | ||
| uint8_t | len | ||
| ) |
alu_cmc – Compare Characters (CMC, §5.5.3.2)
Compares the @len-byte field at with the @len-byte field at , byte by byte, left to right, treating each byte as an unsigned integer. Stops as soon as a difference is found. Neither field is modified. Sets CC: cc = 1 mem[a..] < mem[b..] cc = 2 fields are equal cc = 3 mem[a..] > mem[b..]
Definition at line 153 of file alu_logic.c.
| void alu_mvc | ( | struct ge * | ge, |
| uint16_t | dst, | ||
| uint16_t | src, | ||
| uint16_t | len | ||
| ) |
alu_mvc – Move Characters (MVC, §5.5.3.1)
Copies @len bytes from mem[src .. src+len-1] to mem[dst .. dst+len-1], byte by byte, left to right. Overlapping fields are supported because the copy proceeds strictly left-to-right (same as the manual description). Does not alter the condition code.
Definition at line 31 of file alu_logic.c.
| void alu_mvi | ( | struct ge * | ge, |
| uint16_t | addr, | ||
| uint8_t | imm | ||
| ) |
alu_mvi – Move Immediate (MVI, §5.5.5.2)
Stores the immediate byte @imm into mem[@addr]. Does not alter the condition code.
Definition at line 51 of file alu_logic.c.
| void alu_nc | ( | struct ge * | ge, |
| uint16_t | a, | ||
| uint16_t | b, | ||
| uint8_t | len | ||
| ) |
alu_nc – AND Characters (NC, §5.5.3.9)
Performs a bitwise AND of the @len-byte field at with the @len-byte field at ; result written back into . Operates left-to-right. "Qualitative result: it is not interested." — CC is not altered.
Definition at line 61 of file alu_logic.c.
| void alu_ni | ( | struct ge * | ge, |
| uint16_t | addr, | ||
| uint8_t | imm | ||
| ) |
alu_ni – AND Immediate (NI, §5.6.3.2)
mem[@addr] &= @imm. "Qualitative result: it is not interested." — CC is not altered.
Definition at line 108 of file alu_logic.c.
| void alu_oc | ( | struct ge * | ge, |
| uint16_t | a, | ||
| uint16_t | b, | ||
| uint8_t | len | ||
| ) |
alu_oc – OR Characters (OC, §5.5.3.8)
Bitwise OR of @len bytes at with @len bytes at ; result into . "Qualitative result: it is not interested." — CC is not altered.
Definition at line 73 of file alu_logic.c.
| void alu_oi | ( | struct ge * | ge, |
| uint16_t | addr, | ||
| uint8_t | imm | ||
| ) |
Definition at line 118 of file alu_logic.c.
| 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)
For each of the @len bytes b at mem[.. +len-1], replaces it with mem[@table + b]. The @table base address must be a multiple of 256 (per manual). Operates left to right. The table is not altered. "Qualitative result: it is not interested." — CC is not altered.
Definition at line 203 of file alu_logic.c.
| void alu_tm | ( | struct ge * | ge, |
| uint16_t | addr, | ||
| uint8_t | mask | ||
| ) |
alu_tm – Test under Mask (TM, §5.6.3.4)
Performs bitwise AND of mem[@addr] and @mask but does NOT write the result to memory. Sets CC: cc = 2 result is 0x00 (all selected bits are zero) cc = 3 result is non-zero (at least one selected bit is set)
Definition at line 226 of file alu_logic.c.
| 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)
Bitwise XOR of @len bytes at with @len bytes at ; result into . Sets CC: cc = 2 if all bytes of the result are 0x00 cc = 3 if any byte of the result is non-zero
Definition at line 85 of file alu_logic.c.
| void alu_xi | ( | struct ge * | ge, |
| uint16_t | addr, | ||
| uint8_t | imm | ||
| ) |
alu_xi – Exclusive-OR Immediate (XI, §5.6.3.3)
mem[@addr] ^= @imm. Sets CC: cc = 2 if result is 0x00 cc = 3 if result is non-zero
Definition at line 136 of file alu_logic.c.