Class: Haxor::Token::Cmd
Instance Attribute Summary collapse
-
#cmd ⇒ Object
Returns the value of attribute cmd.
-
#flags ⇒ Object
Returns the value of attribute flags.
-
#imm ⇒ Object
Returns the value of attribute imm.
-
#opts ⇒ Object
Returns the value of attribute opts.
-
#reg1 ⇒ Object
Returns the value of attribute reg1.
-
#reg2 ⇒ Object
Returns the value of attribute reg2.
-
#reg3 ⇒ Object
Returns the value of attribute reg3.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize ⇒ Cmd
constructor
A new instance of Cmd.
- #size ⇒ Object
- #to_bytecode ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Cmd
Returns a new instance of Cmd.
12 13 14 15 16 17 18 19 20 |
# File 'lib/haxor/token/cmd.rb', line 12 def initialize @cmd = 0 @flags = 0 @reg1 = 0 @reg2 = 0 @reg3 = 0 @imm = 0 @opts = [] end |
Instance Attribute Details
#cmd ⇒ Object
Returns the value of attribute cmd.
4 5 6 |
# File 'lib/haxor/token/cmd.rb', line 4 def cmd @cmd end |
#flags ⇒ Object
Returns the value of attribute flags.
5 6 7 |
# File 'lib/haxor/token/cmd.rb', line 5 def flags @flags end |
#imm ⇒ Object
Returns the value of attribute imm.
9 10 11 |
# File 'lib/haxor/token/cmd.rb', line 9 def imm @imm end |
#opts ⇒ Object
Returns the value of attribute opts.
10 11 12 |
# File 'lib/haxor/token/cmd.rb', line 10 def opts @opts end |
#reg1 ⇒ Object
Returns the value of attribute reg1.
6 7 8 |
# File 'lib/haxor/token/cmd.rb', line 6 def reg1 @reg1 end |
#reg2 ⇒ Object
Returns the value of attribute reg2.
7 8 9 |
# File 'lib/haxor/token/cmd.rb', line 7 def reg2 @reg2 end |
#reg3 ⇒ Object
Returns the value of attribute reg3.
8 9 10 |
# File 'lib/haxor/token/cmd.rb', line 8 def reg3 @reg3 end |
Instance Method Details
#to_bytecode ⇒ Object
26 27 28 29 |
# File 'lib/haxor/token/cmd.rb', line 26 def to_bytecode data = Utils.encode_opcode @cmd, @flags, @reg1, @reg2, @reg3, @imm [data].pack Consts::WORD_UNPACK end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/haxor/token/cmd.rb', line 31 def to_s "CMD code:[0x#{@cmd.to_s(16)}], flags:[#{@flags.to_s(2)}], regs:[#{@reg1}, #{@reg2}, #{@reg3}], imm:[#{@imm}], opts:#{@opts}" end |