move first arg into derived intruction constructor

This commit is contained in:
Torsten Ruger 2014-05-18 10:27:35 +03:00
parent a35bba39bc
commit f65ad813af
4 changed files with 27 additions and 9 deletions

View File

@ -1,5 +1,3 @@
require_relative "logic_helper"
module Arm
class CompareInstruction < Vm::CompareInstruction
include Arm::Constants

View File

@ -1,5 +1,3 @@
require_relative "logic_helper"
module Arm
class LogicInstruction < Vm::LogicInstruction

View File

@ -1,5 +1,3 @@
require_relative "logic_helper"
module Arm
class MoveInstruction < Vm::MoveInstruction

View File

@ -25,27 +25,51 @@ module Vm
# Make hash attributes to object attributes
include Support::HashAttributes
def initialize first , options
@first = first
def initialize options
@attributes = options
end
end
class StackInstruction < Instruction
def initialize first , options
@first = first
super(options)
end
end
class MemoryInstruction < Instruction
def initialize first , options
@first = first
super(options)
end
end
class LogicInstruction < Instruction
def initialize first , options
@first = first
super(options)
end
end
class MathInstruction < Instruction
def initialize first , options
@first = first
super(options)
end
end
class CompareInstruction < Instruction
def initialize first , options
@first = first
super(options)
end
end
class MoveInstruction < Instruction
def initialize first , options
@first = first
super(options)
end
end
class CallInstruction < Instruction
def initialize first , options
super
@first = first
super(options)
opcode = @attributes[:opcode].to_s
if opcode.length == 3 and opcode[0] == "b"
@attributes[:condition_code] = opcode[1,2].to_sym