• Welcome to SCdev.org. Please log in.

Welcome to the new SCdev forums!

SC SD IO sample - cleaned up from Zap's SC SD code

Started by cory1492, November 20, 2005, 08:53:47 PM

Previous topic - Next topic

cory1492

Linus: you dont have my conversion code to see if its reading  :wink:

The problem you are having with diskisInserted is that when linking the compiler is using old object files, and likely cant find the function in them. Deleteing the build directory or even just the few object/.s files that are having problems should fix it on the rebuild.

Linus

yeah silly me i managed to overlook this, when i got your updated (4th jan) version because youd converted some the unlock and some others i thought the read was changed, doh! oh well i look into the compiling thing later cheers for the advice i appreciate you taking the time.

Linus

If anyones interested i fixed the problem (thanks to agentq) by placing this in disc_io.h near the definitions

#ifdef __cplusplus
extern "C" {
#endif

And the following lines just before the final #endif

#ifdef __cplusplus
}
#endif


It still doesnt work, but it was still anyother step for me :) . Agentq suggested making disc_ReadSectors() function call fn_ReadSectors() multiple times reading one sector each go rather than many at once.

I hadnt really tried anything like this before but i thought id give it a stab, so i coded this:


bool disc_ReadSectors(u32 sector, u8 numSecs, void* buffer)
{
   bool result = true;
   int i = 0;
   
if (!active_interface)
      return false;
   
   for (i = 0; i < numSecs; i++) {
       result &= active_interface->fn_ReadSectors(sector + i,1 ,buffer + BYTE_PER_READ * i) ;
   }
   
   return result;
   
}


where it was


if (active_interface) return active_interface->fn_ReadSectors(sector,numSecs,buffer) ;
return false ;  


As i said ive never attempted anything like this before so ill explain what i was trying to do (and someone can correct me :) )

I figured that the sector numbers where just the address of the data so i add one each time, and then id change the buffer pointer each read so that i dont overwrite the data ive just read.

BYTE_PER_READ is defined as 512 so assume thats one chunk of data.

Well the output was just the same as when id made no modifcations - i dont really know if thats good or bad heh.

this has gone a bit off topic but whatever.

mgarrine

Sorry if write about not technical details....
but this Chism's FAT Driver  upgrade could let Alan Gerow to update its wonderful app for the NDS, the TEXTWRITER... i've mailed him, that was so kind previously to answer my request, to let him know this upgrade...


so i hope all the apps that have been made for SC CF will be adpted to SC SD...
thanks to COry  fot starting this "movement" of adapting CF works to SD...

bye
[size=14]´   º Í!¸ LÍ!mgarrine$[/size]

cory1492

linus: the asm readsector is setup to read multiple sectors with its own loop already, so essentially you are doing the same thing, but calling a loop from a loop. I can see how it may help (giving a couple cpu cycles before calling readsector asm code again) but I cant see any other reason for doing it (unless you were getting compiler errors because of the function?)

mgarrine:  :wink: As little as it is, Im doing what I can to make it move forward.

Linus

yeah it was suggested by agentq, i had a look around then code and even fidldled with the asm so i realised it wasnt doing much. i was just doin it to gain experience. if the code is correct then thats pretty good for me :)

your contribution is very important! without you porting it to c we'd never have sd support by chishm! (well unless someone else did it)

Have you got passed the fat init crashes? well keep it up anyway :)

Linus

just thought id let people know that scummvm 0.5 works with the fat driver in the latest moonshell beta. ive told agentq so hopefully he'll release something for all those waiting.