Tetris hack needs help with SRAM issue with Nestopia

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

infidelity
Posts: 426
Joined: Fri Mar 01, 2013 4:46 am

Tetris hack needs help with SRAM issue with Nestopia

Post by infidelity » Mon Apr 15, 2013 9:53 am

I hacked the nes version of Tetris, to uae SRAM for its score saving and loading. I also have some player 2 registers that reside within the SRAM.

I modified the rom to use MMC3_118.

Now my rom works on an actual RetroPak (needs already created .sav for SRAM, it works on Nintendulator, and the latest build of FCEUX.

Someone contacted me, saying they tried to install my work on a tksrom board, and he told me the scores and names are all screwed up, and player 2 has no tile flip functionality, and he said Nestopia gave him the same result.

The code I have for my sram is A980 8D01A0.

So I looked at my reset vector and I placed the code there, before I do any kind of modification to the sram. I boot the rom, and I get the same error. It seems like all of $6000-$7FFF is filled with 60's, cause thats the tile id that shows up where the names and scores should be.

I checked the nestopia log, and it does notice the A001, and loads the .sav.

I am so lost. Id appreciate any suggestions. Thank You. :-)

-infidelity

SkinnyV
Posts: 425
Joined: Wed May 04, 2011 2:41 pm
Location: Montréal, Canada
Contact:

Re: Need help with SRAM issue with Nestopia

Post by SkinnyV » Mon Apr 15, 2013 11:51 am

I can't really help you debug your issue but I thought it might be useful to let you know that I have Sram issue with your hack on my Everdrive N8 also. All the slot for high score seem to be set to 0606060. I wasn't able to beat this score so I am not sure if it would overwrite those value or if it's really a bug in the sram check routine.

3gengames
Formerly 65024U
Posts: 2281
Joined: Sat Mar 27, 2010 12:57 pm

Re: Need help with SRAM issue with Nestopia

Post by 3gengames » Mon Apr 15, 2013 11:53 am

I looked at that ROM and also found the problem, I was going to make a version that added SRAM but still...you need to enable SRAM on MMC3 before you do anything, but I think you did that. Why do you need to run code from it, though? No free space in ROM and can't just change the interrupt vector to boot to it first? Any step by step process of what happens/doesn't work? As I'm kind of mixed up at what the exact problem is.

ETA: Also, if possible, just make it mapper 4. Nobody wants to take extra steps to make a repro when it could have been done completely fine on a standard MMC3 board.

ETA: The problem is you mess with SRAM before you enable it. Enable it before you even think of touching it and whatnot and your problem should be fixed. I'd try to hack it, but I hate messing with writing around code, haha.

ETA: Enabling MMC3 WRAM before I start the game didn't help...let me also fix the header as I remember that was a problem too. ETA: Nope. I'll keep messing with it until whatever...idk what to say. Also, it even better idea.
Last edited by 3gengames on Mon Apr 15, 2013 12:45 pm, edited 2 times in total.

lidnariq
Posts: 10425
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Need help with SRAM issue with Nestopia

Post by lidnariq » Mon Apr 15, 2013 12:18 pm

3gengames wrote:ETA: Also, if possible, just make it mapper 4. Nobody wants to take extra steps to make a repro when it could have been done completely fine on a standard MMC3 board..
Even better: the original US release was MMC1(implying SIROM). Just enable the battery bit in the header and there's no reason to use MMC3 or TKSROM.

infidelity
Posts: 426
Joined: Fri Mar 01, 2013 4:46 am

Re: Need help with SRAM issue with Nestopia

Post by infidelity » Mon Apr 15, 2013 1:44 pm

I used mmc3 so I could perform a bankswap routine, I was unable to do it within mmc1. Regardless of my player 2 functions being withn sram, sram isnt working within nestopia.

I added the wram code at the beginning of the reset vector, and it just didnt do anything.

So I dont know why this is happening.

3gengames
Formerly 65024U
Posts: 2281
Joined: Sat Mar 27, 2010 12:57 pm

Re: Need help with SRAM issue with Nestopia

Post by 3gengames » Mon Apr 15, 2013 2:13 pm

