PPCenter :: devblog

PPcenter. Arts and craft for my Sega Saturn. Since 1847 :D

Merry New Year !

Written by cafealpha 6 comments
I sometimes check this blog in order to verify if there are some interesting news, without success, and then I realized that I am the only author of this blog (), hence though I should write something here in order not to deceive my countless fans.

So, sorry for the lack of news recently, I was busy with Saturn things, but also in deciphering Christmas presents lists ... and now busy in tidying up lego blocks and trashing used wrapping paper

I hope you're spending nice Christmas vacations ! I'm a little late for wishing you a merry Christmas ( ), and a little early to wish you an Happy New Year ( ), hence the broken title


So what's new with my Saturn projects ? In fact, nothing worth writing an article, but here is a short (and probably incomplete) list anyway :

 1. SD Memory Cart : when overwriting save on Saturn side, keep the old save file on SD card (but remove it from saves list, of course).
Basically, it automatically keeps old saves somewhere on SD card, so that it is possible to revert to a previous state. I hope Saturn RPG fans will like

 2. USB dev cart mode : when USB cable is detected, allow to unlock CD-ROM and then prompt for data upload.
This feature allows to makes tests on Saturn main program using data from CD-ROM without the need of installing a modchip, and without the need of burning a CD-R on each program changes
Special thanks to Shazz for reminding me to add such a feature, antime for wiring FTDI's PWREN signal to Saturn (it was unused for 3 years, but it was useful in order to detect USB connection, and hence hiding USB dev mode for normal users not using USB), and of course CyberWarriorX and jhl for Pseudo Saturn

 3. PCB changes : basically removing few debug "in case of" stuff, and also moving SD card socket in order to fit better with cartridge shell.
It is still WIP, but plan to send the updated gerber to the PCB house on next month.

 4. Few changes to the sources of yabause I'm using for testing my projects.
Especially, I added position save/restore and keyboard shortcut to each debug dialogs ... long time I wanted to do this

 5. In Backup Data Manager, some additions to "Import" feature : backup data dump file read and parse was done a while (4-5 months ?) ago, I just added something to select where (Internal Memory or Cartridge or Floppy) to save selected saves, and plan to port save data extract algorithm next month or so
Thanks to hitomi2500's ss-save-parser project, such "Import" feature is easy to integrate in my Backup Data Manager project


Last but not least, I also want to thank Stac user on Assembler forums
He's doing good job in beta testing, and thanks to his reactivity and good communication, project is progressing faster than I was expecting.
Beta testing is far from being a funny job, especially with me as main programmer (), and when testing requires to play games (this requires time, and bugs on my Saturn project may lead to loose of progress in game), so once more, thank you 

Read more Merry New Year !

Firmware development - will it work somewhere else than in my dev Saturn ?

Written by cafealpha 6 comments
I'm still developing the firmware for my custom cartridge, and it worked enough so that I could take a video of it running on real hardware


data/images/20151028_pskai_sdcard_test.jpg
Click on the image in order to see its youtube video.
You can also click here in order to download .avi file.


Video may be blurry, so here are some additional pictures :
data/images/20151029_testcart_usb.tb.jpg
USB & SD card cartridge.
This is the cartridge I mainly use for testing on real hardware
(USB port is used for debug purposes)


data/images/20151029_testcart_beta.tb.jpg
SD card cartridge for Saturn.
This is the version I plan to release in the case development continues well


data/images/20151029_flatcube_from_sd_card.tb.jpg
Flatcube demo loaded and executed from SD card.
This picture is here in order to put a link to the homepage of flatcube demo author


And last but not least, many thanks to beta testers for their cooperation and patience

data/images/20151028_pskai_bt2_saturn.tb.jpg
Beta cartridge loaded on modded Japanese Saturn.
Thanks to
MeteK for beta testing and taking this picture
Last week, MeteK reported that basic SD card access worked on his Saturn

data/images/20151028_pskai_bt1_screen.tb.jpg
Pseudo Saturn Kai System Information screen.
Thanks to Alexandre Souza from www.tabalabs.com.br
for beta testing and taking this picture 

data/images/20151112_tabajaralabs_noshell.tb.jpg - data/images/20151112_tabajaralabs_shell.tb.jpg
Additional pictures from Alexandre : cartridge without, then with shell.
Alexandre is currently trying to 3D print cartridge shells. Please do your best


I still can't getting things working on Alexandre side : SD card doesn't respond to SPI requests from Saturn via my cartridge ... I suppose this is due to a bad hardware design on cartridge side, but I still need to investigate about this ...

