fixin up mov arguments

This commit is contained in:
Torsten Ruger
2014-05-18 12:30:49 +03:00
parent 2be96dccdc
commit 9fc8bfbb55
9 changed files with 26 additions and 25 deletions

View File

@ -51,7 +51,7 @@ module Vm
define_instruction_three(inst , LogicInstruction)
end
[:mov, :mvn].each do |inst|
define_instruction_one(inst , MoveInstruction)
define_instruction_two(inst , MoveInstruction)
end
[:cmn, :cmp, :teq, :tst].each do |inst|
define_instruction_two(inst , CompareInstruction)

View File

@ -13,7 +13,7 @@ module Vm
def load_args into
args.each_with_index do |arg , index|
if arg.is_a? IntegerConstant
if arg.is_a?(IntegerConstant) or arg.is_a?(StringConstant)
Vm::Integer.new(index).load into , arg
else
Vm::Integer.new(index).move( into, arg ) if arg.register != index

View File

@ -64,8 +64,9 @@ module Vm
end
end
class MoveInstruction < Instruction
def initialize first , options
@first = first
def initialize to , from , options
@to = to
@from = from
super(options)
end
end