fixing index issues

This commit is contained in:
Torsten Ruger 2015-06-28 22:01:13 +03:00
parent 99b59d920c
commit 31635d9747
2 changed files with 2 additions and 2 deletions

View File

@ -4,7 +4,7 @@ module Arm
def run block
block.codes.dup.each do |code|
next unless code.is_a? Register::FunctionReturn
load = ArmMachine.ldr( :pc , code.register , code.index )
load = ArmMachine.ldr( :pc , code.register , 4 * code.index )
block.replace(code , load )
end
end

View File

@ -15,7 +15,7 @@ module Arm
def putstring int_code , codes
codes << ArmMachine.mov( :r1 , 20 ) # String length, obvious TODO
codes << ArmMachine.ldr( :r0 , Register::RegisterReference.message_reg, Virtual::SELF_INDEX)
codes << ArmMachine.ldr( :r0 , Register::RegisterReference.message_reg, 4 * Virtual::SELF_INDEX)
syscall(int_code , codes )
end