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):

  _____________
 /             \       Pin connections:
|               |         1 - Data        -> Connect to pin 12 on Arduino (MISO)
|               |         2 - Command     -> Pin 11 of Arduino (MOSI)
|  MEMORY CARD  |         3 - 7.6V        -> 5V of Arduino
|               |         4 - GND         -> Gnd of Arduino
|               |         5 - 3.6V        -> 3.3 of Arduino
|_______________|         6 - Atention    -> Pin 10 of Arduino (CS)
|1 2|3 4 5|6 7 8|         7 - Clock       -> Pin 13 of Arduino (SCL) 
                          8 - Acknowledge -> Pin 2 of Arduino (INT0)

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:

  //activate pull up
  pinMode(2, INPUT);
  digitalWrite(2, HIGH);
  pinMode(12, INPUT);//For Arduino Uno,Mini...
  digitalWrite(12, HIGH);
  
  SPI.setClockDivider(SPI_CLOCK_DIV64);//16MHz/64 =250KHz
  SPI.setBitOrder(LSBFIRST);
  SPI.setDataMode(SPI_MODE3);//CPHA=1 CPOL=1
  SPI.begin();

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

byte transfer(byte data) {
  byte rx;
  response = HIGH;
  rx = SPI.transfer(data);
  int timeout = 2000;
  while (response == HIGH) {
    delayMicroseconds(1);
    timeout--;
    if (timeout == 0) return 0; 
  }
  return rx;
}

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.

void readSector(unsigned int Adr) {
  digitalWrite(CS, LOW);
  transfer(0x81);
  transfer(0x52);
  transfer(0x00);
  transfer(0x00);
  transfer(Adr >> 8);
  transfer(Adr & 0xFF);
  transfer(0x00);
  transfer(0x00);
  transfer(0x00);
  transfer(0x00);
  for (int i = 0; i < 128; i++) {
    Serial.write(transfer(0x00));
  }
  transfer(0x00);
  SPI.transfer(0x00);
  digitalWrite(CS, HIGH);
  delayMicroseconds(500);
}

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.

romsize=128*1024 #128K
name=input("What's the name of the file?")
ser.write(bytes("R","ASCII"))
numBytes=0
f = open(name, 'ab')#open for appending
while (numBytes<romsize):
    while ser.inWaiting()==0:
        print("waiting...\n",numBytes)#shows the number of bytes read
        time.sleep(0.1)
    data = ser.read(1)
    f.write(data)#put a byte to the file
    numBytes=numBytes+1

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:

void writeSector(unsigned char MSB, unsigned char LSB){
  byte dataBuffer[128];
  byte response;
  for(int i=0;i<128;i++){
        while(Serial.available()==0);
        dataBuffer[i]=Serial.read();
  }
  byte CHK = MSB;
  CHK^=LSB;
  digitalWrite(CS, LOW);
  transfer(0x81);
  transfer(0x57);
  transfer(0x00);
  transfer(0x00);
  transfer(MSB);
  transfer(LSB);
  for (int i = 0; i < 128; i++)
  {
    transfer(dataBuffer[i]);
    CHK ^= dataBuffer[i];
  }
  transfer(CHK);
  transfer(0x00);
  transfer(0x00);
  response = SPI.transfer(0x00);//At least for the Pocket Station, the last byte never gives a ACK, so the tranfer method is not used here to agilise.
  digitalWrite(CS, HIGH);
  delayMicroseconds(500);
  if(response!='G')CHK=~CHK;//problem at writing sector, forces the PC to resend the sector by chaging the CHK
  Serial.write(CHK);
}

Python code:

f = open(name, 'rb')
for i in range(1024):
    ser.write(bytes("W","ASCII" ))
    time.sleep(0.001)
    ser.write(struct.pack(">B",i>>8))
    CHK=i>>8
    time.sleep(0.001)
    ser.write(struct.pack(">B",i&0xFF))
    CHK^=i&0xFF
    time.sleep(0.001)
    data=f.read(128);
    print(data)
    print("CHK:", CHK)
    for i in range(len(data)):
         CHK =CHK^data[i]
    time.sleep(0.001)
    print("CHK:", CHK)
    response=~CHK
    while response!=CHK:
        ser.write(data)
        while ser.inWaiting()==0:
            time.sleep(0.0001)
        response=ord(ser.read(1))
        print("rsp", response)    
f.close()

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

