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 > SWI problems

#134738 - alwbsok - Mon Jul 16, 2007 8:14 am

I'm an inexperienced ARM ASM programmer trying to develop a chess program. Right now, I'm trying to display the interface I've designed. It's done in tile mode, and the tile maps, tile data, and the tile palette are copied verbatim from the ROM. The former two are copied by CPUFastSet (SWI 0x0C0000).

I've tried the assembled program on VBA, and it works perfectly, but on actual hardware (and the NO$GBA emulator) I get a black screen. When I replaced the software interrupts with a series of LDM and STM instructions, the problem was solved instantly.

Is there any tricks with SWIs in ARM mode that I'm not aware of (apart from the 16 bit shift)? Why is it working on hardware, but not VBA?

Thanks in advance.

#134740 - keldon - Mon Jul 16, 2007 8:25 am

VBA is not as accurate as No$GBA! Is everything word aligned and the wordcount (in r2) a multiple of 8?

#134762 - alwbsok - Mon Jul 16, 2007 2:28 pm

Absolutely. That was the first thing I checked. Thanks for the reply.

However, I've isolated the problem. I was reading up on the BIOS from the NO$GBA specifications, and I discovered that the BIOS is known to output garbage to r0, r1, and r3 (even if nothing meaningful is outputted). My program relies on registers r0 and r3 containing their previous values. When I fixed that, it worked on NO$GBA.