I guess with something hard to debug like an emulator you can never be paranoid enough with warnings and assertions. This also reminds me that I should start building a proper debugger for this soon.

Show thread

But when I started this emulator ~1 month ago I had the opportunity to run some tests for this instruction and concluded that it should be good and... removed that warning. If I had kept it around I probably would've noticed earlier that it uses this instruction and might have looked at it much earlier instead of wondering the whole day why the graphics are kinda broken >_<

Show thread

The bug was in the ARMv5 signed halfword multiply and accumulate instruction that I added to my previous ARMv4 interpreter way back in december. It would accumulate the wrong value if the opcode accumulates the destination register into itself. At that time I apparently didn't think of this edge-case. I added a log message saying that it hit an experimental instruction though.

Show thread

One annoying CPU interpreter bug later and the thing is finally working.


huge thanks to Hydr8gon for pointing out that the firmware leaves some data in memory behind which games expect to be able to read. I didn't handle this yet and probably would've spent most of tomorrow staring at Ghidra if he didn't point this out..

aaaaa
banging my head against NDS game code atm >.>
not sure if it's "just" soft locking or calling a terminate function...

next goal is to stub the cartridge interface and to implement the DMA controller so that maybe we can get the NDS firmware to boot...

Show thread

implemented SPI and the touchscreen controller + firmware attached to it

The graphics subsystem is slowly coming along. I think I might implement the touchscreen next?
This demo wants to read data from it and it uses the SPI interface which I need to implement anyways.

Interesting read on perspective correct interpolation and how the Nintendo DS GPU approximated it. melonds.kuribo64.net/comments.

I should also note that this strictly is a toolchain problem. Arisotura, the author of this ROM didn't do any wrong.

Show thread

there are two processors (ARM9 and ARM7) in this system. as part of the initialization process the ARM9 crt0 expects that the ARM7 sends some values over an inter process communication port. however the ARM7 crt0 doesn't contain the code to do that.

Show thread

also interestingly the crt0 in this ROM is broken and wouldn't work if the developers wouldn't have coded a timeout (after 120 frames / ~2 seconds) in there.

Show thread

heh. working on a new emulator because why not. it can now boot ARM7Wrestler (a CPU test ROM for the ARM7TDMI core) ✨

chaos.social

chaos.social – a Fediverse instance for & by the Chaos community