Recetnly graduated electrical engineer. I enjoy devoting my time to learning about computers, electronics, programming and reverse engineering. My projects are documented in this blog when possible.

35 thoughts to “Backup and Burning of Playstation/PocketStation saves”

  1. 这个网站 提供 丰富的 成人内容,满足 各类人群 的 兴趣。
    无论您喜欢 什么样的 的 影片,这里都 应有尽有。
    所有 材料 都经过 严格审核,确保 高品质 的 视觉享受。
    拜物教
    我们支持 各种终端 访问,包括 手机,随时随地 畅享内容。
    加入我们,探索 无限精彩 的 私密乐趣。

  2. I know this if off topic but I’m looking into starting my own blog and was wondering what all is needed to get setup? I’m assuming having a blog like yours would cost a pretty penny? I’m not very internet smart so I’m not 100 sure. Any tips or advice would be greatly appreciated. Thanks

  3. I’ve been absent for some time, but now I remember why I used to love this site. Thank you, I抣l try and check back more often. How frequently you update your website?

  4. I think other web site proprietors should take this site as an model, very clean and wonderful user friendly style and design, let alone the content. You are an expert in this topic!

  5. The next time I read a weblog, I hope that it doesnt disappoint me as much as this one. I mean, I know it was my choice to read, but I actually thought youd have one thing interesting to say. All I hear is a bunch of whining about one thing that you might fix for those who werent too busy looking for attention.

  6. Greetings from Florida! I’m bored to tears at work so I decided to check out your website on my iphone during lunch break. I enjoy the information you provide here and can’t wait to take a look when I get home. I’m amazed at how fast your blog loaded on my cell phone .. I’m not even using WIFI, just 3G .. Anyhow, amazing blog!

  7. Трендовые фасоны сезона этого сезона задают новые стандарты.
    Популярны пышные модели до колен из полупрозрачных тканей.
    Блестящие ткани создают эффект жидкого металла.
    Греческий стиль с драпировкой возвращаются в моду.
    Минималистичные силуэты создают баланс между строгостью и игрой.
    Ищите вдохновение в новых коллекциях — стиль и качество сделают ваш образ идеальным!
    http://magazine-avosmac.com/php-mauleon/viewtopic.php?f=5&t=995488

  8. Thanks for your write-up. My partner and i have always seen that the majority of people are eager to lose weight since they wish to look slim and also attractive. Nonetheless, they do not continually realize that there are additional benefits for you to losing weight as well. Doctors insist that fat people are afflicted by a variety of diseases that can be directly attributed to the excess weight. Thankfully that people who sadly are overweight along with suffering from diverse diseases can reduce the severity of their own illnesses by way of losing weight. It is possible to see a gradual but marked improvement with health if even a bit of a amount of fat reduction is obtained.

  9. hello!,I like your writing so much! share we communicate more about your article on AOL? I require an expert on this area to solve my problem. Maybe that’s you! Looking forward to see you.

  10. Свадебные и вечерние платья нынешнего года вдохновляют дизайнеров.
    Популярны пышные модели до колен из полупрозрачных тканей.
    Блестящие ткани придают образу роскоши.
    Греческий стиль с драпировкой становятся хитами сезона.
    Минималистичные силуэты придают пикантности образу.
    Ищите вдохновение в новых коллекциях — оригинальность и комфорт превратят вас в звезду вечера!
    https://www.fm-haxball.co.uk/community/viewtopic.php?f=2&t=246664

  11. Needed to draft you that little bit of remark to say thanks as before with your great basics you have shown on this website. It is quite pretty open-handed of people like you to grant publicly exactly what many of us could possibly have supplied for an ebook to help make some bucks on their own, chiefly considering the fact that you might have done it in case you considered necessary. Those tricks likewise acted as a great way to fully grasp many people have a similar passion similar to my own to see somewhat more with reference to this condition. Certainly there are millions of more enjoyable times ahead for individuals who go through your blog.

  12. Looking for exclusive 1xBet promo codes? This site offers verified bonus codes like GIFT25 for new users in 2024. Claim €1500 + 150 FS as a first deposit reward.
    Use trusted promo codes during registration to maximize your rewards. Benefit from risk-free bets and special promotions tailored for casino games.
    Find monthly updated codes for global users with fast withdrawals.
    Every voucher is checked for validity.
    Grab limited-time offers like GIFT25 to double your funds.
    Active for new accounts only.
    https://optimusbookmarks.com/story19611070/unlocking-1xbet-promo-codes-for-enhanced-betting-in-multiple-countriesKeep updated with top bonuses – apply codes like 1x_12121 at checkout.
    Experience smooth benefits with instant activation.

  13. Looking for exclusive 1xBet promo codes? Our platform offers working bonus codes like 1XRUN200 for registrations in 2024. Get up to 32,500 RUB as a welcome bonus.
    Activate trusted promo codes during registration to boost your rewards. Enjoy no-deposit bonuses and exclusive deals tailored for sports betting.
    Discover daily updated codes for global users with fast withdrawals.
    All promotional code is checked for validity.
    Grab limited-time offers like GIFT25 to double your funds.
    Valid for first-time deposits only.
    https://avitotm.biz/user/profile/160974Stay ahead with 1xBet’s best promotions – enter codes like 1XRUN200 at checkout.
    Experience smooth rewards with instant activation.

  14. I have observed that wise real estate agents everywhere are starting to warm up to FSBO Marketing. They are knowing that it’s not only placing a poster in the front property. It’s really with regards to building human relationships with these sellers who at some time will become consumers. So, while you give your time and efforts to assisting these suppliers go it alone : the “Law of Reciprocity” kicks in. Great blog post.

  15. На платформе доступен уникальный бот “Глаз Бога” , который обрабатывает информацию о любом человеке из публичных баз .
    Платформа позволяет узнать контакты по фотографии, раскрывая информацию из социальных сетей .
    https://glazboga.net/

  16. Хотите найти подробную информацию для нумизматов ? Наш сайт предоставляет всё необходимое погружения в тему монет !
    У нас вы найдёте редкие экземпляры из исторических периодов, а также антикварные предметы .
    Просмотрите архив с характеристиками и высококачественными фото , чтобы найти раритет.
    золотые 100 рублей
    Для новичков или эксперт, наши статьи и гайды помогут расширить знания .
    Воспользуйтесь возможностью приобрести лимитированные артефакты с гарантией подлинности .
    Станьте частью сообщества энтузиастов и будьте в курсе аукционов в мире нумизматики.

  17. Furthermore, i believe that mesothelioma cancer is a scarce form of many forms of cancer that is typically found in those people previously familiar with asbestos. Cancerous cells form while in the mesothelium, which is a protective lining which covers most of the body’s areas. These cells typically form while in the lining on the lungs, abdominal area, or the sac that encircles one’s heart. Thanks for discussing your ideas.

  18. Эта платформа публикует свежие инфосообщения со всего мира.
    Здесь доступны события из жизни, бизнесе и разнообразных темах.
    Новостная лента обновляется ежедневно, что позволяет не пропустить важное.
    Минималистичный дизайн помогает быстро ориентироваться.
    https://whitezorro.ru
    Каждая статья написаны грамотно.
    Целью сайта является честной подачи.
    Следите за обновлениями, чтобы быть на волне новостей.

  19. Размещение видеокамер поможет контроль территории на постоянной основе.
    Инновационные решения позволяют организовать высокое качество изображения даже в темное время суток.
    Вы можете заказать различные варианты оборудования, подходящих для бизнеса и частных объектов.
    videonablyudeniemoskva.ru
    Качественный монтаж и консультации специалистов делают процесс эффективным и комфортным для всех заказчиков.
    Свяжитесь с нами, и узнать о оптимальное предложение в сфере безопасности.

  20. Looking for free online games ? Our platform offers a exclusive collection of casual puzzles and action-packed quests .
    Explore cooperative missions with global players , supported by intuitive chat tools for seamless teamwork.
    Access customizable controls designed for effortless navigation , alongside parental controls for secure play.
    nz online casino
    Whether sports simulations to brain-teasing puzzles , every game balances fun and cognitive engagement .
    Unlock premium upgrades that let you play for free , with subscription models for deeper access.
    Join of a thriving community where teamwork flourishes , and express yourself through immersive storytelling.

  21. Хотите найти данные о пользователе? Этот бот поможет детальный отчет мгновенно.
    Используйте уникальные алгоритмы для анализа цифровых следов в соцсетях .
    Выясните место работы или интересы через автоматизированный скан с верификацией результатов.
    поиск глаз бога телеграмм
    Система функционирует с соблюдением GDPR, используя только открытые данные .
    Закажите детализированную выжимку с историей аккаунтов и списком связей.
    Попробуйте надежному помощнику для digital-расследований — результаты вас удивят !

Leave a Reply

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