Sufami Turbo

Strictly for discussing ZSNES development and for submitting code. You can also join us on IRC at irc.libera.chat in #zsnes.
Please, no requests here.

Moderator: ZSNES Mods

Post Reply
Jonas Quinn
ZSNES Developer
ZSNES Developer
Posts: 115
Joined: Thu Jul 29, 2004 9:51 pm
Location: Germany

Sufami Turbo

Post by Jonas Quinn »

We have problems with SD Ultra Battle - Seven Densetsu combined with SD Ultra Battle - Ultraman Densetsu.
The game crashes if the enemy performs a special attack in the first battle.
It is like that in snes9x, bsnes and ZSNES with SRAM mapped to $60-$67.

I am not sure if the games or the Sufami Turbo have SRAM.
Does anyone have valuable information for the Sufami Turbo?
Does anyone know if the Sufami Turbo has onboard SRAM?
Where does it map stuff?
byuu

Post by byuu »

There are five SRAM sizes for Sufami Turbo games.

They are:

Code: Select all

00 = 0x000000,   0kbit
01 = 0x000800,   2kbit
02 = 0x002000,   8kbit
03 = 0x008000,  32kbit
04 = 0x020000, 128kbit
The BIOS determines how much SRAM each cart has and sets $04,$05. It's still possible the ST base cart has the SRAM, but then the test below would be pretty silly, don't you think?

Further, the game only maps SRAM to $[60-63]:[8000-ffff] for cart A, $[70-73]:[8000-ffff] for cart B. It may mirror elsewhere, but the game does not access any other areas that I've seen.

Image Image

Note that for whatever reason, Seven Densetsu is making no attempt to format the SRAM inside Ultra Densetsu. You will receive an error message and the game will freeze. You have to run both games in cart A to initialize their SRAM first. Kind of a pain to emulate that. I'm thinking we need to keep SRAM for each ST cartridge, rather than keeping a "dual" mapped block that has SRAM for both in the same file. That way you can switch the games around a little easier. What I did was just run both by themselves, merge their SRAM output into one file, then play with both linked together using the below PCB memory maps:

Code: Select all

//STC-SOLO
mapper(stc_solo) {
  map(LINEAR, 0x00, 0x1f, 0x8000, 0xffff, MAP_ROM, 0x000000);
  map(LINEAR, 0x20, 0x3f, 0x8000, 0xffff, MAP_ROM, 0x100000);
  map(LINEAR, 0x60, 0x60, 0x8000, 0xffff, MAP_RAM, 0x000000);
  map(LINEAR, 0x80, 0x9f, 0x8000, 0xffff, MAP_ROM, 0x000000);
  map(LINEAR, 0xa0, 0xbf, 0x8000, 0xffff, MAP_ROM, 0x100000);
  map(LINEAR, 0xe0, 0xe3, 0x8000, 0xffff, MAP_RAM, 0x000000);
}

//STC-DUAL
mapper(stc_dual) {
  map(LINEAR, 0x00, 0x1f, 0x8000, 0xffff, MAP_ROM, 0x000000);
  map(LINEAR, 0x20, 0x3f, 0x8000, 0xffff, MAP_ROM, 0x100000);
  map(LINEAR, 0x40, 0x5f, 0x8000, 0xffff, MAP_ROM, 0x200000);
  map(LINEAR, 0x60, 0x60, 0x8000, 0xffff, MAP_RAM, 0x000000);
  map(LINEAR, 0x70, 0x70, 0x8000, 0xffff, MAP_RAM, 0x004000);
  map(LINEAR, 0x80, 0x9f, 0x8000, 0xffff, MAP_ROM, 0x000000);
  map(LINEAR, 0xa0, 0xbf, 0x8000, 0xffff, MAP_ROM, 0x100000);
  map(LINEAR, 0xc0, 0xdf, 0x8000, 0xffff, MAP_ROM, 0x200000);
  map(LINEAR, 0xe0, 0xe3, 0x8000, 0xffff, MAP_RAM, 0x000000);
  map(LINEAR, 0xf0, 0xf3, 0x8000, 0xffff, MAP_RAM, 0x004000);
}
SRAM test log:

Code: Select all

