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



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

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

Instance Method Details

#to_sObject



509
510
511
512
513
514
515
516
517
518
519
# File 'lib/ragweed/rasm/isa.rb', line 509

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