PPCenter :: devblog

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

Improved SD card support !

Written by cafealpha 6 comments
I'm glad to announce that (as indicated in the title of this article) SD card support will be improved in Pseudo Saturn Kai next release This improvement concerns compatibility with a wider range of SD cards manufacturers.

Since Action Replay carts doesn't have SD card socket, this concerns only Gamer's Cartridge ... and no, gluing a SD card socket to Action Replay PCB won't magically make it recognized by Pseudo Saturn Kai : I didn't extended compatibility this far

More seriously, this improvement concerns Pseudo Saturn Kai itself, and all Gamer's Cartridge hardware revision will be concerned.
For example, the very first public PCB revision (with goofy LED positioning and using official memory cartridge shell) should be compatible with this improvement ... I write should because I didn't actually tested with PCB from this revision, but since hardware revisions are basically cosmetic changes, I'm quite confident this improvement will work on all Gamer's Cartridge

About the technical part of this improvement (please skip this paragraph if you are not interested in technical details), Pseudo Saturn Kai was not sending enough clock pulses to SD card before sending commands. In fact, at the very beginning of Gamer's Cartridge project (long before first public release), Pseudo Saturn Kai wasn't sending any synchronization pulse at all, but this wasn't a problem since some SD cards don't need theses, and so that Gamer's Cartridge project could work ... with poor SD card compatibility, but work anyway

After that, I discovered that some synchronization clocks before sending a command helps in getting SD card working, so I sent eight clocks, which improved compatibility enough to make a blog article about it at that time

Finally, Pseudo Saturn Kai now send enough clock until SD card replies it is ready for processing command. So yes, this improvement is just extension of a previous one from "provide eight synchronization clocks" to "provide enough synchronization clocks". It looks simple, but noticing it wasn't

This improvement is not publicly available yet, so please be patient Before putting it in the wild, I need to test it on my SD card collection, because so far I only tested on a problematic Sand*sk card, and a couple of other SD cards who were working well so far.
All theses SD card were recognized, but I should test with all the other ones I own : it would be a pity for Pseudo Saturn Kai to break compatibility with things working well so far !

Regarding testing schedule, I'm not sure it will be possible to do it until end of August : it's not like I don't want to do it, but just because summer holidays are likely to monopolize the free time slots usually reserved for testing on real hardware
And no, it's not about my holidays, but about my kids' ... it's a long time I personally didn't went on long vacations, but I'm looking forward for this pleasure when the benefits from Gamer's Cartridge development, manufacturing and sales will finally reach forty two million dollar

Anyway (and more seriously), this blank period until testing is a chance to improve a bit more SD card support : after a long time I didn't looked at SD card access code, I found few things that were left in a "it works, but should be improved later" state
My strategy about theses "should be improved later" things is to finish them in a clean way, then test them with my SD card collection until tey work well, and finally never touch this SD card access code any more !

