Class: Ragweed::Rasm::Mov
- Inherits:
-
Instruction
- Object
- Instruction
- Ragweed::Rasm::Mov
- Defined in:
- lib/ragweed/rasm/isa.rb
Overview
MOV, from reg to mem or v/v, or imm to reg, v/v
Instance Attribute Summary
Attributes inherited from Instruction
Instance Method Summary collapse
-
#initialize(x = nil, y = nil) ⇒ Mov
constructor
A new instance of Mov.
-
#to_s ⇒ Object
89 r/m, r 8b r, r/m b8+ r, imm c7+ r/m, imm.
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(x = nil, y = nil) ⇒ Mov
Returns a new instance of Mov.
845 |
# File 'lib/ragweed/rasm/isa.rb', line 845 def initialize( x=nil, y=nil); super x, y; end |
Instance Method Details
#to_s ⇒ Object
89 r/m, r 8b r, r/m b8+ r, imm c7+ r/m, imm
812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 |
# File 'lib/ragweed/rasm/isa.rb', line 812 def to_s raise Insuff if not @src or not @dst raise NotImp if (src_reg? and @src.index) or (dst_reg? and @dst.index) if src_imm? if @dst.indir add(0xc7) add(@dst.code) add(@src.val) else add(0xb8 + @dst.code) add(@src.val, true) end elsif dst_imm? raise BadArg, "mov to immed" else raise(BadArg, "two r/m") if @src.indir and @dst.indir if not @src.indir and not @dst.indir add(0x89) add(modrm(@dst, @src)) elsif @src.indir # ie, ld add(0x8b) add(modrm(@dst, @src)) add(@src.disp) elsif @dst.indir # ie, st add(0x89) add(modrm(@dst, @src)) add(@dst.disp) end end super end |