fixin up mov arguments
This commit is contained in:
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user