class

Synacor::VM

Inherits Reference < Object

Constants

INVALID_VALUE = MAX_VALUE + 8
MAX_VALUE = (2 ** 15).to_u16
REGISTERS = MAX_VALUE...INVALID_VALUE

Constructors

new(input : IO::Memory, output : Athena::Console::Output::Interface)
Source

Instance methods

input
Source
input=(input : IO::Memory)
Source
load(binary_path : String)
Source
main_loop
Source
main_loop
Source
memory

memory with 15-bit address space storing 16-bit values

Source
memory=(memory : StaticArray(UInt16, 32768))

memory with 15-bit address space storing 16-bit values

Source
op_add(reg : Int32, a : UInt16, b : UInt16, &)
Source
op_and(reg : Int32, a : UInt16, b : UInt16, &)
Source
op_call(a : UInt16)
Source
op_eq(reg : Int32, a : UInt16, b : UInt16, &)
Source
op_gt(reg : Int32, a : UInt16, b : UInt16, &)
Source
op_halt
Source
op_in(reg : Int32, &)
Source
op_jf(a : UInt16, b : UInt16, &block : -> )
Source
op_jmp(value : UInt16)
Source
op_jt(a : UInt16, b : UInt16, &block : -> )
Source
op_mod(reg : Int32, a : UInt16, b : UInt16, &)
Source
op_mult(reg : Int32, a : UInt16, b : UInt16, &)
Source
op_noop
Source
op_not(reg : Int32, value : UInt16, &)
Source
op_or(reg : Int32, a : UInt16, b : UInt16, &)
Source
op_out(value : UInt16, &)
Source
op_pop(reg : Int32, &block : -> )
Source
op_push(value : UInt16, &)
Source
op_ret
Source
op_rmem(reg : Int32, addr : UInt16, &)
Source
op_set(reg : Int32, value : UInt16, &)
Source
op_wmem(addr : UInt16, value : UInt16, &)
Source
output
Source
output=(output : ACON::Output::Interface)
Source
pc

program counter

Source
pc=(pc : Int32)

program counter

Source
register_at(index : Int32) : Int32
Source
registers

eight registers

Source
registers=(registers : StaticArray(UInt16, 8))

eight registers

Source
stack

unbounded stack which holds individual 16-bit values

Source
stack=(stack : Deque(UInt16))

unbounded stack which holds individual 16-bit values

Source
to_register(value : UInt16) : Int32
Source
to_value(value : UInt16) : UInt16
Source
value_at(index : Int32) : UInt16
Source

Nested types