Page 1 of 1

NDS assembly reading from cartridges

Posted: Tue Sep 15, 2020 12:32 am
by kaleido
Hi. I've been watching the arm assembly series and its pretty darn great to see something that delves into the actual hardware and is not C or library based.
Wanted to ask about reading cartridges, AFAIK the ROM starts at the 8mb mark but reading the GBATEK documentation is not really clear how does one go about it(am not familiar with console programming).
Is it just dma'd into the main memory area?

Anyways thanks for the tutorials, they're really cool.

Re: NDS assembly reading from cartridges

Posted: Thu Sep 17, 2020 12:16 am
by akuyou
I'm afraid I'm heavily relying on the GBATek documentation to write the tutorials as well, and the truth is I'm not sure.

I would assume you're correct, it seems the data is being transferred from ROM to the specified location in RAM, but I don't know any more than that.

I'd like to look further into the GBA/NDS, but unfortunately, I really can't look further into it at the moment, as working on the 8/16 bit tutorials is taking all the time i have

Re: NDS assembly reading from cartridges

Posted: Sun Sep 20, 2020 2:47 pm
by laoong

I was delving in to the matter a little. And it's very interesting topic.
I'm afraid you're confusing NDS with GBA.
Only GBA has up-to 32MB of memory-mapped ROM in address space 08000000-09FFFFFF.
NDS is a different beast. It has no memory-mapped ROM but 4 MB of RAM and serial drive similar to Atari Lynx.
Firmware at boot time reads cartridge image header. There is information how much of image has to be loaded for ARM7 and ARM9 CPUs and where. It is then loaded and control is passed to specified code for these processors.
Additional data from cartridge can be accessed by writing special 8-byte commands to Gamecard bus 8-byte Command Out and then read from Gamecard bus 4-byte Data In (R) using cartridge protocol. The protocol is quite complicated though and I don't understand it fully.

Re: NDS assembly reading from cartridges

Posted: Tue Sep 29, 2020 8:55 pm
by kaleido
I've also been reading more on the NDS, its quite tricky. There's also something else I wanted to check with you guys.
The header seems to not be recognized by some flashcarts on real hardware, I think this may be because its lacking the title and description(plus icon data). It works fine on a soft modded dsi though.

Re: NDS assembly reading from cartridges

Posted: Mon Oct 05, 2020 3:10 am
by akuyou
It's certainly possible, it works on emulators and my Classic NDS with flashcard, but I can't say for sure it will work on everything.

If you figure out how to make it work, let me know what you did and I will make corrections