PPCenter :: devblog

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

I wanted to publish an article this October ...

Written by cafealpha no comments
... and all of a sudden, November arrived

It's not like being under a quota of articles to write every months would stop the financing of my Saturn projects and in fact, as described on my "donate" page or this blog article, I don't have any interest in crowdfunding, or some kind of third party financing : if I'm not in the mood, or don't have enough free time to update this blog, then I don't update it

But well, moreover not being paid for not writing blog articles, as I actually have to pay to keep this blog alive (web page hosting is cheap but not free, but at least it's my own homepage ), I like to feed this blog from time to time even when being busy with real life things
So don't worry, I didn't stopped this blog : currently, I have one ongoing article that is waiting for its last paragraph and proofreading etc, but as I started more than two weeks ago (yes, that's my usual pace when preparing blog articles), please be patient until I finish it
I do have some ideas for future articles too, but theses are just ideas currently recorded as single lines in my TODO list, so I don't know when I actually start writing them


Regarding Pseudo Saturn Kai project, I ... didn't had a lot of free time to continue it recently In fact, I think I just turned on my Saturn once last month just to test if -as requested by someone by email- DoDonPachi worked with Pseudo Saturn Kai or not. The game worked fine here, so I turned off my dev Saturn an put it back in my closet for better times when I will be more available
BTW, I'm currently experiencing an unexpected burst of things to do at work, so it may take a while until things return back to normal But as I can't live without doing my Saturn projects, I promise that things will return back to normal as soon as possible


... Well, the contents in this article are a bit poor, so let's fill remaining space with random facts about my life recently The "okra" plant I wrote about in a previous blog article is still going well and I continue to water it regularly.

Okra in all its glory, 2018/10/18

Since summer is now finished, I no longer have to water it everyday, so that I now just do this regularly enough to prevent it from finishing yellow and burned  And yes, the kid who took back that from school completely forgot about its existence
I'm not keen on gardening (as suggested on the picture above, I don't even own a garden), but have a couple of pictures of other green things in reserve ... and I keep theses to fill future small posts

Read more I wanted to publish an article this October ...

[Dev journal] Pseudo Saturn Kai game loader weird bug, and its bugfix

Written by cafealpha 3 comments
(Note : this bug was fixed something like 3 months ago. Pseudo Saturn Kai I first released last month works well  )

First : of course, old versions of Pseudo Saturn (versions up to 0.832) work
But who knows what may happen when doing software engineering (and any other engineering in fact) : it's very common to break something without directly modifying anything to it !

So it happened : in December 2015, Pseudo Saturn Kai beta tester reported that it wasn't possible to load CD-R game.

data/images/20160325_loader_bug.tb.jpg
What game loader bug looks like.
disc_type=0x0003 means that CD-ROM authentication failed


As usual, I first asked if something was wrong on tester side  "Bad game dump ?", "Bad burn to CD-R ?", "Did you do something else bad ?", etc.
(I know that's a bad habit to suspect beta testers doing something wrong, but it sometimes help in fixing problems)

Beta tester was actually doing his job well, and bug couldn't be reproduced in next beta version, so I though it was caused by outdated intermediate file in build process (this happens, for example when I modify header file only : I'm too lazy to fix makefiles about this ) : cleaning up whole project and rebuilding everything prevents such kind of problem.

But I wasn't satisfied with such "half-baked" bugfix, and actually could hear it saying to me "I'll be back"


And, two months after that time, I receive same bug report from same beta tester ...
Well, at least, I didn't had to re-ask him if he tested correctly or not : it was clear that this was December 2015 bug returning back.


First, let's verify do simple things and try to reproduce the bug here : my "main" dev Saturn is a modchipped one that plays CD-R, even when firmware is reported not working. Trying with a "plain" (unmodded) Saturn actually reproduces the bug : cartridge boots, but definitely doesn't want to play CD-R.
In same conditions, let's try with an old version of the firmware : oh, it can play CD-R

So I could "feel" the bug, and its capricious nature.
"Typical" capricious bug is "uninitialized global variable" one, that reproduces after doing the same action twice, or after going to a given screen, returning back to another screen, and doing a given action.
Saturn has relatively few RAM available, and I don't want to use dynamic memory allocation on such "low specs embedded device", so such "uninitialized global variable" happens from time to time.

But this bug was even more capricious than "uninitialized global variable" one : same action reproduces the bug with a given firmware, but can't reproduce the bug with another firmware

First, since I have no idea about the cause of such bug, I added some debug screen that displays few details (= the return values of each functions called when unlocking the CDROM unit), and also some text-based logs, plus RAM dumps stored SD card : that was one of the reasons why I made SD card-based cartridge for Saturn : it allows to prepare bug report on user side

So I "just" have to wait until bug is reproduced with next versions, and beg for logs/dumps/etc on that time.
Of course, the bug reproduced, and of course ... logs/dumps/etc didn't helped a lot

data/images/20160408_sakura_6008.tb.jpg
Game loader failure screen.
Basically, it shows that something is wrong after
calling cd_move_sector_data_cd_auth function.


Fortunately, there are some explanations about Pseudo Saturn CD unlock exploit on assembler forums :
1. Use the Put Sector Data command to put a whole bunch of sectors into the CDB - all with FAD 150, Mode 2 in their headers.
2. Call End Data Transfer to push them into the selector.
3. Call Copy Sector Data, starting a copy of all those fake sectors into the selector that the Authenticate Disc command will be using.
4. Immediately (like 15 microseconds later immediately) call the Authenticate Disc command, specifying the same selector.


"Immediately" : firmware have to be fast on step 4.
And what changes in CD-ROM unlock code from a firmware beta version to another is basically its execution start address.
So I started to think : "maybe CD-ROM unlock code will work better if loaded from a constant address ?" : to do this, I moved all CD-ROM code to a separate stub, loaded from a constant address (0x06004000).

And bug didn't reappeared so far

Okay, this way of fixing things without a proper verification is a bit dirty
But it works, and that's the most important
(I suspect the cause of this bug related to SH2 cache : if SH-2 have to refresh cache during time critical section of CD-ROM exploit, code takes too long to execute, and CD-ROM exploit fails ... it's just a guess, and I realized about it after fixing it.)

Special thanks to Stac, Shazz and A Murder of Crows for beta testing
And special thanks to jhl and CyberWarriorX for detailing Pseudo Saturn's CD-ROM exploit ! This helped a lot in fixing this bug

Read more [Dev journal] Pseudo Saturn Kai game loader weird bug, and its bugfix

Long time without using my TI89

Written by cafealpha no comments
Today was a nostalgia day : I uploaded program to my good old TI-89 via "$4 parallel link cable" I made around 15 years ago, when I was high school student

data/images/20150317_ti89_parallel_link.tb.jpg
My TI-89 and its "$4 parallel cable", still working

First, I wanted to use my 7 years old desktop PC with parallel printer port available ... but it stopped to work after 2 minutes of usage. However heavy washing of CPU fan (yeah, "washing" : I put it in the water, then used my hair dryer to dry it) solved this
I then tried to install TILP program, but I was lost in installing GTK (), and link related DLLs ... a real nightmare, and it didn't worked too ... (Sorry Lionel and other TILP authors ! Your soft is great, but its installer is a real piece of crap)

So I tried even older W32Tran8x, a program made under Win9x era.
Except DlPortIo that needed to be updated to work under Windows7, everything worked fine !!!
data/images/20150306_w32tran.png
W32Tran8x, with its good old nearly wintage Win3.x-like file browser
The simpler the better 
I will try to keep this way of thinking when creating Saturn programs or cartridges

Edit : I successfully installed GTC, an oncalc C compiler. Thank you Pollux (GTC author) for your great work 
It's funny to program on a machine where sizeof(int) equals 2.

Read more Long time without using my TI89

Rss feed of the tag