MetalSlime wrote:
And one of the issues that I wanted advice on was CHR-ROM vs. CHR-RAM
This seems to be an issue that usually comes up with beginners who have learned about how the NES works and maybe written some programs for it. They eventually realize that a game that they want to make won't fit into the small memory of a mapperless (NROM) cartridge. So they first wonder what type of CHR memory to use, as this will greatly affect how the game is programmed and what is possible with the program. This topic will address the benefits of using each type of memory so that those just starting to make more complex NES games will have something to look at to decide which they want to use.
BANKSWITCHED CHR-ROM:
-Faster and easier to use. No need to load tiles into CHR memory, they are all there for you in ROM and if some tiles need to be switched out all one needs to do is write a few bits to the mapper. The small amount of time needed to switch banks frees up VBlank cycles which would otherwise be spent writing tiles to CHR-RAM.
Possible advanced effects:
-Storing non-graphics data in CHR-ROM. Can help save PRG-ROM.
General method: The region of the CHR-ROM with the non-graphics data is read during VBlank or while PPU rendering is disabled. It can then be stored or decompressed into RAM.
-Requirements: Rendering must be off during reads.
Examples: Super Mario Bros. (stores name table of title in CHR-ROM), some other NROM/CNROM games that I forgot
-Switching between which tiles are displayed in the HUD and the game play area by using a raster interrupt. Allows more tiles to be displayed on screen at one time.
General method: A bank full of text characters and other HUD-related tiles is switched to while the PPU is drawing the HUD and a bank full of game world-related tiles is switched to while the PPU is drawing the game play area.
Requirements: HUD must be horizontally oriented, one raster interrupt between HUD and game play screen.
Examples: ... crap I forgot, someone help me out here
-Parallax scrolling without raster interrupts. Parallax scrolling is where things far away from the screen move slower than things closer to the screen. Using the CHR memory to do parallax scrolling frees up cycles for the processor to do other things and makes vertical and "window" parallax possible on the NES. If no raster interrupts are used it also makes it easier to play DMC samples in your game.
General method: Banks containing parallax pattern are switched from bank to bank containing pattern in different scrolling positions to create a scrolling effect independent of the one made using the NES's scroll registers.
Requirements: Pattern being parallax scrolled should repeat often - most games use 1- or 2-tile-wide patterns for this effect. Small bank sizes are desirable as they make it possible to use less memory for this effect.
Examples: Batman: Return of the Joker (horizontal), Crisis Force (vertical), Metal Storm (window), Sword Master (window along with raster interrupt-based parallax)
-Switching to banks of "blank tiles" during first and last 8 or 16 scanlines while using 4-way scrolling with vertical mirroring. Using 4-way scrolling without 4 nametables (ie in one-screen mode or with vertical or horizontal mirroring) creates glitches on the edges of the screen whenever the screen is scrolled in a direction that is mirrored. Horizontally mirrored games with 4-way scrolling, like Super Mario Bros. 3, have glitches on the horizontal edges. Vertically mirrored games with 4-way scrolling, like Super C, have them on the vertical edges. If one is making a game with 4-way scrolling and vertical mirroring, one way to remove the glitches is to use the following method, which doesn't need the PPU to ever be disabled.
General method: During VBlank, all of the banks have been switched to the "blank tile" bank (bank filled with tiles whose bits are all set to zero) so that when the visible screen starts being drawn, only the blank tiles are fetched by the PPU. This makes the vertical mirroring with vertical scroll glitches impossible to see. Once 8/16 scanlines have been drawn, a raster interrupt triggers the 2A03 to switch the banks back to their normal values. Once there are only 8/16 scanlines before the screen is done being drawn, another interrupt triggers the 2A03 to switch the banks back to the blank tile bank, and the cycle begins anew.
Requirements: No HUD made of background tiles, 2 raster interrupts (one for top and one for bottom) or at least very carefully timed code.
Examples: Jurassic Park
8k CHR-RAM:
-Much more flexible. Instead of having to switch out big banks of 1k or more, CHR-RAM allows you to control every bit of every tile.
-Can compress tiles to save memory. Tokumaru wrote a tile compressor that compresses tile data down to about 70% of the original size (link and link). So if you're using 128k of uncompressed tile data in a 256k UOROM you could compress the tile data down to around 90k and have 38k more PRG-ROM for whatever.
-If you're making physical cartridges, you only need to program one chip.
Possible advanced effects:
-Parallax scrolling without raster interrupts. Parallax scrolling is where things far away from the screen move slower than things closer to the screen. Using the CHR memory to do parallax scrolling frees up cycles for the processor to do other things and makes vertical and "window" parallax possible on the NES. If no raster interrupts are used it also makes it easier to play DMC samples in your game.
General method: Tiles containing parallax pattern are changed by 2A03 to create a scrolling effect independent of the one made using the NES's scroll registers.
Requirements: Pattern being parallax scrolled should repeat often - most games use 1- or 2-tile-wide patterns for this effect. Lots of VBlank time is desirable as it makes it easier to update more tiles. Some games increase the VBlank for this purpose by disabling rendering at the top and bottom of the screen.
Examples: Battletoads, Bee-52
-Using 2A03 to render some of the screen. This makes drawing programs and 3D vector/polygon games possible on the NES.
-General method: Update tiles during VBlank with new screen.
-Requirements: Lots of VBlank time for update - disabling PPU rendering at top and bottom of screen to extend VBlank is desirable, especially for NTSC games. Banked CHR-RAM is also desirable as it allows double buffering.
-Examples: Color a Dinosaur, Videomation (drawing), Elite, Tank Demo (vector 3D), some projects by NesDev community
BANKSWITCHED CHR-RAM:
-Bankswitched CHR-RAM allows one to do most (if not all) of the techniques possible with bankswitched CHR-ROM and 8k CHR-RAM. However, there were few mappers produced during the NES's lifespan that had bankswitched CHR-RAM. The only one I can think of is CPROM, and that has only 32k of PRG-ROM. So most mappers using bankswitched CHR-RAM are custom-made by homebrewers. Examples: Garage Carts 1 and 2 (I think) and Glider.