This section shows all Govno Core 16X registers.
General purpose registers are 16-bit registers that can be used to save data for user program purposes.
Also see Register cluster
Nibble | GP register |
$0 | A/AX |
$1 | B/BX |
$2 | C/CX |
$3 | D/DX |
$4 | S/SI |
$5 | G/GI |
$6 | SP |
$7 | BP |
$8 | E/EX |
$9 | F/FX |
$A | H/HX |
$B | L/LX |
$C | X |
$D | Y |
$E | IX |
$F | IY |
The stack pointer is a 16-bit register that is pointing to the (lowest byte of a 16-bit value on the stack)-1, or, to the top of the stack.
The base pointer is a 16-bit register that is pointing somewhere in the stack. Do i look like i use it?
The program counter is a 16-bit register that stores the current instruction being executed.
It can be modified using jumps, calls and returns
Register cluster is a byte containing 2 register addresses. The address to the register is 4 bits long (there are 16 cluster-addressable registers). So, one byte can contain 2 registers in it.
Example register cluster: $41 → 0100|0001 → %s|%b
See register table to find the addresses for every register.
Instruction size can be 1 byte (like RET - $33) or 2 byte (like LDA[i] - $6605). 2-byte instructions in Govno Core 16X are called "word instructions". First byte of a word instruction defines its type (ex. LDA starts with $66, and page $66 is a word-sized register-manipulating operation).
Page | Meaning |
No page | General purpose operation |
$0F | Control flow/stack operation |
$10 | Math operation |
Instruction prefix is a byte attached to the start of an opcode that gives additional information about the operands.
Example: Instruction $40 is LDA(imm16), but with the $93 prefix (the whole opcode would be $9340), it would mean LDA(imm16+%s+%g).
Prefix | Meaning |
$91 | +%s |
$92 | +%g |
$93 | +%s+%g |
$94 | +%ix |
$95 | +%ix+%s |
$96 | +%ix+%g |
$97 | +%ix+%s+%g |
$98 | +%iy |
$99 | +%iy+%s |
$9A | +%iy+%g |
$9B | +%iy+%s+%g |
$9C | +%iy+%ix |
$9D | +%iy+%ix+%s |
$9E | +%iy+%ix+%g |
$9F | +%iy+%ix+%s+%g |
The instruction adds the contents of two registers/memory location/immediate.
Addressing mode | Opcode | Instruction | Size |
---|---|---|---|
rc8 | $1000 | Add %rc1 to %rc0 | 3 |
imm16 | $1008 | Add $i to A register | 4 |
imm16 | $1009 | Add $i to B register | 4 |
imm16 | $100A | Add $i to C register | 4 |
imm16 | $100B | Add $i to D register | 4 |
imm16 | $100C | Add $i to S register | 4 |
imm16 | $100D | Add $i to G register | 4 |
Performing the bitwise AND to two registers.
Addressing mode | Opcode | Instruction | Size |
---|---|---|---|
rc8 | $10D8 | Bitwise and for %rc0 and %rc1 | 3 |
Clearing the carry flag.
Addressing mode | Opcode | Instruction | Size |
---|---|---|---|
Implied | $36 | Clear carry | 1 |
Compare registers/immediate values and set the flags.
Flags after the instruction:
C | Carry flag | Not affected |
Z | Zero flag | Set if values are equal |
Addressing mode | Opcode | Instruction | Size |
---|---|---|---|
rc8 | $10F6 | Compare %rc0 and %rc1 | 3 |
reg8,imm16 | $10EE | Compare %r and $i | 5 |
The instruction loads the contents of register/memory location/immediate into the AX register.
Addressing mode | Opcode | Instruction | Size |
---|---|---|---|
imm16 | $40 | Set AX to an immediate value | 3 |
mz8 | $D8 | Set AX to a Zero Page address value | 2 |
addr16 | $A0 | Set AX to a memory address value | 3 |
reg16 | $77 | Set AX to a register value | 2 |
See LDA examples
The instruction loads the contents of register/memory location/immediate into the BX register.
Addressing mode | Opcode | Instruction | Size |
---|---|---|---|
imm16 | $41 | Set BX to an immediate value | 3 |
mz8 | $D9 | Set BX to a Zero Page address value | 2 |
addr16 | $A1 | Set BX to a memory address value | 3 |
reg16 | $78 | Set BX to a register value | 2 |
The instruction loads the contents of register/memory location/immediate into the CX register.
Addressing mode | Opcode | Instruction | Size |
---|---|---|---|
imm16 | $42 | Set CX to an immediate value | 3 |
mz8 | $DA | Set CX to a Zero Page address value | 2 |
addr16 | $A2 | Set CX to a memory address value | 3 |
reg16 | $79 | Set CX to a register value | 2 |
The instruction loads the contents of register/memory location/immediate into the DX register.
Addressing mode | Opcode | Instruction | Size |
---|---|---|---|
imm16 | $43 | Set DX to an immediate value | 3 |
mz8 | $DB | Set DX to a Zero Page address value | 2 |
ma16 | $A3 | Set DX to a memory address value | 3 |
reg16 | $7A | Set DX to a register value | 2 |
main: lda $50 ; imm16 ldd $69 lda %d ; reg16 lad ($69) ; mz8 lda ($8000) ; ma16