gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

ASM > Loading from negative register...?

#164189 - Ruben - Thu Oct 23, 2008 10:03 am

Hey all.
So I was talking to Deku and found out an optimization for looped samples, but when I try it, it seems to stuff up and give me errors. I'm guessing the error is because the number is negative.

Code:
r0: *data
r1: current position - length of data

ldrb r2, [r0, r1, asr #12]


Is there any way to be able to implement that or does ARM not like this?

#164191 - eKid - Thu Oct 23, 2008 10:11 am

A negative offset should in the register should work as expected...

#164193 - Ruben - Thu Oct 23, 2008 10:20 am

:-S

Odd. Idk why that would cause and error though (it definitely is what causes it; commented out and worked). Register disassembly just before loading showed this...

(r3: position, r5: *wave)

r3: 0xF22B6000 [-(0xDD4A << 12)]
r5: 0x0800E84A [0x08000AF0 + 0xDD5A]

ldrb r8, [r5, r3, asr #12]

:-S

#164261 - silent_code - Fri Oct 24, 2008 7:30 pm

I can only recommend you this: Check your data. :^)
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.