Fix word offset

which had weirdly been 1 off
(not weird that it was off, index bugs are common, but weird that the tests passed anyway)
This commit is contained in:
2019-09-24 12:58:31 +03:00
parent a446d3da6b
commit 7b9097a0b1
3 changed files with 5 additions and 5 deletions

View File

@ -147,8 +147,8 @@ module Arm
send( name , int_code )
end
def putstring( int_code )
codes = ArmMachine.add( :r1 , :r1 , Parfait::Word.type_length*4 ) # adjust for object header
def putstring( int_code ) # adjust for object header (0 based, hence -1)
codes = ArmMachine.add( :r1 , :r1 , (Parfait::Word.type_length - 1)*4 )
codes.append ArmMachine.mov( :r0 , 1 ) # write to stdout == 1
syscall(int_code , codes )
end