Class: Ragweed::Rasm::Pop

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

Overview

Pop into a register

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

8f m32 58+ # reg



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

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

Instance Method Details

#to_sObject

Raises:



425
426
427
428
429
430
431
432
433
434
435
436
437
# File 'lib/ragweed/rasm/isa.rb', line 425

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

  if @dst.indir
    add(0x8f)
    add(modrm(@dst, Eax.clone))
    add(@dst.disp)
  else
    add(0x58 + @dst.code)
  end
  super
end