Language…
11 users online: Cristian Cardoso, dotCoockie, DPBOX, Golden Yoshi, Green, Lsh0426, Maw, signature_steve, Sweetdude,  Telinc1, Torchkas - Guests: 258 - Bots: 410
Users: 64,795 (2,377 active)
Latest user: mathew

Save the coin counter

Hi,
I’m using the Alternate Coin Counter and the Fireball Ammo patches. Is there a way I could save the coin counter? I would want that when you leave the game and comeback, you can restart with the same amount of coins than the last time you saved the game.
Ok, I figured out that I could save the coins (and lives) with SRAM and BW-RAM Plus. But that brings me more problems.

I have some other patch that isn’t compatible with it.
I’m using the Sprite Health Bar and I soon as I mix it with SRAM or BW-RAM plus (I tried both, with and without SA-1) The power-ups are all mixed-up every time I load a game. Cape became flower, flower became small Mario with a weird color palette..
I don’t really know how to code for that SRAM plus patch so I just copied the code in the comments sections. I only need the Coins and Lives, and I tought that maybe if Mario’s Powerup weren’t saved (like in the code in the comments) it would fix the problem so I tried to remove those lines from but it only gives me errors.
How could I use those two patches together?

However, while searching for a solution I found out that the SMB2-Styled Health Bar doesn’t cause any problem with the SRAM/BW-RAM plus, BUT it’s incompatible with another patch that I need, the Replace Cape with Double Jump patch (It cause Mario to be invincible, every enemy you touch result in invincibility frames like you can get with the cape).

If someone could find a solution to one of these problems (I'm fine with either of those health bar) I would really apreciate it. I'm on that problem for 2 whole day now and I don't know what more I could do.

TLDR;
Sprite Health Bar + Save everything with SRAM plus = Glitch in powerup and color palette
SMB2 Styles Health Bar + Replace Cape with Double Jump = Mario is invincible
Well, I managed to make it work, if anybody with the same problem find this..
I used the Sprite Health Bar without SA-1, so use the SRAM Plus version to save the coins.

Code for the sram_table.asm:
Code
sram_table:	dl $7E1EA2 : dw $008D ;Default Code

                dl $7E0DBF : dw $0001 ;Mario's Coins
               
.end
		
sram_defaults:	db $00,$00,$00,$00,$00,$00,$00,$00
		db $00,$00,$00,$00,$00,$00,$00,$00
		db $00,$00,$00,$00,$00,$00,$00,$00
		db $00,$00,$00,$00,$00,$00,$00,$00
		db $00,$00,$00,$00,$00,$00,$00,$00
		db $00,$00,$00,$00,$00,$00,$00,$00
		db $00,$00,$00,$00,$00,$00,$00,$00
		db $00,$00,$00,$00,$00,$00,$00,$00
		db $00,$00,$00,$00,$00,$00,$00,$00
		db $00,$00,$00,$00,$00,$00,$00,$00
		db $00,$00,$00,$00,$00,$00,$00,$00
		db $00,$00,$00,$00,$00,$00,$00,$00
		db $00,$00,$00,$00,$00,$00,$00,$00
		db $00,$00,$00,$00,$00,$00,$00,$00
		db $00,$00,$00,$00,$00,$00,$00,$00
		db $00,$00,$00,$00,$00,$00,$00,$00
		db $00,$00,$00,$00,$00,$00,$00,$00
		db $00,$00,$00,$00,$00

                db $00


This will save the coins counter when you save the game, but because the game reset the counter before launching a game, you need to make a new patch with this code:

Code
org $009E2F		;<- this is the address we want to overwrite.
	NOP #3		; original line was "STA $0DBF", which is 3 bytes long. hence, 3 NOPs.


Go there for more details.