Just trying to get the basics straight...

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
godslabrat
Posts: 3
Joined: Tue Apr 24, 2007 4:26 pm
Location: Oklahoma City

Just trying to get the basics straight...

Post by godslabrat »

Okay, I'm doing my homework here. Do I have the following correct?

1- An NES game consists of a PRG and a CHR file. The PRG contains the game code, while the CHR contains the tiles used in the game's sprites.

2- A physical NES game has three chips on the PCB: the PRG, the CHR, and the CIC.

3- Not all games have a seperate CHR section. Zelda is an example.

Okay, so I think I have all that correct. If so, it should be possible to make a basic graphic hack of a given game just by changing only the CHR chip, right?

Now, on the other hand, for those games that don't have a seperate CHR section, how do the physical carts still have three chips?

(Trying not to be TOO newbieish!)
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Re: Just trying to get the basics straight...

Post by Disch »

godslabrat wrote: 1- An NES game consists of a PRG and a CHR file. The PRG contains the game code, while the CHR contains the tiles used in the game's sprites.
Short answer: yes

Long answer: CHR is connected to the PPU, PRG is connected to the CPU. This means that the only real difference between the two is that PRG is visible via CPU addressing space (the normal $0000-FFFF address range), and CHR is visible via PPU addressing space (aka "VRAM" even though it's not always RAM -- the CPU can still access CHR via register $2007, but there is no direct access)

Note that the above is the only real difference between PRG and CHR. CHR is sometimes used for things other than character graphics. Some games (which were short on PRG space), stored game data there (SMB1's title screen, for example). Other games used CHR-ROM for additional Nametables.
2- A physical NES game has three chips on the PCB: the PRG, the CHR, and the CIC.
Basically...yeah... and an MMC (mapper) if present. But there's no real rule. Some games have multiple PRG chips. Many others have an additional RAM chip and battery for SRAM. And others just have RAM without a battery for extra work space. And even some have a PRG chip, RAM chip, CHR-ROM chip, CHR-RAM chip, CIC, and the mapper.
3- Not all games have a seperate CHR section. Zelda is an example.
They still have CHR -- they just have CHR-RAM which is not present in a ROM file (however would still exist as a chip on the cartridge).

Okay, so I think I have all that correct.
Pretty much yeah.
If so, it should be possible to make a basic graphic hack of a given game just by changing only the CHR chip, right?
Well it wouldn't look very good... but yeah.
Now, on the other hand, for those games that don't have a seperate CHR section, how do the physical carts still have three chips?
CHR RAM still needs to exist on the cartridge since there is no CHR RAM inside the actual NES apart from the 2k for nametables (which I guess still technically qualifies as CHR, since it's connected to the PPU bus).
Last edited by Disch on Wed May 16, 2007 6:09 pm, edited 1 time in total.
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Just trying to get the basics straight...

Post by tokumaru »

godslabrat wrote:1- An NES game consists of a PRG and a CHR file. The PRG contains the game code, while the CHR contains the tiles used in the game's sprites.
If the original game uses a CHR-ROM board, yes.
2- A physical NES game has three chips on the PCB: the PRG, the CHR, and the CIC.
Correct. EDIT: But as Disch said, there could be more. Or less... a while ago there was a discussion if it would be possible to wire things up in a way that 1KB of the internal 2KB of RAM would be used for pattern data, which would result in a cart with no CHR chip at all.
3- Not all games have a seperate CHR section. Zelda is an example.
Read below...
Okay, so I think I have all that correct. If so, it should be possible to make a basic graphic hack of a given game just by changing only the CHR chip, right?
By doing this you can only replace patterns. It will not be possible to change the colors of the characters, or the arrangement of the tiles in any way.
Now, on the other hand, for those games that don't have a seperate CHR section, how do the physical carts still have three chips?
Because carts always need a CHR chip, but sometimes it's a RAM chip and sometimes it's a ROM chip. CHR-ROM games are manufactured with a ROM chip containing all the tiles the game is possibly going to need, while CHR-RAM games are manufactured with an empty RAM chip in place of that, and it's a task for the game program (contained in the PRG ROM) to fill that memory with tiles as the game runs.

So, when backing up CHR-RAM games into ROM files, you only need the PRG ROM, because it contains the program and the data necessary to fill the (emulated) CHR-RAM chip with the tiles. Games with CHR-ROM must have the CHR data backed-up separately, and appended to the PRG ROM.
Post Reply