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 Misc > Read CF sectors faster?

#80833 - Dwedit - Tue Apr 25, 2006 8:22 pm

What part of reading sectors takes the most time, is it waiting for the sector to become available, or the memory copy itself? If it's a polling loop wait, I think the wasted CPU time should be used to execute other code, then check back periodicly to see if the sector has become available.

If it would make a big difference, I think the FAT API could use "fread_background" or something like that. It would read the file in the background, maybe execute a callback when it's finished.

void fread_background(FILE, dest, int* bytesread, FP callback, void* callbackdata);

Of course this would require a lot, such as setting up timer interrupts and everything.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#80846 - josath - Tue Apr 25, 2006 8:59 pm

Make sure to enable disc caching in disc_io.h, if you haven't already. I've found this speeds up writing at least.