Class: Ragweed::Rasm::Arith
- Inherits:
-
Instruction
- Object
- Instruction
- Ragweed::Rasm::Arith
- Defined in:
- lib/ragweed/rasm/isa.rb
Overview
Wrapper class for arithmatic instructions. Never called directly; see below.
Instance Attribute Summary
Attributes inherited from Instruction
Instance Method Summary collapse
-
#initialize(dst = nil, src = nil) ⇒ Arith
constructor
05 imm32 to eax 04 imm8 to al 80/0 r/m8, imm8 81/0 r/m, imm no sign extend yet 01 r/m, r 03 r, r/m.
- #to_s ⇒ Object
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, src = nil) ⇒ Arith
05 imm32 to eax 04 imm8 to al 80/0 r/m8, imm8 81/0 r/m, imm no sign extend yet 01 r/m, r 03 r, r/m
537 |
# File 'lib/ragweed/rasm/isa.rb', line 537 def initialize( dst=nil, src=nil); super dst, src; end |
Instance Method Details
#to_s ⇒ Object
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 |
# File 'lib/ragweed/rasm/isa.rb', line 539 def to_s if not @dst # fucked up if src_imm? if @src.val < 0x100 add(@imp8) add(@src.val) else add(@imp) add(@src.val) end else raise BadArg, "need immed for implicit eax" end else if src_imm? if @src.val < 0x100 add(@imm8) add(modrm(@dst, @x)) add(@src.val) else add(@imm) add(modrm(@dst, @x)) add(@src.val) end else raise(BadArg, "need two r/m") if not src_reg? or not dst_reg? raise(BadArg, "can't both be indir") if @src.indir and @dst.indir if @src.indir add(@rm) add(modrm(@dst, @src)) else add(@mr) add(modrm(@dst, @src)) end end end super end |