Before publicly releasing Gamer's Cartridge, maintaining this part of the project was funny, but now it is too scary to break any kind of compatibility that I preferred not to touch it.
So for the last two years, I preferred to keep all the the code there as-is ... and sell SD cards at super low price (bought around 800 Yens, sold USD 3 ... 2+2 is 4 minus 1 that's 3. QUICK MATHS ) to avoid SD card compatibility problems. After Pseudo Saturn Kai next release, I hope that it will be compatible enough to avoid this "provide a recognized SD card" step

(Below is a bit of boring history about my Saturn project(s). Please skip if you are not interested)
SD card access code is a very old part of Pseudo Saturn Kai project : it was initially done for accessing SD card via second pad controller around summer 2011 : at that time USB dev cart project didn't existed and my extent in electronics was to put simple components on a breadboard : it's good to see the experience I gained in electronics, and also that some code from this era kept surviving in Pseudo Saturn Kai project
SD card connected to second pad, ready to
dump my Memory Card Plus cartridge.
The menu display and starfield effect in Saturn utility
were later re-used in Pseudo Saturn Kai project
The menu module evolved a lot from that time

End of the "good old times and flashback of back&white memories" ... I'm not that old enough for this crap Instead let's back to details regarding Pseudo Saturn Kai schedule :

I still have to finish some other features (not related to SD card access) still on development, and prefer to release all the news things in a single time rather than every small feature little by little. Exception is made for critical fixes that are released as early as possible : notable (and only ?) example is Pseudo Saturn Kai 6.074, which fixed a bug regarding internal backup memory access, as detailed in this article.

This SD card improvement is not a critical fix, and consequently won't be released separately before everything else. This means that extra wait is required, but on a positive side it also means that it will be released with all the new features developed from latest release.
Latest version was released one year and half ago, so there are some new features awaiting Please stay tuned

Last but not least, it's easy to pride "I made this or that" in a blog article, but it's cool to praise people who helped
First, I would like to thank my friend Darius, for constantly asking me when I will finally get Sand*sk SD card working correctly on Gamer's Cartridge, and -which is more important- for gathering a French Saturn community

Also, I would like to thank malachi84 for reporting incompatible SD card. I usually answer such report by something like "give a try with a cheap SD card from another brand, and it will work", but this report came at the right time when I wanted to change my mind from current development task 
So, I started to search what should be done to improve SD card compatibility, making random changes to Pseudo Saturn Kai, testing on real hardware, realizing that first beta doesn't works (from my own experience as software engineer, I NEVER had something working fine from first beta ), but keeping fighting because I really want this non working SD card report being the last one ... and also because I like to fight with software bugs

Finally, I would like to thank Ralim for providing the technical information regarding this fix on Pseudo Saturn Kai. For those interested with technical (but easy to read) information, SD card access details are available on "SD cards with STM32 over SPI" article
As written above, the implementation of the fix itself is simple, but finding it in a super lengthy technical document isn't, so thank you Ralim for providing the right detail to fix for Pseudo Saturn Kai

2018/08/09 : I had a little spare time to test several SD cards from my collection, and to update this blog with test results
Globally, SD card support seems significantly better than on Pseudo Saturn Kai current official version (v6.074) : a Sandisk SD card is recognized, and other SD cards that were recognized so far are ... still recognized
Additionally, it seems that SDXC card support is OK too ... so far I tested only with only one card, and because of high capacity, write access is quite slow, so it's not recommended however.

All SD cards working so far
It's the first time I had guts to test with a SDXC card,
and fortunately it was recognized

Read more Improved SD card support !

Classified in : Saturn Tags : none

X-Terminator Cartridge Revival

Written by cafealpha 3 comments
This article is not about my own development experience, but from my friend XRider. Thanks a lot to him for the good work and the permission to share his pictures

First, what is a X-Terminator cartridge ? It is a Saturn flash cartridge which provides the following features :
 - 1MB expansion RAM
 - Backup memory
 - Ability to play import games
 - Cheat codes
 - Ability to search cheat codes by using standalone "X-Assist" unit

X-Terminator cartridge and X-Assist
Image taken from SegaRetro

X-Assist is particularly convenient because unlike Action Replay cartridges, it doesn't requires connection to a PC : it is true that connection to a PC provides more features (such as memory access, program upload, etc), but as "connection to PC" basically means "software support will be dropped someday", a standalone unit is a real treasure
For example, do you remember that Action Replay cartridges initially had DB25 connector ? This was for connecting the cartridge to PC via the -sold separately- Comms Link board, whose used now obsolete ISA port, and consequently not supported on nowadays PCs and/or OS.
There are some alternate solutions for connecting Action Replay to PC, whose major one is USB Data Link, but unfortunately it doesn't provides any software support for advanced features such as cheat codes search and testing.
So if you want to search cheat codes for your favorite game, X-Terminator is a good choice ! ... Okay, the user interface is in Japanese, but that's just a detail : after 200 or 300 hours learning about it, it shouldn't cause any problems

On the other hands, the major limitations are probably the lack of 4MB expansion RAM support, and using flash ROM for storing backup save data (which on the long term may brick the cartridge), but for a cartridge developed more than 20 years ago, theses limitations are quite honorable

So, once upon a time, XRider found a X-Terminator cartridge. It was a cheap auction, but on the other hand the cartridge didn't boot anymore, and the X-Assist unit wasn't included

Normal people would add this cartridge to their collection or put it on display as a decorating vintage objet Other people with engineering and electronics education background would put it on their "to repair someday" cardboard, and don't touch it for the next 20 years because they are busy with other projects or work, or real life, or all of theses at once

But XRider is none of them. XRider owns soldering tools. And knows how to use them. And really wants to fix this marvelous cartridge

So, let's try to fix the cartridge ! The first step would be to start with the most common problem, which is broken flash ROM.
In my opinion, this is the most difficult step, because it requires to desolder two chips for a total of 64 pins !
I personally can't do this because of lack of appropriate tools, so the alternate desoldering way I would had used would be to ... use a nipper and cut each pins

Fortunately, XRider likes work well done, so theses chips were removed in a clean way

X-Terminator cartridge, with flash ROM chips removed.
Additionally, all capacitors are removed too : that's
the occasion or never to replace them

Next step is a bit optional, and is about to dump removed flash ROM chips with flash ROM dumper device. This is the best way to verify if failure is due to corrupted flash ROM chips, and if still in working condition, this at least would be an occasion to dump the cartridge's firmware

Flash ROM chip on dumper device.

Dump is full of 0xFF bytes ... unless a miracle happens, theses flash ROM chips are no longer functioning  But, this comforts us regarding initial supposition of broken flash ROM chips causing cartridge not booting
Just in case of, let's verify PCB traces around flash ROM chips while theses are removed : this takes only 5 minutes to check, and it would be frustrating to find that cartridge was not working because of broken trace after soldering new flash ROM chips

PCB traces : just requires a light source
strong enough to be seen

What to do next ? Maybe use PLCC sockets so that future replacement of flash ROM chips would be easier ! That's a couple of weeks to wait for the postman, but worth the wait
PCB with PLCC32 sockets soldered

And then, simply replace the flash ROM chips

Next generation is here !

PCB with new flash ROM chips.
Additionally, new capacitors are populated

One last step remaining ! Flash ROM is mounted, but ROM itself needs to be set up with X-Terminator firmware. The simplest way to do this is to use Pseudo Saturn Kai flasher utility : it obviously allows to install Pseudo Saturn Kai, but also several other legacy firmwares in the case someone would want to revert to initial firmware after trying Pseudo Saturn Kai.

Just select the ROM version you want to install,
and follow on-screen instructions

Flashing in progress ! Will it work after that ?!

Yeehaw !!! It boot fine, mission done
Let's try with Metal Slug ...

Metal Slug works too !
So it seems there's no need to replace RAM chips

Everything finished ? No, there is a side quest remaining Among the couple of X-Terminator cartridges XRider owns, one X-Assist (pad and LCD unit used to search cheat codes) is missing.
One X-Assist available ? And another one missing ? No problem : let's reverse engineer the first one and DIY the second one

The X-Assist features two PCBs : one for connection interfacing and pad, and another one for LCD, as pictured below.

X-Assist pad/interfacing board

X-Assist LCD board

The LCD board is incredibly complex, but since it was manufactured as a whole and can still be purchased on auctions or second-hand market nowadays, there's no real interest to build it from scratch ! And I personally wouldn't try : that seems too much complex

So remaining is pad and interfacing board : fortunately it uses standard components and not any Gate Array Logic-ish components that would need to be reverse-engineered too. Simply speaking, it's like assembling LEGOs
Multi-meter, a LCD board, electronic breadboard, a bunch of wires, few electronic components ... is there something missing ? Yes ! A LOT of motivation !!

X-Assist DIY prototype, in all its glory

It's so beautiful it deserves another picture !

Let's try for real ! Of course, after verifying any eventual short-circuit with a multi-meter 
No short-circuit ? It's then ready for the "first-lighting ceremony" (火入れ式), as it is nicknamed in my neighboring ... I don't know if that's a common expression in Japan or anywhere else, but I like its naming anyway

No sparks ? No smoke ? That looks good

At first glance, that seems working ! Let's try cheat codes search feature in order to be 100% sure ...

Search unit not found ?!

Arg, it was too early to sing victory X-Assist seems not being correctly detected by X-Terminator cartridge ...
Since text could be sent to the LCD, let's assume nearly everything is working correctly, and that a small detail is causing this trouble ... after some head-scratching, XRider found what's wrong : a Zener diode that initially looked useless was used to return some ACK to X-Terminator cartridge when looking for its connection !

The X-Assist screen after adding the Zener diode :
code search memory could be captured !

65535 candidate codes ?! I'm not sure if correct cheat code could be found this time, but at least the DIY X-Assist unit works correctly now


Additional informations are available in French  on Darius forums :

Credits :
 - XRider, for the good work in game cartridges preservation
 - Darius, for gathering French community around Saturn

Read more X-Terminator Cartridge Revival

Back from Holidays

Written by cafealpha 2 comments
Just a small post to indicate I'm back from holidays
In fact, I went back home one week ago, but didn't had time to write this article so far ... but in comparison with other articles on this blog, this one is quite timely anyway

Hand Spinner ! 540 Yens ! 売れています!
It seems I took vacations to the last place in the world where
hard spinner are still popular

Pseudo Saturn Kai development is continuing at its own rhythm. Development finally escaped from off days without a lot of progress, and is now in the period when I want to hurry to finish "this and that features" before release. Let's hope that motivation will continue flowing, and also that work won't be too greedy with my free time too

I honestly have no idea when Pseudo Saturn Kai will be ready for release except than "when it's done" So, please be more patient until having fun with cheat codes !

Among other small things, I'm currently making some updates to the credits page. Because a careless mistake until version 6.074, credits page was available only in Pseudo Saturn Kai full version, hence this will be the debut for it on next release for Action Replay users

Read more Back from Holidays

Gamer's Cartridge available back soon !

Written by cafealpha no comments
A small article to keep informed about Gamer's Cartridge availability

So, I recently went out of Dezaemon 2 themed labels. Because being game-specific, I was expecting theses labels popular only for a niche of users, and prepared stocks accordingly, but theses actually became the main choice among the few labels available for Gamer's Cartridge, without letting me time to prepare extra stock for them

Okay, I admit I didn't checked actively the stock of theses labels, and started to panic when I saw that only 1 or 2 were remaining Additionally, I didn't had a lot of time during Spring holidays too ... March is always a busy month in Japan

Next batch of Dezaemon 2 labels is currently in preparation, so please be patient until they become available
I don't prepare theses labels by myself for the simple reason that my friend Darius cut them way better than me (1), so some extra delay is required for shipping. But basically theses will be available on the second half of this month

(1) And also because my printer is barely good enough to prepare new year postcards, and jam when processing A4 paper There's also some know-how required to prepare theses labels, such as selection of paper (it is using paper designed for use on car body), as well as cutting process too, as detailed in an previous article. Without Darius, labels for Gamer's Cartridge wouldn't exist

Dezaemon 2 labels for Gamer's Cartridge
Design by Mr beebaraka, and printing/cutting by Darius.
That's probably the component I'm the least involved in,
which explains why it's the most fancy one

On a less positive note, I am in the regret to announce that I'm out of stock of black shells, and that theses are no longer available for purchase

White Saturns have their plastics fading in several tones from "pure white as on first day" to "heavy smoker's dirty yellow", making difficult to adjust color difference between Saturn body and cartridge. Black Saturns doesn't have this plastic fade problem, which was the main reason why I was providing black cartridge shells

As I'm re-using Action Replay cartridge shells for Gamer's Cartridge, and that standard color for them is white, it's very unlikely I will get black shells in the future. But anyway, that doesn't stops availability of Gamer's Cartridge itself

Black cartridges out of production !
But white ones are still available from time to time

Read more Gamer's Cartridge available back soon !

Cheat codes overlap check feature

Written by cafealpha 4 comments
"Overlap check" ... yeah, I know that I'm always terrible when finding a name for a new feature or a new project

So, as its name may suggest, this feature check for cheat codes that would not work correctly together, and automatically unselect some cheat(s) in order to get things working as expected.
One illustration would be level select cheat code : some games may have a list of cheats like "play level 2", "play level 3", "play level 4", and so on. (no, there is usually no cheat code to play level 1 )

Example with Sonic 3D blast cheat codes : it's no longer
possible to simultaneously enable several "Play xyz level" codes
thanks to this overlap check feature

When trying cheat codes for the first time, the reflex would be "enable them all !", and in that case this would lead to undefined behavior. In typical case, game just work fine and since cheat codes are executed in the order from their list, the last overlapping cheat takes priority.

But, some games are quite picky regarding execution time, so the faster cheat codes handler is executed, the better. In other words, the less codes enabled, the more chances game have to work correctly.
Here is one example in video with NiGHTs into dreams : first half of the video shows cheat codes causing graphic glitches, and second half show updated Pseudo Saturn Kai version fixing theses glitches :

NiGHTs into dreams : graphic glitches caused by
cheat codes slow handler.
Video available on youtube.
Left : slow cheat codes handler, causing missing quads on screen
Right : game as well as unlimited time cheat code working fine

Hrm, that's around half a year ago, and I'm still fixing things for the same main feature  Well, that's how software development works : fixing bugs, adding new bugs, and returning back to step zero. Maybe smart people can develop things faster, but ... I'm not smart, so the best solution is to continue the endless development iterations until getting something OK for release

Illustration of Pseudo Saturn Kai development
(From The Crimson Permanent Insurance movie)

So well, let's go back to original topic, and let's add that I also felt bad each time I was enabling two incompatible codes. "Play level 2" : enable, "Play level 3" : enable, start game ... what will it do ? Maybe a thermonuclear meltdown because of some divide by zero error  ?! Well, it actually plays level 3, but that's unpleasant anyway.
I implemented cheat codes features from (basically) scratch first for fun (yes, I like 6+ months span software development projects ! ), but also for the freedom of making what I want. Especially, making cheat codes as user-friendly as possible ! So that this "overlap check" feature was added

Here is another example with cheat codes for Virtua Fighter Kids : this is an interesting example because some cheat codes for this game are using "enable code" (starting with `D') : this kind of code is sometimes used to prevent from executing other codes, typically when game module to cheat is not yet loaded, and that writing something to its location would make the game not working correctly.
As a consequence, "enable code" have a global effect on all enabled cheats, hence multiple "enable code" can't be enabled simultaneously.

Virtua Fighter kids uses "enable code" for a slightly different purpose : setting player health to a given value (50% of maximum, one HP, etc) only when it is set to maximum, ie on fight start time. By using this trick, game can then decrease health value, allowing to set some handicap to a given player.
This behavior is completely different in comparison to "unlimited health" cheat that always forces health value to maximum

Virtua Fighter Kids cheat codes list : "50% healt" and
"1-Hit Death" codes are the ones using enable codes

And, Virtua Fighter Kids is a good example, because it uses "enable code" at two different locations : at player 1 health value (06045974) and player 2 health value (06046A74). As only one "enable code" can be used, it's for example not possible to enable "1-hit death" code for both players.

Left : 1-Hit Death code enabled for P1
Right : P1 1-Hit Death code automatically disabled after
1-Hit Death code for P2 is enabled

Additionally, unlimited health for P2 is also automatically disabled, which is normal because it is in contradiction with 1-hit death code for it. From cheat code point of view, theses two codes write to same address, which doesn't makes sense.

"Hey, but I like "One Punch Man" series, and really want to enable theses two 1-hit death codes when playing Virtua Fighter Kids !" would you say ?
Well, that's not possible as-is, but adding a new cheat code setting both players health to 1 when health of any player is set to max value should do the job ♪
I didn't verified this code for real (in fact, I thought about it when writing this article), but it should be OK : "trust me, I'm an engineer"

1-Hit Death code for both P1 and P2
This could also be named "Two gentlemen duel"

I would like to finish this article with the introduction of a bug I fixed recently : I usually don't spend time in speaking about bugs I fix, because this would take too much time But the behavior of this one is very unexpected :

Text display is suddenly uncentered !?
Never though though such goofy bug
would be possible

So, this bug is triggered when selecting item in menu with scrolling text, and when text starts to scroll. The two features in relation with this bug (text centering and scrolling) are apparently unrelated, but the menu module used by Pseudo Saturn Kai is so spaghetti-ish that theses two features can collide into a bug

I'm honestly proud of this menu module It was initially designed for simple menu without even vertical scrolling, but evolved little by little in order to support each new features added to Pseudo Saturn Kai.
It's a complete spaghetti monster, but it works ! Yes, it works : trust me, I'm an engineer !

Read more Cheat codes overlap check feature

Rss feed of the articles