What bank swap do you need to do? MMC3 is more limited than MMC1 in bank swapping ability.

infidelity
Posts: 426
Joined: Fri Mar 01, 2013 4:46 am

Re: Need help with SRAM issue with Nestopia

Post by infidelity » Mon Apr 15, 2013 2:43 pm

The bankswap isnt the issue, my routine works fine, the game wouldnt boot in anything if I did that incorrectly.

I just dont understand why its happening within nestopia. Nintendulator is just as picky as nestopia, but nintendulator is doing fine with my hack.

3gengames
Formerly 65024U
Posts: 2281
Joined: Sat Mar 27, 2010 12:57 pm

Re: Need help with SRAM issue with Nestopia

Post by 3gengames » Mon Apr 15, 2013 2:54 pm

Well something doesn't work...those variables are in SRAM? Then something is wrong with SRAM. You DON'T enable it in the beginning. I added that to a ROM and it still doesn't work, though. I'm not exactly sure what is happening honestly. Still, never said the bank swap is the issue. I'm just saying you can do it better to eliminate the need it to use an MMC3 board, because you use no features of the MMC3 which are not offered in the MMC1.

tepples
Posts: 22322
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Need help with SRAM issue with Nestopia

Post by tepples » Mon Apr 15, 2013 2:56 pm

Don't both Tetris and Dr. Mario use 1-screen mirroring? Perhaps that's the specific MMC1 feature that requires the use of TxSROM.

User avatar
byemu
Posts: 295
Joined: Mon Sep 05, 2011 5:56 pm
Contact:

Re: Need help with SRAM issue with Nestopia

Post by byemu » Mon Apr 15, 2013 4:08 pm

to READ/write sram,you need Enable the sram first!
here is the sample code

Code: Select all

LDA #$80
STA $A001

3gengames
Formerly 65024U
Posts: 2281
Joined: Sat Mar 27, 2010 12:57 pm

Re: Need help with SRAM issue with Nestopia

Post by 3gengames » Mon Apr 15, 2013 4:29 pm

byemu wrote:to READ/write sram,you need Enable the sram first!
here is the sample code

Code: Select all

LDA #$80
STA $A001
I hacked a rom and put that exact code in it with the same results. Also fixed the header as it doesn't change the SRAM flag in the iNES header. Still broken.

infidelity
Posts: 426
Joined: Fri Mar 01, 2013 4:46 am

Re: Need help with SRAM issue with Nestopia

Post by infidelity » Mon Apr 15, 2013 4:53 pm

I havent changed the header, but I added the sram code to the beginning of my reset vector earlier today, and it didnt work. Im baffled. Btw, whete in the header do you change the battery bit?

3gengames
Formerly 65024U
Posts: 2281
Joined: Sat Mar 27, 2010 12:57 pm

Re: Need help with SRAM issue with Nestopia

Post by 3gengames » Mon Apr 15, 2013 4:56 pm

Add the code quoted to the current ROM. But just go edit with NESTopia.

User avatar
byemu
Posts: 295
Joined: Mon Sep 05, 2011 5:56 pm
Contact:

Re: Need help with SRAM issue with Nestopia

Post by byemu » Mon Apr 15, 2013 5:16 pm

infidelity wrote:I havent changed the header, but I added the sram code to the beginning of my reset vector earlier today, and it didnt work. Im baffled. Btw, whete in the header do you change the battery bit?
could you share your rom,and ican help you debug it!

lidnariq
Posts: 10425
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Need help with SRAM issue with Nestopia

Post by lidnariq » Mon Apr 15, 2013 5:18 pm

tepples wrote:Don't both Tetris and Dr. Mario use 1-screen mirroring? Perhaps that's the specific MMC1 feature that requires the use of TxSROM.
This is a wild tangent, but you can extract an MMC3 build of Tetris out of the SMB+Tetris+NWC multicart.
PRG is 32 KiB starting at file offset 0x8010; CHR is 8KiB starting at file offset 0x5C010 then 8KiB starting at file offset 0x5A010. It needs some minor fixup—e.g. the high score starts as all FFs.

Post Reply