Newb CHR RAM issue

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Post Reply
robroymcc
Posts: 4
Joined: Sun Jun 11, 2017 8:39 am

Newb CHR RAM issue

Post by robroymcc » Sun Jun 11, 2017 9:01 am

Hello folks. I have been working with a TNROM test cart and am trying to put a simple program on it that uses CHR RAM. Everything seems to be set up correctly and it works perfectly fine in FCEUX. However, when I write it to the test cart, the tile graphics are all jumbled and wrong, but everything else works as expected (bank switching, nametables, I/O, etc). Also, I have tested the cart by writing a TNROM game to it and the board works fine.

I'm forced to assume I am doing something wrong but have failed to discover what that could be. Possibly something special for TNROM?

Before going into more detail, I was hoping that some of you out there might have run into a similar issue. It appears like the tiles are being written to (or read from) the wrong addresses. It's driving me nuts.

Anyway, I have been digging through posts and testing different things for days and everything I have done seems to be correct. It's probably something obvious. I'm a newb at this, after all.

Any advice out there?

User avatar
Banshaku
Posts: 2328
Joined: Tue Jun 24, 2008 8:38 pm
Location: Fukuoka, Japan
Contact:

Re: Newb CHR RAM issue

Post by Banshaku » Sun Jun 11, 2017 10:17 am

MMC3 chr-ram boards needs the chr-ram bank to be set since the value at power-on is unknown.

I had the same issue in hardware with my first mmc3 char-ram cart. The emulators sets the bank to 0 by default but this is not the case on the real thing.

robroymcc
Posts: 4
Joined: Sun Jun 11, 2017 8:39 am

Re: Newb CHR RAM issue

Post by robroymcc » Sun Jun 11, 2017 10:19 am

Banshaku wrote:MMC3 chr-ram boards needs the chr-ram bank to be set since the value at power-on is unknown.

I had the same issue in hardware with my first mmc3 char-ram cart. The emulators sets the bank to 0 by default but this is not the case on the real thing.
You rock! I'll give it a try.

Thanks!

robroymcc
Posts: 4
Joined: Sun Jun 11, 2017 8:39 am

Re: Newb CHR RAM issue

Post by robroymcc » Sun Jun 11, 2017 10:56 am

Banshaku wrote:MMC3 chr-ram boards needs the chr-ram bank to be set since the value at power-on is unknown.

I had the same issue in hardware with my first mmc3 char-ram cart. The emulators sets the bank to 0 by default but this is not the case on the real thing.
Well, I thought that this would be enough for me to look up how to do this myself, but it remains unclear.

How exactly do I set the chr ram bank to 0? It's not clear to me what register would have control over that.

AWJ
Posts: 433
Joined: Mon Nov 10, 2008 3:09 pm

Re: Newb CHR RAM issue

Post by AWJ » Sun Jun 11, 2017 11:06 am

robroymcc wrote:
Banshaku wrote:MMC3 chr-ram boards needs the chr-ram bank to be set since the value at power-on is unknown.

I had the same issue in hardware with my first mmc3 char-ram cart. The emulators sets the bank to 0 by default but this is not the case on the real thing.
Well, I thought that this would be enough for me to look up how to do this myself, but it remains unclear.

How exactly do I set the chr ram bank to 0? It's not clear to me what register would have control over that.
The same registers as if you were using MMC3 with CHR ROM. Either set the two 2KB CHR banks to 0 and 2 and the four 1K banks to 4, 5, 6, 7, or set the 1K banks to 0, 1, 2 and 3 and the 2K banks to 4 and 6. Basically, you need to set up the banks so that none of them are mirrors or overlapping and you're actually using the entire 8KB of CHR RAM.

tepples
Posts: 21750
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Newb CHR RAM issue

Post by tepples » Sun Jun 11, 2017 1:36 pm

I posted MMC3 CHR RAM window init code in another topic.

robroymcc
Posts: 4
Joined: Sun Jun 11, 2017 8:39 am

Re: Newb CHR RAM issue

Post by robroymcc » Sun Jun 11, 2017 2:08 pm

AWJ wrote:
robroymcc wrote:
Banshaku wrote:MMC3 chr-ram boards needs the chr-ram bank to be set since the value at power-on is unknown.

I had the same issue in hardware with my first mmc3 char-ram cart. The emulators sets the bank to 0 by default but this is not the case on the real thing.
Well, I thought that this would be enough for me to look up how to do this myself, but it remains unclear.

How exactly do I set the chr ram bank to 0? It's not clear to me what register would have control over that.
The same registers as if you were using MMC3 with CHR ROM. Either set the two 2KB CHR banks to 0 and 2 and the four 1K banks to 4, 5, 6, 7, or set the 1K banks to 0, 1, 2 and 3 and the 2K banks to 4 and 6. Basically, you need to set up the banks so that none of them are mirrors or overlapping and you're actually using the entire 8KB of CHR RAM.
You folks kick butt. That did the trick. Thanks a lot.

User avatar
Banshaku
Posts: 2328
Joined: Tue Jun 24, 2008 8:38 pm
Location: Fukuoka, Japan
Contact:

Re: Newb CHR RAM issue

Post by Banshaku » Mon Jun 12, 2017 9:22 am

Good to hear that you made it work!

Post Reply