Documentation ¶
Index ¶
- Constants
- type Coordinate
- type Device
- type Display
- type Fifo
- type Flags
- type Instruction
- type Machine
- func (m *Machine) DumpFlags()
- func (m *Machine) DumpMemory()
- func (m *Machine) DumpRegisters()
- func (m *Machine) DumpStatus()
- func (m *Machine) Explain()
- func (m *Machine) Jump(address uint16)
- func (m *Machine) Load(memory []byte)
- func (m *Machine) ReadAddress(address uint16) uint16
- func (m *Machine) ReadAddressFromNextOffset() uint16
- func (m *Machine) ReadAddressFromNextPointer() uint16
- func (m *Machine) ReadAddressOffset(offset uint16) uint16
- func (m *Machine) ReadByteAddress(address uint16) byte
- func (m *Machine) ReadByteOffset(offset uint16) byte
- func (m *Machine) ReadBytePointer(pointer uint16) byte
- func (m *Machine) ReadNextAddress() uint16
- func (m *Machine) ReadNextByte() byte
- func (m *Machine) Run()
- func (m *Machine) Stop()
- type Register
- type Surface
Constants ¶
View Source
const ( RESET_CURSOR = 0x00 MOVE_CURSOR_RIGHT = 0x10 MOVE_CURSOR_LEFT = 0x11 MOVE_CURSOR_DOWN = 0x12 MOVE_CURSOR_UP = 0x13 FRAMES_PER_SECOND = 5 )
View Source
const ( STOP = 0x00 // Halts the machine. No further instructions will be executed. WAIT = 0x01 // Wait for an interruption. Effectively pauses the machine. )
View Source
const ( LOAD_BYTE = 0x11 LOAD_ADDRESS = 0x12 LOAD_OFFSET = 0x13 LOAD_POINTER = 0x14 STORE_BYTE_ADDRESS = 0x15 STORE_BYTE_OFFSET = 0x16 STORE_BYTE_POINTER = 0x17 STORE_REGISTER_ADDRESS = 0x18 STORE_REGISTER_OFFSET = 0x19 STORE_REGISTER_POINTER = 0x1A COPY_REGISTER = 0x1B COPY_ADDRESS_ADDRESS = 0x1C COPY_ADDRESS_OFFSET = 0x1D COPY_ADDRESS_POINTER = 0x1E COPY_OFFSET_ADDRESS = 0x1F COPY_OFFSET_OFFSET = 0x20 COPY_OFFSET_POINTER = 0x21 COPY_POINTER_ADDRESS = 0x22 COPY_POINTER_OFFSET = 0x23 COPY_POINTER_POINTER = 0x24 )
View Source
const ( INCREMENT byte = 0x80 // Increment register DECREMENT byte = 0x81 // Decrement register )
View Source
const ( ADD byte = 0x82 SUBTRACT byte = 0x83 MULTIPLY byte = 0x84 DIVIDE byte = 0x85 )
View Source
const ( AND byte = 0x86 OR byte = 0x87 XOR byte = 0x88 NOT byte = 0x89 )
View Source
const ( JUMP_ADDRESS byte = 0x90 JUMP_OFFSET byte = 0x91 JUMP_POINTER byte = 0x92 JUMP_EQUAL_ADDRESS byte = 0x93 JUMP_EQUAL_OFFSET byte = 0x94 JUMP_EQUAL_POINTER byte = 0x95 JUMP_NOT_EQUAL_ADDRESS byte = 0x96 JUMP_NOT_EQUAL_OFFSET byte = 0x97 JUMP_NOT_EQUAL_POINTER byte = 0x98 JUMP_GREATER_ADDRESS byte = 0x99 JUMP_GREATER_OFFSET byte = 0x9A JUMP_GREATER_POINTER byte = 0x9B JUMP_GREATER_EQUAL_ADDRESS byte = 0x9C JUMP_GREATER_EQUAL_OFFSET byte = 0x9D JUMP_GREATER_EQUAL_POINTER byte = 0x9E JUMP_LESS_ADDRESS byte = 0x9F JUMP_LESS_OFFSET byte = 0xA0 JUMP_LESS_POINTER byte = 0xA1 JUMP_LESS_EQUAL_ADDRESS byte = 0xA2 JUMP_LESS_EQUAL_OFFSET byte = 0xA3 JUMP_LESS_EQUAL_POINTER byte = 0xA4 )
Branching instructions
View Source
const ( INPUT byte = 0xB0 OUTPUT byte = 0xC0 )
View Source
const ( COMPARE_REGISTER_REGISTER = 0xD0 COMPARE_REGISTER_VALUE = 0xD1 COMPARE_REGISTER_ABSOLUTE = 0xD2 COMPARE_REGISTER_OFFSET = 0xD3 COMPARE_REGISTER_POINTER = 0xD4 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Coordinate ¶
type Coordinate struct {
// contains filtered or unexported fields
}
type Fifo ¶
type Fifo struct {
// contains filtered or unexported fields
}
First-input first-output device
type Instruction ¶
type Instruction struct {
// contains filtered or unexported fields
}
type Machine ¶
type Machine struct { Name string Registers [16]Register Memory []byte ProgramCounter uint16 Flags Flags Devices [255]Device // contains filtered or unexported fields }
func (*Machine) DumpMemory ¶
func (m *Machine) DumpMemory()
func (*Machine) DumpRegisters ¶
func (m *Machine) DumpRegisters()
func (*Machine) DumpStatus ¶
func (m *Machine) DumpStatus()
func (*Machine) ReadAddress ¶
func (*Machine) ReadAddressFromNextOffset ¶
Assumes that the next memory location is an offset from the current program counter.
func (*Machine) ReadAddressFromNextPointer ¶
Assumes that the next memory location contains a pointer to a memory location that holds an address
func (*Machine) ReadAddressOffset ¶
func (*Machine) ReadByteAddress ¶
func (*Machine) ReadByteOffset ¶
func (*Machine) ReadBytePointer ¶
func (*Machine) ReadNextAddress ¶
func (*Machine) ReadNextByte ¶
Click to show internal directories.
Click to hide internal directories.