Class: CPURegs

CPURegs()

The register array of the CPU.

Constructor

new CPURegs()

Create the register array. The registers are pre-allocated as Word objects. The number of registers is defined by the constant REGISTERS_COUNT under the system constants. At least 4 registers are required.
Properties:
Name Type Description
registers Array.<Word> The array of CPU registers
Source:

Classes

CPURegs

Methods

read_reg(index) → {Array.<Tri>}

Reads a word from the register specified by the index, which must be within the bounds of the size of the register array.
Parameters:
Name Type Description
index number the index of the register to read from
Source:
Throws:
- if the index is reserved or out of bounds
Type
Error
Returns:
- the word stored in the register
Type
Array.<Tri>

write_reg(word, index)

Writes a word to the register specified by the index, which must be within the bounds of the size of the register array.
Parameters:
Name Type Description
word Array.<Tri> the word to write to the register
index number the index of the register to write to
Source:
Throws:
- if the index is reserved or out of bounds
Type
Error