Romhacking.net

Romhacking => ROM Hacking Discussion => Topic started by: Hamtaro126 on December 25, 2011, 01:27:41 am

Title: BankSwitching Values - Number Conversions
Post by: Hamtaro126 on December 25, 2011, 01:27:41 am
I am still working on a couple of ROM Hacks, And there is a question about banking:

Is is formatted like this?:

08k - 0,2,4,6,8,A,C,E
16k - 0,1,2,3,4,5,6,7
32k - 0,4,8,C,10,14,18,1C

Is it correct?

The bank sizes has to be documented because Disch's Mapper docs does not explain the bank sizes and limits!
Title: Re: BankSwitching Values - Number Conversions
Post by: snarfblam on December 25, 2011, 10:15:13 am
I don't think I understand the question. Is what formatted like that? What are the values in the table supposed to be?

Also, Disch's mapper docs seem more suitable for writing an emu or bank-swapping ASM, or anything else where you need to focus in the little details. The bank sizes are implied by the address maps in the docs. The NesDev wiki's pages on mappers tend to be easier to understand IMO.
Title: Re: BankSwitching Values - Number Conversions
Post by: Hamtaro126 on December 25, 2011, 11:38:13 am
The thing is some people do not really know how to do 32k because it's not that known, But I think it is actually equal to 4 8k banks?

I could still use 16k or 8k, though. but 32k is another banking mystery!
Title: Re: BankSwitching Values - Number Conversions
Post by: KingMike on December 25, 2011, 12:05:31 pm
No, typically banks are numbered sequentially (0,1,2,3,4,etc.) regardless of bank size.

There are a couple odd ones (mostly pirate multi-cart mappers), but normally they are in order.
And there's some that have a flaw known as "bus conflicts". That means the value written to the mapper must be the same as the value store at the ROM address being written to to activate the bank swap, or else the value written to the mapper will be a corrupted value.
Typically, those games will store a table with all the bank numbers in a row like
00, 01, 02, 03, etc.
at some ROM address (say $C000) and then do something like
lda $BankValue
tax
sta $C000,x
Title: Re: BankSwitching Values - Number Conversions
Post by: Hamtaro126 on December 25, 2011, 02:55:26 pm
No, typically banks are numbered sequentially (0,1,2,3,4,etc.) regardless of bank size.

There are a couple odd ones (mostly pirate multi-cart mappers), but normally they are in order.
And there's some that have a flaw known as "bus conflicts". That means the value written to the mapper must be the same as the value store at the ROM address being written to to activate the bank swap, or else the value written to the mapper will be a corrupted value.
Typically, those games will store a table with all the bank numbers in a row like
00, 01, 02, 03, etc.
at some ROM address (say $C000) and then do something like
lda $BankValue
tax
sta $C000,x

Ok, Because I was hacking Hebereke earlier, and it did not seem to accept it if I did a lot of proper hacks to get the 16k switching, due to stack!

And the unmodified Hebereke and SMB2 roms uses 2 8k Banks to use a emulated 16k bank.

EDIT: I'm using VRC6 for this.
Title: Re: BankSwitching Values - Number Conversions
Post by: KingMike on December 25, 2011, 04:33:36 pm
Ok, Because I was hacking Hebereke earlier, and it did not seem to accept it if I did a lot of proper hacks to get the 16k switching, due to stack!

And the unmodified Hebereke and SMB2 roms uses 2 8k Banks to use a emulated 16k bank.

EDIT: I'm using VRC6 for this.

Both of them are unusual.
It looks like FME-7 requires two writes, one to $8000 to specify which CPU address to swap, and then the bank value needs to be written to $A000.
VRC6 looks irregular in that it can swap a 16KB bank at $8000 and an 8KB bank at $C000. I haven't looked at any of the games so I don't know if that means writes to $8000 should be counted in 16KB increments and $C000 should in 8 or what.
If I were, I'd just trace the original code then watch as it bankswaps, then look for the hex codes of the code executed after the swap in a hex editor.
Title: Re: BankSwitching Values - Number Conversions
Post by: Hamtaro126 on December 25, 2011, 11:10:28 pm
Both of them are unusual.
It looks like FME-7 requires two writes, one to $8000 to specify which CPU address to swap, and then the bank value needs to be written to $A000.
VRC6 looks irregular in that it can swap a 16KB bank at $8000 and an 8KB bank at $C000. I haven't looked at any of the games so I don't know if that means writes to $8000 should be counted in 16KB increments and $C000 should in 8 or what.
If I were, I'd just trace the original code then watch as it bankswaps, then look for the hex codes of the code executed after the swap in a hex editor.

I know about the switching stuff in Hebereke already, Just that banks in Hebereke mostly require some increment/decrement stack routines, and if modified, they will not work at all or be glitched...

Increment Bank via Stack: 0x01FC53
Decrement Bank via Stack: 0x01FC6B