Class: Haxor::Compiler::Component::Transfer

Inherits:
Base
  • Object
show all
Defined in:
lib/haxor/compiler/component/transfer.rb

Instance Attribute Summary

Attributes inherited from Base

#compiler

Instance Method Summary collapse

Methods inherited from Base

#add, #bind_cmd, #offset?, #offset_flags, #parse_value, #strip_offset

Instance Method Details

#cmd_mov(a, b) ⇒ Object



21
22
23
24
25
# File 'lib/haxor/compiler/component/transfer.rb', line 21

def cmd_mov(a, b)
  add Token::Cmd.new(Vm::Cpu::Unit::Transfer::OP_MOV | offset_flags(a, b))
  parse_value a
  parse_value b
end

#cmd_pop(a) ⇒ Object



16
17
18
19
# File 'lib/haxor/compiler/component/transfer.rb', line 16

def cmd_pop(a)
  add Token::Cmd.new(Vm::Cpu::Unit::Transfer::OP_POP | offset_flags(a))
  parse_value a
end

#cmd_push(a) ⇒ Object



11
12
13
14
# File 'lib/haxor/compiler/component/transfer.rb', line 11

def cmd_push(a)
  add Token::Cmd.new(Vm::Cpu::Unit::Transfer::OP_PUSH | offset_flags(a))
  parse_value a
end

#register ⇒ Object



5
6
7
8
9
# File 'lib/haxor/compiler/component/transfer.rb', line 5

def register
  bind_cmd 'mov', :cmd_mov
  bind_cmd 'push', :cmd_push
  bind_cmd 'pop', :cmd_pop
end