Backup and Burning of Playstation/PocketStation saves

Hey Hackaday readers! Unfortunately this post is not about reverse engineering of the pocketStation, I guess Hackaday got it wrong because the original post is in Portuguese. Yet,  it actually is about how I got to burn new ROMs and read its contents as well. If you like to stay, enjoy yourself.

Intro

I would like to start by talking about the many hours of fun in my childhood provided by my Playstation, but unfortunately, I never had one. If I’m not mistaken, the only PS1 game I ever played was Digimon Rumble Arena. Despite this, because of my interest in video games and hardware, I know one thing or another about it.

Nintendo and Sony united to create a device that would allow the SNES to use CDs. Nintendo canceled the project with Sony, who decided to create their own console. Nintendo after a while would join (and would also give up) Philips with the same purpose. What resulted in CD-i, and things like these.

Yes, about the Playstation. I found on eBay this device called PocketStation, which was released in Japan only. The PocketStation can be used as a Plasystation memory card, but also as a tiny portable console, running extras that came with PS1 Games. Final Fantasy XIII for example, came with Chocobo World that ran in the PocketStation. The PocketStation also allowed you to send or exchange saves with friends through an infrared port.

pcket

Researching a little, I found info that said the PocketStation had an AMR 7TDMI processor, the same as the GBA. The screen resolution of 32×32 pixels, 128KB of program memory, 2KB of RAM, powerful specifications for something 16 years ago. I ended up buying a unit on eBay, even without knowing about its communication protocol or how to “inject” code into the device.

First, I had to figure out how to access its program memory. The programs that the PocketStation runs are stored as saves. They are usually burned by the console that recognizes the PocketStation simply as if it were an ordinary memory card. I then searched for console-memory card communication.

Reading Saves

Protocol e Signals

Martin Korth, not only programmed the PS1 emulator no$psx (no cash psx), but also did an excellent job of documentation on the PlayStation insides. Its page explains everything about the hardware of the console and the signals and protocols used between video game and controls, memory cards and even rod controls for fishing games (portuguese: eita).

In his page, You can find the protocol specifications used by the console to access controls and memory cards. In summary, the protocol is similar to SPI. The clock line is idle in high state (CPOL = 1), input is picked up at the rising edge and the output is changed at the descent edge (CPHA = 1), while data is transferred at 250KHz, starting with the least significant bit (LSB first). In addition, there is also an ACK pin that responds with a pulse after a byte is transmitted.

I looked for a ready implementation to access the stored saves. I found ShendoXT blog, but could not get his python script to work. My Arduino code is slightly based on his sketch though.

Connection of the memory card/pocketstation to Arduino

The Arduino code uses the SPI port, these pins can not be changed and depend on the board. In most Arduino boards this was standard, but with the appearance of new boards the SPI pins vary greatly. I used an Arduino mini that I bought on eBay for less than two dollars.

img_0288

Below a description of the pins and their connection to the Arduino (UNO,mini,Nano,NG):

i did not have aMemory card slot, so what to do?

I have been using these pin headers in all kinds of workarounds, haha. Here I used a double one, the connection is stable enough. Always works ;)

img_20160918_111618760Improvised memory card slot.

Okay, everything connected. time to code!

SPI port configuration on Arduino

From the specs on the no$psx page, SPI was configured as follows:

The two first lines are to activate the pull up resistors on the input pins, as the memory card can only lower the line voltage level. New Arduino models have SPI on different pins, so the code may needs to be adjusted accordingly.

Byte transmission

Transmission is simple, as the SPI port takes over. However, notice the delay after the transmission. An ACK is expected to grant receipt of the byte. When the ACK is received, the program starts to transmit the next byte.

At the time that the SPI port transmits one byte, another byte is received following, that byte is returned by the tranfer() function. This is useful since the memory card returns specific values in certain situations, for example, when the last byte of a packet is transmitted, a 0x47 (Ascii ‘G’ for good) is returned if it is ok.

Reading saves code for the Arduino

Given the info about the reading and writing commands in the no$psx page, the following code is used to read from a sector of flash. There are in all 1024 sectors of 128 bytes, 16 of these sectors form a block and a save always uses at least one block. The first block in flash is used as a directory and contains information of which blocks are occupied and with which save file.

This function is used 1024 times to read all sectors. That simple.

Reading scrip in Python

The Python script just receives the bytes from the serial port and saves them to a file.

Burning saves

To store the saves just use the same Python script and select the write option. Recording is a more delicate process than reading and every time a sector is sent to Arduino, the bytes are checked before writing to memory, if the checksum is different than expected, Arduino requests the retransmission of that sector.

Below the writeSector () function in Arduino:

Python code:

The complete code is over my github.

Below is a Megaman2 rom for  the pocketstation that was burned with the Arduino. Success!

img_20160918_111346913

Alternative Hardware

Haved a bunch of cables every time you connect the memory card / pocketstation is not cool. So I soldered the board below, using one of the spare atmega8 I have here. That way I just need to connect the device to an ftdi converter and I can swap the saves easily.

img_20160918_111153367

Whenever the pocketstation is being written to, it shows this message and lights up the led at the top.

img_20160918_111208485An Atmega8 was used. No code modification was required.


Then that’s it. Now you know how to transfer your saves to the computer or save saves from the internet to your memory card. :)

See ya next post 0/

 WTFPL

This post is under the Do What The Fuck You Want To public license.

Robson Couto

Estudante de engenharia elétrica. As vezes parece gostar mais dos consoles antigos que dos jogos. Tem interesse em dominar bits, bytes e afins.

One thought on “Backup and Burning of Playstation/PocketStation saves

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

*