Points of Required Attention™
Smaghetti, a new Super Mario Advance 4 editor, is currently in development! Check out the thread HERE!

Please chime in on a proposed restructuring of the ROM hacking sections.
Views: 88,275,644
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search 03-19-24 08:12 AM
Guest: Register | Login

0 users currently in ROM Hacking | 1 guest | 1 bot

Main - ROM Hacking - I'm having trouble with MMC5's 2K CHR Switching (solved) New thread | New reply


RetroRain
Posted on 02-16-15 06:34 PM (rev. 2 of 02-17-15 03:10 AM) Link | Quote | ID: 159490


Fuzz Ball
Level: 66

Posts: 827/994
EXP: 2430509
Next: 31342

Since: 09-30-07

Last post: 1897 days
Last view: 919 days
I'm having a little bit of trouble with MMC5's CHR-ROM switching. More specifically, switching 2K CHR pages.

; set chr mode to 2, to enable 2K switching
LDA #$02
STA $5101 = #$FC

; load chr page #$22, and write it to $0000-$07FF
LDA #$22
STA $5121 = #$FC

; load chr page #$2A, and write it to $0800-$0FFF
LDA #$2A
STA $5123 = #$FC



; this code right here works fine. It sets the mode to 1 (4K switching),
; and then writes chr page #$12 to $1000-$1FFF
LDA #$01
STA $5101 = #$FC
LDA #$12
STA $5127 = #$FC

The result is this:



The nesdev wiki article mentions $5130, which I have messed with. I may not be doing it right, but I'm not sure if I need it either. I have no problems doing 8K and 4K switching. But 2K and 1K seem don't seem to be working.

Any help would be greatly appreciated.

Thanks.

EDIT

Okay, apparently you can't load two 2K CHR banks on the left side of the PPU, and then switch the mode to 4K, and load the 4K bank on the right side of the PPU. I don't know why you can't, but you can't. So, I'll just deal with it.

Thanks guys.

____________________
My YouTube Channel

infidelity
Posted on 02-18-15 02:01 AM Link | Quote | ID: 159492


Fuzz Ball
Level: 66

Posts: 705/968
EXP: 2360751
Next: 101100

Since: 05-24-07

Last post: 920 days
Last view: 776 days
$5130 (for this example, you have max chr size to 1024kb) allows you to select 4 pages of chr banks to load.

$5130 ='ing 00, would be the 1st page to load chr banks 00-FF from ROM
$5130 ='ing 01, would be the 2nd page to load chr banks 00-FF from ROM
$5130 ='ing 02, would be the 3rd page to load chr banks 00-FF from ROM
$5130 ='ing 03, would be the 4th page to load chr banks 00-FF from ROM

For my mmc5 rom's, I max both the prg & chr 1mb each, so, for my roms as an example, the actual locations for my gfx are located at the following addresses.

$5130 loading 00 = $100010-$14000F (40,000 bytes)
$5130 loading 01 = $140010-$18000F (40,000 bytes)
$5130 loading 02 = $180010-$1C000F (40,000 bytes)
$5130 loading 03 = $1C0010-$20000F (40,000 bytes)

Hope that makes sense on $5130. :-)

RetroRain
Posted on 02-18-15 04:00 AM Link | Quote | ID: 159493


Fuzz Ball
Level: 66

Posts: 828/994
EXP: 2430509
Next: 31342

Since: 09-30-07

Last post: 1897 days
Last view: 919 days
Thank you infidelity for that information on $5130. I'll refer to it if I ever need it.

As I posted on romhacking.net, I figured out what the problem was. The reason why it wasn't working is because there was a conflict with the CHR modes, which was causing the CHR problems. $5130 wasn't needed at all.

For whatever reason, you can't have 2K mode enabled, load the two 2K banks on the left side of the PPU, and then set up 4K mode, and load the one 4K page in on the right side of the PPU. When I had it like that, it wasn't allowing my 2K pages.

However, I screwed up in my CHR-ROM conversion anyway, and I'm going to be restarting it. I got 95% of the backgrounds converted, but my code was not efficient. I forgot what I did with Megaman 1, using free addresses, and having the game constantly read the CHR-load routine. I'm using so much code that is completely un-necessary, and I've been alternating between 8K, 4K, and 2K modes. I've decided that with Megaman 2, and studying how it handles graphics loading, it is better to simply stick with one CHR mode; 2K.

____________________
My YouTube Channel

Main - ROM Hacking - I'm having trouble with MMC5's 2K CHR Switching (solved) New thread | New reply

Acmlmboard 2.1+4δ (2023-01-15)
© 2005-2023 Acmlm, blackhole89, Xkeeper et al.

Page rendered in 0.029 seconds. (340KB of memory used)
MySQL - queries: 47, rows: 70/70, time: 0.024 seconds.