Page 1 of 2

Tetris hack needs help with SRAM issue with Nestopia

Posted: Mon Apr 15, 2013 9:53 am
by infidelity
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

Re: Need help with SRAM issue with Nestopia

Posted: Mon Apr 15, 2013 11:51 am
by SkinnyV
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.

Re: Need help with SRAM issue with Nestopia

Posted: Mon Apr 15, 2013 11:53 am
by 3gengames
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.

Re: Need help with SRAM issue with Nestopia

Posted: Mon Apr 15, 2013 12:18 pm
by lidnariq
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.

Re: Need help with SRAM issue with Nestopia

Posted: Mon Apr 15, 2013 1:44 pm
by infidelity
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.

Re: Need help with SRAM issue with Nestopia

Posted: Mon Apr 15, 2013 2:13 pm
by 3gengames
What bank swap do you need to do? MMC3 is more limited than MMC1 in bank swapping ability.

Re: Need help with SRAM issue with Nestopia

Posted: Mon Apr 15, 2013 2:43 pm
by infidelity
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.

Re: Need help with SRAM issue with Nestopia

Posted: Mon Apr 15, 2013 2:54 pm
by 3gengames
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.

Re: Need help with SRAM issue with Nestopia

Posted: Mon Apr 15, 2013 2:56 pm
by tepples
Don't both Tetris and Dr. Mario use 1-screen mirroring? Perhaps that's the specific MMC1 feature that requires the use of TxSROM.

Re: Need help with SRAM issue with Nestopia

Posted: Mon Apr 15, 2013 4:08 pm
by byemu
to READ/write sram,you need Enable the sram first!
here is the sample code

Code: Select all

LDA #$80
STA $A001

Re: Need help with SRAM issue with Nestopia

Posted: Mon Apr 15, 2013 4:29 pm
by 3gengames
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.

Re: Need help with SRAM issue with Nestopia

Posted: Mon Apr 15, 2013 4:53 pm
by infidelity
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?

Re: Need help with SRAM issue with Nestopia

Posted: Mon Apr 15, 2013 4:56 pm
by 3gengames
Add the code quoted to the current ROM. But just go edit with NESTopia.

Re: Need help with SRAM issue with Nestopia

Posted: Mon Apr 15, 2013 5:16 pm
by byemu
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!

Re: Need help with SRAM issue with Nestopia

Posted: Mon Apr 15, 2013 5:18 pm
by lidnariq
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.