implement string length

This commit is contained in:
Torsten Ruger 2015-11-15 11:28:16 +02:00
parent 1633bf1289
commit 458610b970

View File

@ -130,9 +130,9 @@ module Arm
def putstring int_code
codes = ArmMachine.ldr( :r1 , Register.message_reg, 4 * Register.resolve_index(:message , :receiver) - 4)
codes.append ArmMachine.add( :r1 , :r1 , 8 )
codes.append ArmMachine.mov( :r0 , 1 )
codes.append ArmMachine.mov( :r2 , 12 ) # String length, obvious TODO
codes.append ArmMachine.ldr( :r2 , :r1 , 4 ) # String length
codes.append ArmMachine.add( :r1 , :r1 , 8 ) # adjust for object header
codes.append ArmMachine.mov( :r0 , 1 ) # write to stdout == 1
syscall(int_code , codes )
end