diff --git a/lib/register/enter_implementation.rb b/lib/register/enter_implementation.rb index f0663a02..222f55d2 100644 --- a/lib/register/enter_implementation.rb +++ b/lib/register/enter_implementation.rb @@ -5,7 +5,12 @@ module Register block.codes.dup.each do |code| next unless code.is_a? Virtual::MethodEnter # save return register and create a new frame - block.replace(code , [] ) + to = RegisterReference.new(:r0) # message base + tmp = RegisterReference.new(:r5) # tmp + pc = RegisterReference.new(:pc) + move1 = RegisterMachine.instance.ldr( tmp , pc ) + move2 = RegisterMachine.instance.ldr( tmp , to , 3 ) #TODO 3 == return reg, needs constant / layout + block.replace(code , [move1,move2] ) end end end