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 module Arm
class CompareInstruction < Vm::CompareInstruction class CompareInstruction < Vm::CompareInstruction
include Arm::Constants include Arm::Constants

View File

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

View File

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

View File

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