Jump to content
IGNORED

HSC - Uninitialized Data / Formatting


Recommended Posts

Greetings Programs!

 

So for A7800DS emulation, my bible for High Score Cart format has been @RevEng's amazing resource:

 

 

However, I've discovered that some later homebrews (e.g. Popeye) are a bit finicky about the state of the SRAM contents.

 

If I don't run something like Asteroids (NTSC) to initialize the SRAM, the junk values seem to cause Popeye to show trash scores (mixing letters/numbers, etc).  

 

Understandable - so I initialize the HSC SRAM with Asteroids and I still get some behavior that I'm trying to understand. I assume the initialization/format would initialize all 2K of the SRAM but it doesn't - some of the bytes are not touched so it's whatever I had in my emulated SRAM buffer. That's probably fine - so long as the main tables are correct, it shouldn't matter what the actual contents of the data area SRAM is... or so I thought!

 

These two snapshots represent a HSC SRAM that was cleanly initialized by Asteroids (NTSC) with the same cartridge name ("HSC"). The rightmost one had the initial SRAM buffer loaded with FF values. The leftmost one had 00 (zero) values.

image.thumb.png.cf28ac5f63c7ba2f42e5d71496192323.png

 

In the case where my uninitialized SRAM buffer initially contained 0xFF values, a game like Popeye will pre-populate high-scores with a non-nonsensical EEEEEE.

In the case where my uninitialized SRAM buffer initially contained 0x00 values, a game like Popeye will pre-populate high-scores properly with 0s (zeros) but it also disables some of the features such as Brutus throwing 4 (four) bottles and the Novice mode background being red (i.e. the flag that is saved for that feature is clear).

 

I realize that a game should NOT care what (probably random) state the SRAM is in and should initialize things to a proper state - but it begs the question as to what is the most likely state of real uninitialized SRAM on a high score cart? That is, before battery power is applied and a cart initializes (formats) the HSC area... I assume the values would be random?  I think A7800js is zeroing the SRAM buffers before initialization. Unsure what A7800 is doing for SRAM memory init.

 

Any thoughts, clues or random mussings appreciated!

 

Lastly - not trying to throw shade on the amazing 7800 port of Popeye ... it's just the latest game that is giving my emulator a workout these days.

 

 

  • Like 4
Link to comment
Share on other sites

2 hours ago, wavemotion said:

However, I've discovered that some later homebrews (e.g. Popeye) are a bit finicky about the state of the SRAM contents.

This is a 7800basic thing. The hi-score code in 7800basic doesn't call the official hsc routines, because it provides a unified interface and driver supporting both hsc and savekey devices. At first I didn't have hsc init, because I didn't want to accidentally introduce a bug into the init and be the reason some 7800basic game cart got a reputation as an hsc eraser. (the reasoning being, a player would almost certainly have played official release titles before homebrews)

 

hsc init has been added since then, when it became apparent emulated hsc was going to be a pain point, but initially it relied on the mame nvram init values. (0xFF) I added a check for 0x00 fill later, but I just discovered a bug in it that would likely cause the 0x00 init to be skipped. :(

 

As to what the historically accurate default fill is, it's probably 0x00.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

3 hours ago, RevEng said:

As to what the historically accurate default fill is, it's probably 0x00.

 

Do we know the SRAM part number(s), the datasheet should have the default value in it?

  • Like 3
Link to comment
Share on other sites

Good idea, CPU! I recall a pic somewhere (sadly, it was on a thread of HSC engineering woes)... let me find...

 

I think it's your pic :)  (of a board you were trying to troubleshoot for somone)

 

Looks like a Toshiba TC5516APL:

image.png.315de8d05a4977c4ef89e22f19ddd18d.png

 

I just downloaded the datasheet and it's not obvious to me what an initial state would be here (probably more a reflection on my skill).

 

This is a snippet of the datasheet I found:

image.thumb.png.09010f1f7f219e6438a844da4a25b6ea.png

 

 

 

  • Like 2
Link to comment
Share on other sites

Thanks guys... for my emulation purposes, I'm going set the uninitialized SRAM area to zeros (0x00 values). It may not be completely accurate but it's predictable. I'll leave some notes in my code regarding what we theorized.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...