Class: Ragweed::Rasm::Shift

Inherits:
Instruction show all
Defined in:
lib/ragweed/rasm/isa.rb

Overview

Wrapper for the shift operations below.

Direct Known Subclasses

Sal, Sar, Shl, Shr

Instance Attribute Summary

Attributes inherited from Instruction

#dst, #src

Instance Method Summary collapse

Methods inherited from Instruction

#add, #coerce, #decode, #dst_imm?, #dst_lab?, #dst_reg?, i, #locate, #modrm, #patch, #sib, #src_imm?, #src_lab?, #src_reg?

Constructor Details

#initialize(dst = nil, src = nil) ⇒ Shift

Returns a new instance of Shift.



823
# File 'lib/ragweed/rasm/isa.rb', line 823

def initialize( dst=nil, src=nil); super dst, src; end

Instance Method Details

#magic(x, y, z, r) ⇒ Object



845
# File 'lib/ragweed/rasm/isa.rb', line 845

def magic(x, y, z, r); @once, @bycl, @imm, @x = [x,y,z,r.clone]; end

#to_sObject

Raises:



825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
# File 'lib/ragweed/rasm/isa.rb', line 825

def to_s
  raise Insuff if not @dst
  raise(BadArg, "need reg dst") if not dst_reg?

  if not @src
    add(@once)
    add(modrm(@dst, @x))
  else
    if src_imm?
      add(@imm)
      add(modrm(@dst, @x))
      add(@src.val)
    else
      add(@bycl)
      add(modrm(@dst, @x))
    end
  end
  super
end