This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

MMC1 CHR selection

MMC1 CHR selection
by on (#52392)
I've been playing with bank switching with MMC1. I have two 8k CHR banks in my ROM. I set the control register to 8k mode. However, the numbering system appears to be the same as 4k mode, because I only successfully loaded my second CHR bank when I selected chr bank "2". I would have expected "1." The PRG bank selection register appears to be numbered 0, 1 for my two PRG banks; the chr bank selection appears to be numbered 0, 2 for my two CHR banks. Any idea why this is? Perhaps I am not serializing my writes correctly (reset + 5 writes is what I am doing to each reg).

by on (#52394)
MMC1 CHR banks are 4 KiB in size. Which CHR switching mode (8 KiB or 4 KiB) are you using, so that I can explain in more detail?

You usually do not want to reset the MMC1 before each sequence of 5 writes, except in the reset handler. Resetting the MMC1 has the side effect of setting the PRG switching mode to 16 KiB, upper bank fixed.

by on (#52396)
This is a normal behavior of the MMC1 (and most other mappers exept MMC5), the banks (be them PRG or CHR) are "numbered" by the smaller available size, and if a larger size is used, lower bits are ignored.

by on (#52403)
Thanks for the replies.
I am using 8k mode. I think I understand now. The numbering system is the same with either mode, but with 8k mode, you only need to set one CHR register and it will load bank n into vram 0000, and bank n+1 into vram 1000?

by on (#52414)
Almost. The 8 KiB mode switches bank (n & $1E) into $0000 and bank (n | $01) into $1000. This means you can't use it to, say, switch bank 1 into $0000 and 2 into $1000; you need 4 KiB mode for that.

by on (#52427)
Makes sense. Using 8k mode is exactly what I need for this particular project. I guess I would want to change to 4kb if I wanted to easily animate some background graphics or something and leave the sprites alone. Maybe I will use 4kb anyway just so that will remain an option.

by on (#52431)
A good use for the 4K mode is to keep the sprites of the player, items, etc always mapped while you switch the background tiles depending on the level being played.

Of course that there are sprites specific to certain levels, and if you can't fit all of them in the same 4KB, you'll need to either have few different 4KB sprite banks (as long as there are less of them than background banks it's still a gain) or include the level-specific sprites in the background side and use 8x16 sprites.

by on (#52441)
As far I know, the only point of using 8k mode is if you're worried about switching speed, or if you use CHR-RAM and don't need any banswitching. The limit is 128kb CHR no matter if you use 8k more or 4k mode.

by on (#52455)
Bregalad wrote:
As far I know, the only point of using 8k mode is if you're worried about switching speed, or if you use CHR-RAM and don't need any banswitching.

Or if you're using CHR RAM and the board's CHR bankswitching lines have been repurposed for bankswitching PRG ROM and/or PRG RAM (SUROM, SOROM, SXROM).