Class: Haxor::Compiler::Component::Arithmetic
- Inherits:
-
Base
- Object
- Base
- Haxor::Compiler::Component::Arithmetic
show all
- Defined in:
- lib/haxor/compiler/component/arithmetic.rb
Instance Attribute Summary
Attributes inherited from Base
#compiler
Instance Method Summary
collapse
Methods inherited from Base
#add, #add_cmd, #bind_cmd, #offset?, #offset_flags, #parse_value, #strip_offset
Instance Method Details
#cmd_add(a, b) ⇒ Object
15
16
17
|
# File 'lib/haxor/compiler/component/arithmetic.rb', line 15
def cmd_add(a, b)
add_cmd Vm::Cpu::Unit::Arithmetic::OP_ADD, a, b
end
|
#cmd_cmp(a, b) ⇒ Object
31
32
33
|
# File 'lib/haxor/compiler/component/arithmetic.rb', line 31
def cmd_cmp(a, b)
add_cmd Vm::Cpu::Unit::Arithmetic::OP_CMP, a, b
end
|
#cmd_dec(a) ⇒ Object
39
40
41
|
# File 'lib/haxor/compiler/component/arithmetic.rb', line 39
def cmd_dec(a)
add_cmd Vm::Cpu::Unit::Arithmetic::OP_DEC, a
end
|
#cmd_div(a) ⇒ Object
23
24
25
|
# File 'lib/haxor/compiler/component/arithmetic.rb', line 23
def cmd_div(a)
add_cmd Vm::Cpu::Unit::Arithmetic::OP_DIV, a
end
|
#cmd_inc(a) ⇒ Object
35
36
37
|
# File 'lib/haxor/compiler/component/arithmetic.rb', line 35
def cmd_inc(a)
add_cmd Vm::Cpu::Unit::Arithmetic::OP_INC, a
end
|
#cmd_mul(a) ⇒ Object
27
28
29
|
# File 'lib/haxor/compiler/component/arithmetic.rb', line 27
def cmd_mul(a)
add_cmd Vm::Cpu::Unit::Arithmetic::OP_MUL, a
end
|
#cmd_sub(a, b) ⇒ Object
19
20
21
|
# File 'lib/haxor/compiler/component/arithmetic.rb', line 19
def cmd_sub(a, b)
add_cmd Vm::Cpu::Unit::Arithmetic::OP_SUB, a, b
end
|
#register ⇒ Object
5
6
7
8
9
10
11
12
13
|
# File 'lib/haxor/compiler/component/arithmetic.rb', line 5
def register
bind_cmd 'inc', :cmd_inc
bind_cmd 'dec', :cmd_dec
bind_cmd 'add', :cmd_add
bind_cmd 'sub', :cmd_sub
bind_cmd 'div', :cmd_div
bind_cmd 'mul', :cmd_mul
bind_cmd 'cmp', :cmd_cmp
end
|