Pseudo Saturn Kai development : USB dev cart support
... Until now

(Well, in fact, it was "until a couple of months ago", because I didn't had time to write this article earlier.)
So, a USB dev cart new user (Shazz) wanted to do some Saturn development : great


USB dev cart demonstration video (youtube).
I used Shazz's USB dev cart to make this video,
in order to be sure it worked well before sending it to him.
His dev PC runs under Linux ... I personally use Windows only, so I can't guarantee USB dev cart + Pseudo Saturn Kai will work correctly.
"Maybe it will run fine with antime's ftx tool".
"Maybe"
Of course, it didn't worked

My first suggestion was "please use an old PC with Windows installed lol", but Shazz don't like such half-concession, and really wanted his USB dev cart to work directly on his Linux dev PC.
As an USB dev cart manufacturer, I agree with him.
As a programmer already busy with other projects and real life, I disagree ^^
But, Okay, Shazz is actually a cool and chatty guy, and sharing same mother tongue with me, so I will do it for him

The cause of the problem happening when using Linux + USB dev cart with Pseudo Saturn Kai is actually still unclear.
With original USB dev cart firmware (nicknamed as "blinking screen", or sometimes "epileptic screen"), executing a Saturn program with "ftx" utility works fine.
However, with Pseudo Saturn Kai installed, the same operation didn't worked and Pseudo Saturn Kai main screen was freezing (? or continuing doing menu things ? I already forgot about details about this bug
 It's really time to write it on this blog before I forget it completely ...) instead of switching to uploaded program.
 It's really time to write it on this blog before I forget it completely ...) instead of switching to uploaded program.I suspected Pseudo Saturn Kai ignoring two successive commands from USB dev cart ("executing" a program is actually sending an "upload" command, then "execute from specified address" command), especially because Pseudo Saturn Kai can't check for USB I/O continuously : it "just" does it once every frame.
Since I really couldn't understand why this could cause that "upload, then execute" problem, I decided to countermeasure it by adding a new "upload and execute" USB dev cart command.
And on the same occasion, I also added the "à la carte" reset flags in this command : "one stone, two birds", as people in Japan would say ... I suppose that other people would rather say "one USB dev cart command to rule them all" :D
One more problem about this "Linux + USB dev cart + Pseudo Saturn Kai" problem was that I couldn't verify if everything is working fine or not.
Shazz was OK to do some beta testing, but he can only upgrade his USB dev cart via USB link, so "breaking" USB transfer would brick his development cartridge.
Around software development, I experienced enough Murphy's law and its corollaries to be sure it won't work on first try :
- "If it can break, it will break"
- "The less you test, the more likely it will fail on basic pattern"
- "The more you test, the more likely it will fail on unexpected pattern"
So I added Pseudo Saturn Kai "demo" version

As its name suggests, it actually doesn't do anything special else than showing menus, but that's enough in order to test communication with PC.
Additionally, I also displayed some debug messages to screen when doing USB related stuff.

Pseudo Saturn Kai demo version
showing USB activity logs on screen
First two lines logs USB dev cart firmware version
verification : even if used with old (not Pseudo Saturn Kai)
version of firmware, transfer utility works

After testing many buggy versions of the firmware, Shazz tried the "20160323_test4" test pattern with his "parallax" test program, and ...
Thank you Shazz for testing Pseudo Saturn Kai + USB dev cart Linux support !
USB debug port related support is always a hell for me and cartridge users (may not work on a given OS, etc), hence there are no plan to add it in release version of my cartridges.
But even if it requires drivers and custom transfer software on PC side, debug USB connectivity is a must have when developing things on Saturn, so rather than dropping USB debug port, I plan to make a "USB + SD card interface" cartridge for Saturn developers only.
And of course, I still continue to manufacture USB dev cart

