Class: Haxor::Vm::Cpu::Unit::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/haxor/vm/cpu/unit/base.rb

Direct Known Subclasses

Arithmetic, Jumps, Logical, Transfer, Various

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#vm ⇒ Object

Returns the value of attribute vm.



6
7
8
# File 'lib/haxor/vm/cpu/unit/base.rb', line 6

def vm
  @vm
end

Instance Method Details

#bind_opcode(opcode, method) ⇒ Object



12
13
14
# File 'lib/haxor/vm/cpu/unit/base.rb', line 12

def bind_opcode(opcode, method)
  @vm.bind_opcode opcode, self, method
end

#dereference(addr) ⇒ Object



26
27
28
# File 'lib/haxor/vm/cpu/unit/base.rb', line 26

def dereference(addr)
  @vm.subsystem(:mem).read addr
end

#fetch_cell(addr) ⇒ Object

TODO: BC



22
23
24
# File 'lib/haxor/vm/cpu/unit/base.rb', line 22

def fetch_cell(addr)
  @vm.subsystem(:mem).read addr
end

#next_cell ⇒ Object

TODO: BC



17
18
19
# File 'lib/haxor/vm/cpu/unit/base.rb', line 17

def next_cell
  @vm.subsystem(:mem).next_word
end

#operand ⇒ Object



35
36
37
# File 'lib/haxor/vm/cpu/unit/base.rb', line 35

def operand
  @vm.operand
end

#operands ⇒ Object



39
40
41
# File 'lib/haxor/vm/cpu/unit/base.rb', line 39

def operands
  @vm.operands
end

#register ⇒ Object



8
9
10
# File 'lib/haxor/vm/cpu/unit/base.rb', line 8

def register
  fail 'this method must be implemented.'
end

#replace_cell(addr, value) ⇒ Object

TODO: BC



31
32
33
# File 'lib/haxor/vm/cpu/unit/base.rb', line 31

def replace_cell(addr, value)
  @vm.subsystem(:mem).write addr, value
end