reading/writing save RAM on Nintendo 64

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

  1. jnmartin84

    jnmartin84 Robust Member

    Joined:
    Nov 11, 2013
    Messages:
    236
    Likes Received:
    31
    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
     
  2. Zoinkity

    Zoinkity Site Supporter 2015

    Joined:
    Feb 18, 2012
    Messages:
    499
    Likes Received:
    108
    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?
     
  3. jnmartin84

    jnmartin84 Robust Member

    Joined:
    Nov 11, 2013
    Messages:
    236
    Likes Received:
    31
    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.
     
  4. saturnu

    saturnu Spirited Member

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

    sanni Intrepid Member

    Joined:
    May 30, 2008
    Messages:
    653
    Likes Received:
    77
    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
  6. saturnu

    saturnu Spirited Member

    Joined:
    Dec 8, 2011
    Messages:
    143
    Likes Received:
    29
    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
  7. jnmartin84

    jnmartin84 Robust Member

    Joined:
    Nov 11, 2013
    Messages:
    236
    Likes Received:
    31
    Thanks guys, you rock. Hoping some of those links deal with writing to flash
     
    Last edited: Sep 9, 2014
  8. jnmartin84

    jnmartin84 Robust Member

    Joined:
    Nov 11, 2013
    Messages:
    236
    Likes Received:
    31
    I found "hkz-libn64" which has a filesystem-style wrapper around FlashRAM access for saving data. Going to give it a shot.
     
  9. jnmartin84

    jnmartin84 Robust Member

    Joined:
    Nov 11, 2013
    Messages:
    236
    Likes Received:
    31
    I ended up just writing some controller memory pak code and a data compressor
     
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page