Edit (2015/11/11) : it is fixed and verified here
Fortunately, it was not an hardware error, but a firmware (SH-2 side) error.
About details : I access SD card by using SPI protocol, and the reason some cards couldn't be initialized was due to the fact that commands were incorrectly received by SD card.
Sending a dummy synchronization byte before sending command to SD card fixed the problem.
data/images/20151111_sdtest_satlink.tb.png
Log taken from my dev Saturn : first half is SD card initialization sequence,
and second half is data blocks reading.

data/images/20151111_sdtest_yabause_log.tb.png
It works under custom build of yabause too
Thanks to this, most of the tests could be done on PC,
which saved a lot of development time.
Thank you yabause team



After doing some testings on my side, I could verify that :
 - SD card access works fine on all the 6 Saturns I own
 - Some SD card can't be accessed via my cartridge, while the others work fine. (← fixed)

data/images/20151102_test_saturns.tb.jpg
Saturns used for testing.
The one on the top of the picture is my good old dev unit

data/images/20151102_test_sd_ng.tb.jpg
SD card that aren't recognized by my cartridge.
Edit (2015/11/11) : I fixed firmware and 32GB micro SD card above was recognized
(I didn't tested with the other SD cards, but I suppose it is now OK too.)

data/images/20151102_test_sd_ok.tb.jpg
SD cards that were correctly recognized by my cartridge.



To conclude this article, I have to say than this project doesn't make exception to Muphy's Law :
Anything that can go wrong will go wrong

Beginning of year (2015) : Virtual Memory Cart related debug. After verifying that it has the chance to work, I temporary stop its development, mostly because I was bored to continue development of this feature ^^;
Until this summer : a lot of struggle with Pseudo Saturn 0.831/0.832/flasher/etc related things.
September : SD card library related troubles. Try to get a solution by using -and trying to fix- thinfat32 library. Using fat_io_lib was a better choice, thank you hitomi2500 for your advice about this library
October ~ Now : Troubles with SD card on Alexandre side ... will work if another SD card is used (currently waiting for test results) ?

Anything that can go wrong will go wrong
But at least, beta cartridge half works, so I can safely continue its development


I plan to release the first batch of cartridges with SD card included, so that there won't be incompatibility issues on user side.
As my project is a low cost one, and also because it won't load commercial games, I plan to sell the cartridges with low cost (8GB or maybe 16GB) SD cards.
Edit (2015/11/11) : SD card compatibility is likely to be fixed, and as far as possible I don't want to do SD card stock management/etc, I will probably release cartridges only.
There still no release date to announce, because some fixes/features addition/testing/etc is remaining, and also because I mostly do this for fun

Read more Firmware development - will it work somewhere else than in my dev Saturn ?

libfat : maybe you need to loose some weight :D

Written by cafealpha 3 comments
So as you may know, I'm (still) developing the hardware/firmware/everything else for my SD card-based Saturn Cartridge.

One the main module for the firmware of this cartridge is File System access library.

As you may know, there are many File System existing in real worls : FAT, NTFS, exFat, ReiserFs, etc.
And in my project, I choose to use FAT32 in order to access files and directories.
Why FAT32 ? Just because it offers the best rate of advantages vs disadvantages in my project scope.
Advantages :
 - Available everywhere, from Windows 98 to every Linux distribution.
 - Detailed (?) specs available on MS website, lots of free source code available elsewhere.
 - Little resource requirement (at least 1~2KB of work RAM, and few tenths of program memory for code).
Disadvantages :
 - A little hard to understand why internal data structure is so messy ... more understandable after reading FAT16 specs.
 - Complex Long FileName support, and patented by MS too.
 - Write performances may be poor under certain conditions. Example : fragmented file system + large partition size.
 - Free source code available everywhere is sometimes buggy / bloated.

At the very beginning of the project (nearly 4 years ago !), I choose DharmaniTech FAT32 library , and it was easy to use, so that I could read files without many problems on software development side.
But it only supports <512 bytes file write, and a lot of advanced features weren't available, so I then switched to thinfat32 library .
Thinfat32 library was a pain to adapt to Saturn, and some advanced features weren't available, or didn't worked, so I rapidly switched to libfat .

Libfat is great, works without any major trouble, and even supports FAT16
So I kept libfat as FAT32 library for around 3 years.
But one problem of libfat is ... its weight (<- yeah, I wanted to put this pun somewhere ).
 - Sector caching is cool, but library doesn't work without it, so we need at least 8KB of work RAM for it.
 - Source code is very complete, but also very complex, so unless you aren't a talented developer, so can't customize it easily ... and unfortunately I'm not a talented developer
 - Library supports nearly everything for file/directory manipulation, so size after compilation is a little big (around 50KB IIRC).

You may ask : "why complaining about few KBs of RAM ? Saturn got plenty of RAM to use !"
Well, yes and no. My project (on game game backup from/to SD card) of resources :
 - Work RAM : 24KB ... not contiguous : 16KB+8KB
 - Program memory : work RAM, or cartridge ROM (1MB). I choose to run program directly from ROM.

And, in a (maybe) future hardware project, I may need to port FAT32 library to microcontroller, so few resources will be mandatory.

So last month, I dropped libfat, and started to look for a simpler & better FAT32 library.
When selecting a starting point for development, my choice pointed to thinfat32, not because it was perfect, but because I had some experience with it in the past, so that I know where I should start to fix things

First, I dropped some features I don't need :
 - Long FileName when writing files : LFN can be read, but only 8.3 files can be written ... it's enough for my needs
 - Long path : changed maximum size for file path from MAX_PATH (260 bytes) to 96 bytes ... it's enough for me, and saves some RAM.
 - Only one file open at once : it saves some RAM.
 - Other ? (don't remember)

Then started to fix/debug/etc the library :
 - Big/low endian support ... Saturn and PC endianness is different
 - Directory creation fix.
 - File creation in non-root directory fix.
 - Added test bench under windows ... there was one stub in original sources, but with very limited test range ...
 - Better log support.
 - FS info support.
 - FAT16 support ... not working yet (), but at least it works better than in original sources
 - File append fix ... original sources support file append ... only in the case source file is multiple of 512 bytes ... this bug took me many time to spot
 - Clock support when setting file timestamp ... original sources supported only fixed (dummy) timestamp.
 - File listing within a directory.
 - Source code cleanup.
 - MANY fixes.

Complaints about thinfat32 library may look severe, but I really thanks its author to publicly release it !
Thanks to him, I know have something that fits my needs, and have a deeper knowledge regarding FAT32 structure

Last but not least, here are some screenshots :
data/images/20151021_thinfat_testprog.tb.png
Test program contents :
In this screenshot, I first create one directory,
then write 3 files inside it.


data/images/20151021_thinfat_testbench.tb.png
Test program execution - just in order to show
a command line screenshot on my blog

data/images/20151021_thinfat_testresults.tb.png
Result in (virtual) test drive :
one directory and 3 files are created !

This is just the beginning of the development : I still need to test under Saturn emulator (yabause ), then on real hardware (Saturn + custom cartridge ).

Read more libfat : maybe you need to loose some weight :D

Shining Force 3 works !

Written by cafealpha 10 comments
Additional testing of my test cartridge showed that Shining Force scenario 3 was "working" well when using memory expander hack

By "working", I mean that game was working fine (no freeze, black screen whatever) while looking for save data on SD card.
I didn't verified if save data was consistent or not, this can be verified and eventually fixed later

data/images/20150915_sforce39.tb.png
Game is looking for SFORCE39 save data ?!

Logs show that game is looking for SFORCE31 save data, which is normal, but after that it is looking for SFORCE39 save data ?!?
I suppose this is some debug stuff that was left as-is, or maybe something for game beta testers ? Please let me know if you have more informations about this


It "works", but there's still a lot of code to write/cleanup/etc before release !
At first, I should add some "log to SD card" feature, this may be useful when we will enter beta testing stage

BTW, I'm looking for a name for my "SD card-based memory cart for Saturn" project.
The only requirement is that the name needs to be easy to remember. Suggestions are welcome


Edit (2016/02/12) : nearly 5 months after, everything works more or less so that I took a couple of videos of Pseudo Saturn Kai in action
data/images/20160212_xzibit_video.jpg
Video in video ?

More next week month

Edit (2016/03/16) : took longer than expected to add subtitles to the videos, but everything is finally ready. Thank you for your patience

data/images/20160316_shining_force_3_sd_memcart.jpg
Shining Force 3 Scenario 1 SD Memory Cart test
Game is accessing save data from cartridge's SD card. It works



data/images/20160316_shining_force_3_sd_memcart_makingof.jpg
Shining Force 3 Scenario 1 SD Memory Cart test (Making Of)
Same as above, with also log messages display on my dev laptop

Read more Shining Force 3 works !

Scritch, scritch ...

Written by cafealpha 3 comments
Today was a coding-free recreation day
Instead of coding, I used my brand new rasp (file) on a Saturn memory cartridge shell :
data/images/20150909_memcart_shell.tb.jpg
SD card on Memory Cartridge ?

Yeah, I know, it's "homemade"

Request : I only have a limited stock of cartridge shell, so is there somebody with a 3D printer/whatever ready to produce shells ? If you have the skillz, hardware, time and motivation to produce Saturn cartridge shells, please contact me via my homepage's contact form .
I can offer one cartridge (without shell) if you fulfill my needs

Edit : I forgot to put a picture of the cartridge itself :
data/images/20150909_family_portrait.tb.jpg
Cartridges Rev 3.1, Rev 2f, Rev 1b

Read more Scritch, scritch ...

Rss feed of the tag