Class: Ronin::Code::ASM::Register
- Inherits:
-
Struct
- Object
- Struct
- Ronin::Code::ASM::Register
- Defined in:
- lib/ronin/code/asm/register.rb
Overview
Represents a Register.
Instance Attribute Summary collapse
-
#general ⇒ Object
Returns the value of attribute general.
-
#name ⇒ Object
Returns the value of attribute name.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
-
#*(scale) ⇒ MemoryOperand
Multiples the value within the register.
-
#+(offset) ⇒ MemoryOperand
Adds an offset to the value within the register and dereferences the address.
-
#-(offset) ⇒ MemoryOperand
Subtracts from the value within the register and dereferences the address.
-
#initialize(name, width, general = false) ⇒ Register
constructor
Initializes a register.
-
#to_s ⇒ String
The register's name.
Constructor Details
#initialize(name, width, general = false) ⇒ Register
Initializes a register.
43 44 45 |
# File 'lib/ronin/code/asm/register.rb', line 43 def initialize(name,width,general=false) super(name,width,general) end |
Instance Attribute Details
#general ⇒ Object
Returns the value of attribute general
29 30 31 |
# File 'lib/ronin/code/asm/register.rb', line 29 def general @general end |
#name ⇒ Object
Returns the value of attribute name
29 30 31 |
# File 'lib/ronin/code/asm/register.rb', line 29 def name @name end |
#width ⇒ Object
Returns the value of attribute width
29 30 31 |
# File 'lib/ronin/code/asm/register.rb', line 29 def width @width end |
Instance Method Details
#*(scale) ⇒ MemoryOperand
Multiples the value within the register.
96 97 98 |
# File 'lib/ronin/code/asm/register.rb', line 96 def *(scale) MemoryOperand.new(nil,0,self,scale) end |
#+(offset) ⇒ MemoryOperand
Adds an offset to the value within the register and dereferences the address.
60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/ronin/code/asm/register.rb', line 60 def +(offset) case offset when MemoryOperand MemoryOperand.new(self,offset.offset,offset.index,offset.scale) when Register MemoryOperand.new(self,0,offset) when Integer MemoryOperand.new(self,offset) else raise(TypeError,"offset was not an MemoryOperand, Register or Integer") end end |
#-(offset) ⇒ MemoryOperand
Subtracts from the value within the register and dereferences the address.
83 84 85 |
# File 'lib/ronin/code/asm/register.rb', line 83 def -(offset) MemoryOperand.new(self,-offset) end |
#to_s ⇒ String
Returns The register's name.
104 105 106 |
# File 'lib/ronin/code/asm/register.rb', line 104 def to_s self.name.to_s end |