fixed that darn method address bug

This commit is contained in:
Torsten Ruger
2015-07-01 09:47:10 +03:00
parent 9541712af8
commit 047c77e186
5 changed files with 6 additions and 9 deletions

View File

@ -44,7 +44,6 @@ module Arm
# so there it balances out, but not blocks
# have to use the code, not the mthod object for methods
diff = arg.code.position - self.position
diff -= 4 if diff > 0 # hmm, stil having troubles with this one. but it works :-)
end
arg = diff
end

View File

@ -48,6 +48,7 @@ module Arm
#TODO this is copied from MoveInstruction, should rework
unless @extra
@extra = 1
puts "RELINK L at #{self.position.to_s(16)}"
raise ::Register::LinkException.new("cannot fit numeric literal argument in operand #{right.inspect}")
end
# now we can do the actual breaking of instruction, by splitting the operand
@ -87,7 +88,7 @@ module Arm
val << by
end
def word_length
def byte_length
@extra ? 8 : 4
end

View File

@ -18,9 +18,6 @@ module Arm
@immediate = 0
@rn = :r0 # register zero = zero bit pattern
@extra = nil
if @rn.is_a?(Numeric) and !@rn.fits_u8? and !calculate_u8_with_rr(@rn)
@extra = 1
end
end
attr_accessor :to , :from
@ -31,7 +28,7 @@ module Arm
# alas, full transparency is not achieved as we only know when to use 2 instruction once we
# know where the other object is, and that position is only set after code positions have been
# determined (in link) and so see below in assemble
def word_length
def byte_length
@extra ? 8 : 4
end
@ -65,6 +62,7 @@ module Arm
# then on subsequent assemblies we can assemble
unless @extra
@extra = 1
puts "RELINK M at #{self.position.to_s(16)}"
raise ::Register::LinkException.new("cannot fit numeric literal argument in operand #{right.inspect}")
end
# now we can do the actual breaking of instruction, by splitting the operand