reading/writing save RAM on Nintendo 64

Discussion in 'Nintendo Game Development' started by jnmartin84, Sep 2, 2014.

  1. jnmartin84

    jnmartin84 Spirited Member

    Joined:
    Nov 11, 2013
    Messages:
    193
    Likes Received:
    3
    Location:
    Massachusetts, USA
    Hello,

    I was wondering if anyone had any sample code (either using libdragon or just low-level C code) for reading/writing data to/from cartridge SRAM/EEPROM/whatever its called on the Nintendo 64.

    Thanks in advance if so.

    - Jason
     
    #1
  2. Zoinkity

    Zoinkity Site Supporter 2015

    Joined:
    Feb 18, 2012
    Messages:
    460
    Likes Received:
    63
    EEPROM, SRAM, and FLASH are all very different. EEPROM is accessed the same way as you'd read the controller, but SRAM and FLASH require PI I/O.

    So, first question is how much memory do you need for saving?
     
    #2
  3. jnmartin84

    jnmartin84 Spirited Member

    Joined:
    Nov 11, 2013
    Messages:
    193
    Likes Received:
    3
    Location:
    Massachusetts, USA
    The most possibly available. If there is an option in the 128KB range that would be good, but I don't know if there is. I know Memory Pak is 32KB and I've already started to target that.
     
    #3
  4. saturnu

    saturnu Spirited Member

    Joined:
    Dec 8, 2011
    Messages:
    141
    Likes Received:
    25
    every modern flashcart can emulate 128kb, using the mempak is just uncomfortable :D
     
    #4
  5. sanni

    sanni Enthusiastic Member

    Joined:
    May 30, 2008
    Messages:
    542
    Likes Received:
    25
    Not sure if this will help

    Source: http://themanbehindcurtain.blogspot.de/2013/08/n64-sramflashram-results.html

    Sadly I could not find any contact info on his site, he is a member on assemblergames though
    http://www.assemblergames.com/forum...cartridge-savegames-to-a-64drive-everdrive-64
     
    Last edited: Sep 6, 2014
    #5
  6. saturnu

    saturnu Spirited Member

    Joined:
    Dec 8, 2011
    Messages:
    141
    Likes Received:
    25
    you can use this code for writing to sram :>
    i would recommend to set the game-ID to some sram 256 game, so the LUT autosets it for you.

    https://github.com/parasyte/alt64/blob/master/utils.c
    https://github.com/parasyte/alt64/blob/master/sram.c

    [TABLE="class: highlight tab-size-8 js-file-line-container"]
    [TR]
    [TD="class: blob-num js-line-number, align: right"][/TD]
    [TD="class: blob-code js-file-line"]int getSRAM32( uint8_t *buffer);[/TD]
    [/TR]
    [TR]
    [TD="class: blob-num js-line-number, align: right"][/TD]
    [TD="class: blob-code js-file-line"][/TD]
    [/TR]
    [TR]
    [TD="class: blob-num js-line-number, align: right"][/TD]
    [TD="class: blob-code js-file-line"]int setSRAM32( uint8_t *buffer);[/TD]
    [/TR]
    [/TABLE]
     
    Last edited: Sep 7, 2014
    #6
  7. jnmartin84

    jnmartin84 Spirited Member

    Joined:
    Nov 11, 2013
    Messages:
    193
    Likes Received:
    3
    Location:
    Massachusetts, USA
    Thanks guys, you rock. Hoping some of those links deal with writing to flash
     
    Last edited: Sep 9, 2014
    #7
  8. jnmartin84

    jnmartin84 Spirited Member

    Joined:
    Nov 11, 2013
    Messages:
    193
    Likes Received:
    3
    Location:
    Massachusetts, USA
    I found "hkz-libn64" which has a filesystem-style wrapper around FlashRAM access for saving data. Going to give it a shot.
     
    #8
  9. jnmartin84

    jnmartin84 Spirited Member

    Joined:
    Nov 11, 2013
    Messages:
    193
    Likes Received:
    3
    Location:
    Massachusetts, USA
    I ended up just writing some controller memory pak code and a data compressor
     
    #9

Share This Page