On the AtariAge forums, lucien2 found a problem with byte initilizers. Apparently this sequence:
li r1, >8C02
li r2, >D00
movb r2, *r1
li r1, >8C02
li r2, >8700
movb r2, *r1
was converted into this one, destroying the >0D value.
li r1, >8C02
li r2, >FF87
movb r2, *r1
swpb r2
movb r2, *r1
This was caused by not masking the values together before ORing them into the second constant. In this case the sign extended bits of >87 were stomping on >0D, resulting in a corrupt value. I'm posting the two-liner patch on the forum.
He also found another problem using -O0, which I usually avoid. The register I chose for the frame pointer, R8, is volatile. That means that it can be destroyed over a function call. This was just a dumb mistake. In order to preserve the ABI interface, I've moved the frame pointer to R9, which is preserved across function calls. The resulting code looks much safer now.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment