Class: Ragweed::Rasm::IncDec

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

Overview

Wrapper for INC and DEC, not called directly.

Direct Known Subclasses

Dec, Inc

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) ⇒ IncDec

fe/0 r/m8 ff/0 r/m 40+ (reg)



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

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

Instance Method Details

#to_sObject

Raises:



768
769
770
771
772
773
774
775
776
777
778
779
# File 'lib/ragweed/rasm/isa.rb', line 768

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

  if @dst.indir
    add(0xff)
    add(modrm(@dst, @var))
  else
    add(@bas + @dst.code)
  end
  super
end