Class: Ragweed::Rasm::Ret

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

Overview

Return; provide immediate for stack adjustment if you want.

Direct Known Subclasses

Retn

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

c3 c2 imm16



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

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

Instance Method Details

#to_sObject



530
531
532
533
534
535
536
537
538
539
540
# File 'lib/ragweed/rasm/isa.rb', line 530

def to_s
  if not @dst
    add(0xc3)
  elsif dst_imm?
    add(0xc2)
    add(@dst.val, true, true)
  else
    raise BadArg, "imm16 only"
  end
  super
end