Memory Block - sjsoftware/centurion-cpu6 GitHub Wiki
Memory Block Instructions
There are 10 Memory Block instructions.
| Byte 1 | Byte 2 | Byte 4 - |
|--------------|------------------|-----------|
| | | 7654 | 3 2 | 1 0 | |
| 4 6 | S M N | Operands |
- S = Instruction Selector (0-9 are legal)
- M = Extended Addressing mode for first block operand
- N = Extended Addressing mode for second block operand'
47 and 67 differences
The 67 variants of the instructions pass the length/terminator operands in AH and AL. AH holds the terminator, AL holds the length. TODO: Confirm this for all the instructions
| Selector | Opcode | 1st Operand | 2nd Operand | 3rd Operand | 4th Operand | Description |
|---|---|---|---|---|---|---|
| 0 | CVX | Memory | Memory | Implements most of the Centurion binary record format in Microcode. First operand is the base address for the segment to load, Second operand is the address of the segment. Returns base + segment address in A, segment address + segment length in Z. Fault is set if the checksum fails or relocation segments have odd length. Value is set if the segment has zero length | ||
| 1 | CPV | Terminator | Memory | Memory | Compares two strings (case insensitive) until Terminator is reached. Flags are set based on Operand 3 being greater than Operand 2 in dictionary ordering. Sets Y and Z to byte after first difference (or byte after terminator) for Operand 2 and 3 respectively. F is set if there is no difference or end of string within 256 bytes. | |
| 2 | MVV | Length - 1 | Terminator | Memory | Memory | Copies from Operand 3 to Operand 4 until matching byte is found. Sets Fault if no match found. Sets Y to match in Operand 3. Sets Z to match in Operand 4 |
| 3 | SCN | Length - 1 | Memory | Memory | Find the first occurrence of a character type in a string | |
| 4 | MVF | Length - 1 | Memory/Immediate | Memory | Copy block of memory from Operand 2 to Operand 3. Y and Z are set to the byte following the copied memory in Operand 2 and 3 respectively. Value is set if all the bytes copied are zero | |
| 5 | ANC | Length - 1 | Memory/Immediate | Memory | AND operation applied to each respective byte in Operand 2 and 3 and stored in Operand 3 | |
| 6 | ORC | Length - 1 | Memory/Immediate | Memory | OR operation applied to each respective byte in Operand 2 and 3 and stored in Operand 3 | |
| 7 | XRC | Length - 1 | Memory/Immediate | Memory | XOR operation applied to each respective byte in Operand 2 and 3 and stored in Operand 3 | |
| 8 | CPF | Length - 1 | Memory/Immediate | Memory | compare two blocks of memory. Returns flags based on Operand 3 byte - Operand 2 byte. F is set if there is no difference between the two blocks | |
| 9 | FIL | Length - 1 | Memory/Immediate | Memory | copies byte at Operand 2 repeated to Operand 3 |