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, #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.



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

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

Instance Method Details

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



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

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

#to_sObject

Raises:



859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
# File 'lib/ragweed/rasm/isa.rb', line 859

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