renamed instruciton tools to arm machine

This commit is contained in:
Torsten Ruger 2014-04-25 13:34:10 +03:00
parent f1a7993b47
commit eca9e66f73
6 changed files with 6 additions and 9 deletions

View File

@ -11,7 +11,7 @@ module Asm
class ArmAssembler
InstructionTools::REGISTERS.each do |reg , number|
ArmMachine::REGISTERS.each do |reg , number|
define_method(reg) { Asm::Register.new(reg , number) }
end
@ -50,7 +50,7 @@ module Asm
define_method(inst.to_s+'s') do |*args|
instruction clazz , inst.to_s+'s' , *args
end
InstructionTools::COND_CODES.keys.each do |cond_suffix|
ArmMachine::COND_CODES.keys.each do |cond_suffix|
suffix = cond_suffix.to_s
define_method(inst.to_s + suffix) do |*args|
instruction clazz , inst + suffix , *args

View File

@ -1,6 +1,6 @@
module Asm
module InstructionTools
module ArmMachine
OPCODES = {
:adc => 0b0101, :add => 0b0100,
:and => 0b0000, :bic => 0b1110,

View File

@ -1,6 +1,6 @@
require_relative "label"
require_relative "assembly_error"
require_relative "instruction_tools"
require_relative "arm_machine"
module Asm
@ -13,7 +13,7 @@ module Asm
# Argurments are registers or labels or string/num Literals
class Instruction < Code
include InstructionTools
include ArmMachine
COND_POSTFIXES = Regexp.union( COND_CODES.keys.collect{|k|k.to_s} ).source
@ -37,7 +37,7 @@ module Asm
attr_reader :opcode, :args
# Many arm instructions may be conditional, where the default condition is always (al)
# InstructionTools::COND_CODES names them, and this attribute reflects it
# ArmMachine::COND_CODES names them, and this attribute reflects it
attr_reader :cond
attr_reader :operand

View File

@ -3,7 +3,6 @@ module Asm
# Logic ,Maths, Move and compare instructions (last three below)
class LogicInstruction < Instruction
include Asm::InstructionTools
def initialize( opcode , args)
super(opcode , args)

View File

@ -4,7 +4,6 @@ module Asm
# ADDRESSING MODE 2
# Implemented: immediate offset with offset=0
class MemoryInstruction < Instruction
include Asm::InstructionTools
def initialize(opcode , args)
super( opcode , args )

View File

@ -3,7 +3,6 @@ require "asm/instruction"
module Asm
# ADDRESSING MODE 4
class StackInstruction < Instruction
include Asm::InstructionTools
def initialize(opcode , args)
super(opcode,args)