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, #bind_cmd, #offset?, #offset_flags, #parse_value, #strip_offset
Instance Method Details
#cmd_add(a, b) ⇒ Object
15
16
17
18
19
|
# File 'lib/haxor/compiler/component/arithmetic.rb', line 15
def cmd_add(a, b)
add Token::Cmd.new(Vm::Cpu::Unit::Arithmetic::OP_ADD | offset_flags(a, b))
parse_value a
parse_value b
end
|
#cmd_cmp(a, b) ⇒ Object
37
38
39
40
41
|
# File 'lib/haxor/compiler/component/arithmetic.rb', line 37
def cmd_cmp(a, b)
add Token::Cmd.new(Vm::Cpu::Unit::Arithmetic::OP_CMP | offset_flags(a, b))
parse_value a
parse_value b
end
|
#cmd_sub(a, b) ⇒ Object
21
22
23
24
25
|
# File 'lib/haxor/compiler/component/arithmetic.rb', line 21
def cmd_sub(a, b)
add Token::Cmd.new(Vm::Cpu::Unit::Arithmetic::OP_SUB | offset_flags(a, b))
parse_value a
parse_value 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
|