folded salama-arm in

This commit is contained in:
Torsten Ruger
2016-12-14 13:43:13 +02:00
parent 56032c9b08
commit 456e9b1ec0
22 changed files with 1372 additions and 9 deletions

38
lib/arm/attributed.rb Normal file
View File

@@ -0,0 +1,38 @@
module Arm
# The arm machine has following instruction classes
# - Memory
# - Stack
# - Logic
# - Math
# - Control/Compare
# - Move
# - Call class Instruction
module Attributed
attr_reader :attributes
def opcode
@attributes[:opcode]
end
def set_opcode code
@attributes[:opcode] = code
end
# for the shift handling that makes the arm so unique
def shift val , by
raise "Not integer #{val}:#{val.class} #{inspect}" unless val.is_a? Fixnum
val << by
end
def byte_length
4
end
end
end
require_relative "constants"
require_relative "instructions/call_instruction"
require_relative "instructions/compare_instruction"
require_relative "instructions/logic_instruction"
require_relative "instructions/memory_instruction"
require_relative "instructions/move_instruction"
require_relative "instructions/stack_instruction"