class
Synacor::VM
- Synacor::VM
- Reference
- Object
Defined in:
synacor/vm.crConstant Summary
-
INVALID_VALUE =
MAX_VALUE + 8 -
MAX_VALUE =
(2 ** 15).to_u16 -
REGISTERS =
MAX_VALUE...INVALID_VALUE
Constructors
Instance Method Summary
- #input : IO::Memory
- #input=(input : IO::Memory)
- #load(binary_path : String)
- #main_loop
- #main_loop(&block : Int32, Int32 -> Bool)
-
#memory : StaticArray(UInt16, 32768)
memory with 15-bit address space storing 16-bit values
-
#memory=(memory : StaticArray(UInt16, 32768))
memory with 15-bit address space storing 16-bit values
- #op_add(reg : Int32, a : UInt16, b : UInt16, &)
- #op_and(reg : Int32, a : UInt16, b : UInt16, &)
- #op_call(a : UInt16)
- #op_eq(reg : Int32, a : UInt16, b : UInt16, &)
- #op_gt(reg : Int32, a : UInt16, b : UInt16, &)
- #op_halt
- #op_in(reg : Int32, &)
- #op_jf(a : UInt16, b : UInt16, &block : -> )
- #op_jmp(value : UInt16)
- #op_jt(a : UInt16, b : UInt16, &block : -> )
- #op_mod(reg : Int32, a : UInt16, b : UInt16, &)
- #op_mult(reg : Int32, a : UInt16, b : UInt16, &)
- #op_noop(&)
- #op_not(reg : Int32, value : UInt16, &)
- #op_or(reg : Int32, a : UInt16, b : UInt16, &)
- #op_out(value : UInt16, &)
- #op_pop(reg : Int32, &block : -> )
- #op_push(value : UInt16, &)
- #op_ret
- #op_rmem(reg : Int32, addr : UInt16, &)
- #op_set(reg : Int32, value : UInt16, &)
- #op_wmem(addr : UInt16, value : UInt16, &)
- #output : ACON::Output::Interface
- #output=(output : ACON::Output::Interface)
-
#pc : Int32
program counter
-
#pc=(pc : Int32)
program counter
- #register_at(index : Int32) : Int32
-
#registers : StaticArray(UInt16, 8)
eight registers
-
#registers=(registers : StaticArray(UInt16, 8))
eight registers
-
#stack : Deque(UInt16)
unbounded stack which holds individual 16-bit values
-
#stack=(stack : Deque(UInt16))
unbounded stack which holds individual 16-bit values
- #to_register(value : UInt16) : Int32
- #to_value(value : UInt16) : UInt16
- #value_at(index : Int32) : UInt16
Constructor Detail
Instance Method Detail
def memory=(memory : StaticArray(UInt16, 32768))
#
memory with 15-bit address space storing 16-bit values