Page 1 of 2

Turbo Everdrive

Posted: Thu Aug 02, 2012 5:45 pm
by MooZ
Hi!

I just received my Turbo Everdrive. And as I understood it, it's possible to access the SD card from a PC Engine program (source: http://krikzz.com/forum/index.php?topic=69.0). Some dude suggested using PetiteFS.
I'll put the code on github as soon as I something ready!

Re: Turbo Everdrive

Posted: Thu Aug 02, 2012 9:19 pm
by MooZ
Here's a first shot: https://gist.github.com/3240689
It compiles. But I haven't tested it. So I urge you not to test it atm :) I first need to check/double check/triple check it againt the original C code. But the most important thing to do is to first figure out how the sd is initialized/accessed.

As always, any help is more than welcome.

Re: Turbo Everdrive

Posted: Fri Aug 03, 2012 10:35 pm
by MooZ
I spent the evening debugging a test program that only did :

Code: Select all

   jsr ed_begin
   jsr disk_init
   phx
   jsr ed_end
   pla
   ; display A 
The "worst" bug was that the termination tests for the active wait macro were wrong (bne instead of beq). I also had to "fixed" the font printing. I forgot to specify the palette to use for the text print routine. Hence the crappy results. And last but not least I managed to blast the SD card filesystem :D
Anyway! It seems to be working now. disk_init returns 0 (which means success). The next test will be to read the CID register (card identification information).

The updated code can be found here : https://gist.github.com/3240689
I attached the test rom. Note that it won't work under Mednafed as SPI_BUSY_WAIT will loop indefinitely. As suggested by Charles, I should use the timer interrupt for timeouts.

Re: Turbo Everdrive

Posted: Sat Aug 04, 2012 11:00 pm
by MooZ
KRIKzz forgot the function that opens the sd card for reading (here).
After hours of testing (and sd card reformating) and the help from Chilly Willy, I managed to read sector 0 :)
The code is at the same place and I attached a new version of the test rom.

Re: Turbo Everdrive

Posted: Mon Mar 24, 2014 10:23 am
by MooZ
A lot of stuffs happened behind the hood (namely by email and on some other forum).
To keep things short John Snowdon (aka megatron-uk) picked up the "super tenokoe card" project and started working on the FAT driver using the low level SD card access code I wrote. As he's using HuC, I had to code some C wrapper around the asm routines. You can now read bytes from the SD card but writing is still buggy. At the moment, only single block write is implemented. The only problem is that once you write a single block you can't perform anything afterwards. Every other command will fail. At least the SD card is not fubar.

Here's the main git repository : https://github.com/megatron-uk/everdrive-fat
And here's my fork where you can find experimental bleeding edge SD card driver code: https://github.com/BlockoS/everdrive-fat

What's left?
  • Fix the bloody single block write
  • Code multiple block write

Re: Turbo Everdrive

Posted: Mon Mar 24, 2014 8:22 pm
by MooZ
Thanks to Microchip engineers, I managed to fix single block write. I think I'm going to burn all my arduino boards and buy PIC devboard!

Re: Turbo Everdrive

Posted: Thu Jan 01, 2015 9:15 pm
by MooZ
Huzzah! Multiple sector writes are defeated! The start/dostuff/stop sequence routines were removed. Instead disk_read_sector, disk_write_sector were added.
You can find the code here: sd.asm
I still need to add the C "exports" and send a pull request to John.

Re: Turbo Everdrive

Posted: Sat Feb 28, 2015 6:54 pm
by NippleSalad!!!
Any further updates on this?

Re: Turbo Everdrive

Posted: Sun Mar 01, 2015 9:22 am
by MooZ
I started porting FAT management to assembly. It's still in early stage.

Re: Turbo Everdrive

Posted: Sun Apr 05, 2015 9:54 pm
by Debvgger
This could prove very useful for debugging on the real hardware :-)