diff --git a/lib/arm/passes/return_implementation.rb b/lib/arm/passes/return_implementation.rb index d92f3191..95d81703 100644 --- a/lib/arm/passes/return_implementation.rb +++ b/lib/arm/passes/return_implementation.rb @@ -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 diff --git a/lib/arm/passes/syscall_implementation.rb b/lib/arm/passes/syscall_implementation.rb index 5c2879c6..260a143a 100644 --- a/lib/arm/passes/syscall_implementation.rb +++ b/lib/arm/passes/syscall_implementation.rb @@ -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