fix label loading in arm

was still loading the integer address
instead of the return address's address
Hello World working
This commit is contained in:
Torsten Ruger 2018-06-19 17:35:00 +03:00
parent 956c2ebe54
commit db459fcd3d
4 changed files with 6 additions and 3 deletions

View File

@ -91,6 +91,7 @@ module Arm
if( @left.is_a?(Parfait::Object) or @left.is_a?(Risc::Label) or
(@left.is_a?(Symbol) and !Risc::RiscValue.look_like_reg(@left)))
left = @left
left = left.address if left.is_a?(Risc::Label)
# do pc relative addressing with the difference to the instuction
# 8 is for the funny pipeline adjustment (ie pointing to fetch and not execute)
right = Risc::Position.get(left) - 8

View File

@ -147,7 +147,7 @@ module Risc
end
def self.set?(object)
self.positions.has_key?(object)
self.positions[object]
end
# get a position from the cache (object -> position)

View File

@ -90,7 +90,9 @@ module Arm
end
def label( pos = 0x22 + 8)
label = Risc::Label.new("some" , "Label" , FakeAddress.new(pos))
addr = FakeAddress.new(pos)
Risc::Position.new(addr).set(pos)
label = Risc::Label.new("some" , "Label" , addr)
Risc::Position.create(label).set(pos)
#Risc::Position.set(l , pos , @binary)
label

View File

@ -12,7 +12,7 @@ class HelloTest < MiniTest::Test
end
def test_string_put
@input = "return 'Hello'.putstring"
@input = "return 'Hello World!\n'.putstring"
check
end
end