module Lc3Vm

Extended Modules

Defined in:

lc3_vm.cr
lc3_vm/flags.cr
lc3_vm/memory.cr
lc3_vm/registers.cr
lc3_vm/traps.cr

Constant Summary

MEMORY = Memory.new
NOPS = 16
OP_FUNS = [->(instruction : UInt16) do branch(instruction) end, ->(instruction : UInt16) do add(instruction) end, ->(instruction : UInt16) do load(instruction) end, ->(instruction : UInt16) do store(instruction) end, ->(instruction : UInt16) do jump_subroutine(instruction) end, ->(instruction : UInt16) do and(instruction) end, ->(instruction : UInt16) do load_from_register(instruction) end, ->(instruction : UInt16) do store_from_register(instruction) end, ->(instruction : UInt16) do end, ->(instruction : UInt16) do not(instruction) end, ->(instruction : UInt16) do load_indirect(instruction) end, ->(instruction : UInt16) do store_indirect(instruction) end, ->(instruction : UInt16) do jump(instruction) end, ->(instruction : UInt16) do end, ->(instruction : UInt16) do load_effective_address(instruction) end, ->(instruction : UInt16) do trap(instruction) end]
PC_START = UInt16.new(12288)
REG = Registry.new
TRAPS_VECTOR = [Traps.get_char, Traps.put_char, Traps.puts_word, Traps.get_char_echo, Traps.puts_byte, Traps.halt, Traps.get_word, Traps.put_word]
VERSION = "0.1.0"

Instance Method Summary

Instance Method Detail

def add(instruction : UInt16) #

[View source]
def add_const(dr : UInt16, src : UInt16, val : UInt16) #

[View source]
def add_reg(dr : UInt16, src1 : UInt16, src2 : UInt16) #

[View source]
def and(instruction : UInt16) #

[View source]
def and_const(dr : UInt16, src : UInt16, val : UInt16) #

[View source]
def and_reg(dr : UInt16, src1 : UInt16, src2 : UInt16) #

[View source]
def branch(instruction : UInt16) #

[View source]
def debug_info #

[View source]
def execute(instruction) #

[View source]
def extract_dr(instruction : UInt16) : UInt16 #

[View source]
def extract_imm_mode(instruction : UInt16) : UInt16 #

[View source]
def extract_offset(instruction : UInt16, size : UInt16) : UInt16 #

[View source]
def extract_src1(instruction : UInt16) : UInt16 #

[View source]
def extract_src2(instruction : UInt16) : UInt16 #

[View source]
def extract_trap_vector(instruction) #

[View source]
def extract_value(instruction : UInt16) : UInt16 #

[View source]
def jump(instruction : UInt16) #

[View source]
def jump_subroutine(instruction : UInt16) #

[View source]
def load(instruction : UInt16) #

[View source]
def load_effective_address(instruction : UInt16) #

[View source]
def load_from_register(instruction : UInt16) #

[View source]
def load_image #

[View source]
def load_indirect(instruction : UInt16) #

[View source]
def not(instruction : UInt16) #

[View source]
def operation(instruction : UInt16) #

[View source]
def reset #

[View source]
def running #

[View source]
def set_flags(register : UInt16) #

[View source]
def start #

[View source]
def stop #

[View source]
def store(instruction : UInt16) #

[View source]
def store_from_register(instruction : UInt16) #

[View source]
def store_indirect(instruction : UInt16) #

[View source]
def trap(instruction : UInt16) #

[View source]