80ccb1 lda $6087ff   [$6087ff] A:08ff X:000e Y:000e S:1fe3 D:0000 DB:80 NvMxdizc V:191 H: 770
80ccb5 eor #$ff                A:08ff X:000e Y:000e S:1fe3 D:0000 DB:80 NvMxdizc V:191 H: 810
80ccb7 sta $6087ff   [$6087ff] A:0800 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdiZc V:191 H: 826
80ccbb cmp $6087ff   [$6087ff] A:0800 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdiZc V:191 H: 866
80ccbf beq $ccc5     [$80ccc5] A:0800 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdiZC V:191 H: 906
80ccc5 lda #$41                A:0800 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdiZC V:191 H: 928
80ccc7 sta $6087ff   [$6087ff] A:0841 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizC V:191 H: 944
80cccb lda #$42                A:0841 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizC V:191 H: 984
80cccd sta $609fff   [$609fff] A:0842 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizC V:191 H:1000
80ccd1 lda #$43                A:0842 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizC V:191 H:1040
80ccd3 sta $60ffff   [$60ffff] A:0843 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizC V:191 H:1056
80ccd7 lda #$44                A:0843 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizC V:191 H:1096
80ccd9 sta $63ffff   [$63ffff] A:0844 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizC V:191 H:1112
80ccdd lda $6087ff   [$6087ff] A:0844 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizC V:191 H:1152
80cce1 cmp #$44                A:0841 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizC V:191 H:1192
80cce3 bne $cceb     [$80cceb] A:0841 X:000e Y:000e S:1fe3 D:0000 DB:80 NvMxdizc V:191 H:1208
80cceb lda $609fff   [$609fff] A:0841 X:000e Y:000e S:1fe3 D:0000 DB:80 NvMxdizc V:191 H:1230
80ccef cmp #$44                A:0842 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizc V:191 H:1270
80ccf1 bne $ccf9     [$80ccf9] A:0842 X:000e Y:000e S:1fe3 D:0000 DB:80 NvMxdizc V:191 H:1286
80ccf9 lda $60ffff   [$60ffff] A:0842 X:000e Y:000e S:1fe3 D:0000 DB:80 NvMxdizc V:191 H:1308
80ccfd cmp #$44                A:0843 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizc V:191 H:1348
80ccff bne $cd07     [$80cd07] A:0843 X:000e Y:000e S:1fe3 D:0000 DB:80 NvMxdizc V:192 H:   0
80cd07 lda #$04                A:0843 X:000e Y:000e S:1fe3 D:0000 DB:80 NvMxdizc V:192 H:  22
80cd09 sta $04       [$000004] A:0804 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizc V:192 H:  38
80cd0b lda $7087ff   [$7087ff] A:0804 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizc V:192 H:  62
80cd0f eor #$ff                A:08ff X:000e Y:000e S:1fe3 D:0000 DB:80 NvMxdizc V:192 H: 102
80cd11 sta $7087ff   [$7087ff] A:0800 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdiZc V:192 H: 118
80cd15 cmp $7087ff   [$7087ff] A:0800 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdiZc V:192 H: 158
80cd19 beq $cd1f     [$80cd1f] A:0800 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdiZC V:192 H: 198
80cd1f lda #$41                A:0800 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdiZC V:192 H: 220
80cd21 sta $7087ff   [$7087ff] A:0841 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizC V:192 H: 236
80cd25 lda #$42                A:0841 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizC V:192 H: 276
80cd27 sta $709fff   [$709fff] A:0842 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizC V:192 H: 292
80cd2b lda #$43                A:0842 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizC V:192 H: 332
80cd2d sta $70ffff   [$70ffff] A:0843 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizC V:192 H: 348
80cd31 lda #$44                A:0843 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizC V:192 H: 388
80cd33 sta $73ffff   [$73ffff] A:0844 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizC V:192 H: 404
80cd37 lda $7087ff   [$7087ff] A:0844 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizC V:192 H: 444
80cd3b cmp #$44                A:0841 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizC V:192 H: 484
80cd3d bne $cd45     [$80cd45] A:0841 X:000e Y:000e S:1fe3 D:0000 DB:80 NvMxdizc V:192 H: 500
80cd45 lda $709fff   [$709fff] A:0841 X:000e Y:000e S:1fe3 D:0000 DB:80 NvMxdizc V:192 H: 522
80cd49 cmp #$44                A:0842 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizc V:192 H: 602
80cd4b bne $cd53     [$80cd53] A:0842 X:000e Y:000e S:1fe3 D:0000 DB:80 NvMxdizc V:192 H: 618
80cd53 lda $70ffff   [$70ffff] A:0842 X:000e Y:000e S:1fe3 D:0000 DB:80 NvMxdizc V:192 H: 640
80cd57 cmp #$44                A:0843 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizc V:192 H: 680
80cd59 bne $cd61     [$80cd61] A:0843 X:000e Y:000e S:1fe3 D:0000 DB:80 NvMxdizc V:192 H: 696
80cd61 lda #$04                A:0843 X:000e Y:000e S:1fe3 D:0000 DB:80 NvMxdizc V:192 H: 718
80cd63 sta $05       [$000005] A:0804 X:000e Y:000e S:1fe3 D:0000 DB:80 nvMxdizc V:192 H: 734
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Okay, I added SRAM mapping for Cart B and no more crashing there, thanks.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Post Reply