class Ronin::ASM::Register
Represents a Register
.
Public Class Methods
new(name,width,general=false)
click to toggle source
Initializes a register.
@param [Symbol] name
The register name.
@param [Integer] width
The width of the register.
@param [Boolean] general
Specifies whether the register is a General Purpose Register (GPR).
Calls superclass method
# File lib/ronin/asm/register.rb, line 43 def initialize(name,width,general=false) super(name,width,general) end
Public Instance Methods
*(scale)
click to toggle source
Multiples the value within the register.
@param [Integer] scale
The scale to multiply the value within register by.
@return [MemoryOperand]
The new Memory Operand.
# File lib/ronin/asm/register.rb, line 96 def *(scale) MemoryOperand.new(nil,0,self,scale) end
+(offset)
click to toggle source
Adds an offset to the value within the register and dereferences the address.
@param [MemoryOperand, Register
, Integer] offset
The offset to add to the value of the register.
@return [MemoryOperand]
The new Memory Operand.
@raise [TypeError]
the `offset` was not an {MemoryOperand}, {Register} or Integer.
# File lib/ronin/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)
click to toggle source
Substracts from the value within the register and dereferences the address.
@param [Integer] offset
The value to subtract from the value of the register.
@return [MemoryOperand]
The new Memory Operand.
# File lib/ronin/asm/register.rb, line 83 def -(offset) MemoryOperand.new(self,-offset) end
to_s()
click to toggle source
@return [String]
The register's name.
# File lib/ronin/asm/register.rb, line 104 def to_s self.name.to_s end