fixed arm tests to use ArmMachine
This commit is contained in:
@ -16,15 +16,15 @@ module Arm
|
||||
def define_instruction inst , clazz
|
||||
super
|
||||
return
|
||||
# need to use create_method and move to options hash
|
||||
# need to use create_method and move to attributes hash
|
||||
define_method("#{inst}s") do |*args|
|
||||
instruction clazz , inst , :al , 1 , *args
|
||||
end
|
||||
ArmMachine::COND_CODES.keys.each do |suffix|
|
||||
define_method("#{inst}#{suffix}") do |options|
|
||||
define_method("#{inst}#{suffix}") do |attributes|
|
||||
instruction clazz , inst , suffix , 0 , *args
|
||||
end
|
||||
define_method("#{inst}s#{suffix}") do |options|
|
||||
define_method("#{inst}s#{suffix}") do |attributes|
|
||||
instruction clazz , inst , suffix , 1 , *args
|
||||
end
|
||||
end
|
||||
|
@ -22,12 +22,12 @@ module Arm
|
||||
4
|
||||
end
|
||||
|
||||
def initialize(options)
|
||||
super(options)
|
||||
def initialize(attributes)
|
||||
super(attributes)
|
||||
@update_status_flag = 0
|
||||
@condition_code = :al
|
||||
@opcode = options[:opcode]
|
||||
@args = [options[:left] , options[:right] , options[:extra]]
|
||||
@opcode = attributes[:opcode]
|
||||
@args = [attributes[:left] , attributes[:right] , attributes[:extra]]
|
||||
@operand = 0
|
||||
end
|
||||
|
||||
|
@ -82,12 +82,12 @@ module Arm
|
||||
include Arm::Constants
|
||||
include LogicHelper
|
||||
|
||||
def initialize(options)
|
||||
super(options)
|
||||
def initialize(attributes)
|
||||
super(attributes)
|
||||
@update_status_flag = 0
|
||||
@condition_code = :al
|
||||
@opcode = options[:opcode]
|
||||
@args = [options[:left] , options[:right] , options[:extra]]
|
||||
@opcode = attributes[:opcode]
|
||||
@args = [attributes[:left] , attributes[:right] , attributes[:extra]]
|
||||
@operand = 0
|
||||
|
||||
@rn = nil
|
||||
@ -103,11 +103,14 @@ module Arm
|
||||
|
||||
end
|
||||
class CompareInstruction < Vm::CompareInstruction
|
||||
def initialize(options)
|
||||
super(options)
|
||||
include Arm::Constants
|
||||
include LogicHelper
|
||||
|
||||
def initialize(attributes)
|
||||
super(attributes)
|
||||
@condition_code = :al
|
||||
@opcode = options[:opcode]
|
||||
@args = [options[:left] , options[:right] , options[:extra]]
|
||||
@opcode = attributes[:opcode]
|
||||
@args = [attributes[:left] , attributes[:right] , attributes[:extra]]
|
||||
@operand = 0
|
||||
@i = 0
|
||||
@update_status_flag = 1
|
||||
@ -115,19 +118,19 @@ module Arm
|
||||
@rd = :r0
|
||||
end
|
||||
def build
|
||||
do_build args[1]
|
||||
do_build @args[1]
|
||||
end
|
||||
end
|
||||
class MoveInstruction < Vm::MoveInstruction
|
||||
include Arm::Constants
|
||||
include LogicHelper
|
||||
|
||||
def initialize(options)
|
||||
super(options)
|
||||
def initialize(attributes)
|
||||
super(attributes)
|
||||
@update_status_flag = 0
|
||||
@condition_code = :al
|
||||
@opcode = options[:opcode]
|
||||
@args = [options[:left] , options[:right] , options[:extra]]
|
||||
@opcode = attributes[:opcode]
|
||||
@args = [attributes[:left] , attributes[:right] , attributes[:extra]]
|
||||
@operand = 0
|
||||
|
||||
@i = 0
|
||||
|
@ -7,12 +7,12 @@ module Arm
|
||||
class MemoryInstruction < Vm::MemoryInstruction
|
||||
include Arm::Constants
|
||||
|
||||
def initialize(options)
|
||||
super(options)
|
||||
def initialize(attributes)
|
||||
super(attributes)
|
||||
@update_status_flag = 0
|
||||
@condition_code = :al
|
||||
@opcode = options[:opcode]
|
||||
@args = [options[:left] , options[:right] ]
|
||||
@opcode = attributes[:opcode]
|
||||
@args = [attributes[:left] , attributes[:right] ]
|
||||
@operand = 0
|
||||
|
||||
@i = 0 #I flag (third bit)
|
||||
@ -44,8 +44,8 @@ module Arm
|
||||
#str / ldr are _serious instructions. With BIG possibilities not half are implemented
|
||||
if (arg.is_a?(Symbol)) #symbol is register
|
||||
@rn = arg
|
||||
if options[:offset]
|
||||
@operand = options[:offset]
|
||||
if @attributes[:offset]
|
||||
@operand = @attributes[:offset]
|
||||
if (@operand < 0)
|
||||
@add_offset = 0
|
||||
#TODO test/check/understand
|
||||
|
@ -10,12 +10,12 @@ module Arm
|
||||
4
|
||||
end
|
||||
|
||||
def initialize(options)
|
||||
super(options)
|
||||
def initialize(attributes)
|
||||
super(attributes)
|
||||
@update_status_flag = 0
|
||||
@condition_code = :al
|
||||
@opcode = options[:opcode]
|
||||
@args = [options[:left] , options[:right] , options[:extra]]
|
||||
@opcode = attributes[:opcode]
|
||||
@args = [attributes[:left] , attributes[:right] , attributes[:extra]]
|
||||
@operand = 0
|
||||
|
||||
@update_status_flag= 0
|
||||
|
Reference in New Issue
Block a user