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.

DS development > Question about file system

#90345 - wickedtrickster - Thu Jun 29, 2006 8:32 pm

Hello,

I am trying to do a simple file system; I could use one of the current lib available, but the purpose is mainly for learning :)

From what I've read on DSTEK, the cartridge data is map from 0x08000000 to 0x09FFFFFF. So if I append data at the end of my .nds file, I should be able to retreive it at location 0x08000000 + .nds size - 0x200 (512 bytes header size). This works great on DUALIS, but doesn't work at all on my Nintendo DS. I did a small app which scan all memory between 0x08000000 and 0x09FFFFFF, on my DS it is full of 0 (zero).

I also took a look at the gbfs code. which scan the same memory address than my test, plus somewhere at the beginning of the 4M main memory (which I don't fully understand where it starts, and why it search there...).

I also look at chishm's fat librairy, but this isn't really what I want since I want the file system to also run on a gba card ! :)

Well I'm confused; any help on this topic would be greatly appreciated ! :)

Thank you,
Ben.

#90348 - sniper - Thu Jun 29, 2006 8:43 pm

You must set the bus master using:

Code:
sysSetCartOwner( BUS_OWNER_ARM9 );


Then the cartridge should be mapped in address space
Some emulators handles the default bus master not correctly. So if you do not set this, it will work with the emulator but not with real hardware.

#90355 - wickedtrickster - Thu Jun 29, 2006 9:13 pm

I'll try this :) Thanks for the answer !

EDIT: (Works great !)

#90381 - josath - Fri Jun 30, 2006 12:48 am

wickedtrickster wrote:
plus somewhere at the beginning of the 4M main memory (which I don't fully understand where it starts, and why it search there...)


It scans there, because you can include the gbfs actually INSIDE the .nds, as opposed to appended. In this case, the gbfs would be loaded into RAM.

#90430 - chishm - Fri Jun 30, 2006 6:22 am

wickedtrickster wrote:
I also look at chishm's fat librairy, but this isn't really what I want since I want the file system to also run on a gba card ! :)

Look harder, particularly at the FCSR driver. Even if you don't use it, it will give some hints for using a GBA cart.
_________________
http://chishm.drunkencoders.com
http://dldi.drunkencoders.com

#91139 - wickedtrickster - Tue Jul 04, 2006 8:50 pm

josath wrote:
wickedtrickster wrote:
plus somewhere at the beginning of the 4M main memory (which I don't fully understand where it starts, and why it search there...)


It scans there, because you can include the gbfs actually INSIDE the .nds, as opposed to appended. In this case, the gbfs would be loaded into RAM.


I see, thanks for the clarification.

chishm wrote:
wickedtrickster wrote:
I also look at chishm's fat librairy, but this isn't really what I want since I want the file system to also run on a gba card ! :)

Look harder, particularly at the FCSR driver. Even if you don't use it, it will give some hints for using a GBA cart.


Ok, I will take a look at it. Seems like I have much more to learns.... :)

#91165 - tepples - Wed Jul 05, 2006 12:43 am

josath wrote:
wickedtrickster wrote:
plus somewhere at the beginning of the 4M main memory (which I don't fully understand where it starts, and why it search there...)

It scans there, because you can include the gbfs actually INSIDE the .nds, as opposed to appended. In this case, the gbfs would be loaded into RAM.

Actually, if you include the GBFS into the binary using bin2s, you don't use find_first_gbfs_file(). Instead, you use the symbol that bin2s provides, which by default is the filename with identifier-illegal characters replaced with underscores:
Code:
extern const GBFS_FILE samples_gbfs;  // for file "samples.gbfs"

The real reason that find_first_gbfs_file() scans the first 256 KB of EWRAM is that the library was originally developed for use with the GBA, where both ROM programs (like ds.gba) and multiboot programs (like .nds) used appending and find_first_gbfs_file(). In the case of a Nintendo DS program where you are sure that it is running from GBA ROM address space (as a ds.gba or a SuperCard .nds), you should skip the RAM search entirely by starting the search at the base of ROM space:
Code:
find_first_gbfs_file((const void *)0x08000000)

_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.