Trouble with level translation and wram

Discuss hardware-related topics, such as development cartridges, CopyNES, PowerPak, EPROMs, or whatever.

Moderators: B00daW, Moderators

Post Reply
jwiggams
Posts: 6
Joined: Mon Feb 20, 2017 12:44 pm

Trouble with level translation and wram

Post by jwiggams » Mon May 18, 2020 11:21 am

I'm making a simple adapter that sits between the NES console and the cartridge, and for the most part it works but not with games that use WRAM.

All signals pass through an FPGA which is connected serially to my pc, so that I can sniff around while things are running. Most games work fine, but anything with WRAM like Metroid or SMB3 either don't boot or boot with glitches and crash.

Here is how I'm handling the level shifts for the data bus:

Code: Select all

assign console_direction =  console_prgrw;
assign console_enable = console_prgce && console_prgrw;
assign cartridge_direction = console_prgrw;
assign cartridge_enable = console_prgce && console_prgrw;
On a cheap clone console I can get these games to work by assigning each _enable pin a 1'b0, but that doesn't work on an actual NES. So I'm sure it's just I'm shifting it wrong.

Anyone have any pointers?

lidnariq
Posts: 9301
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Trouble with level translation and wram

Post by lidnariq » Mon May 18, 2020 11:58 am

The NES doesn't expose A15 to the cartridge, so the cartridge has to reconstruct it from /ROMSEL and M2. And games with RAM almost always put it in memory at $6000-$7FFF - that is, the region where /ROMSEL doesn't drop after M2 goes high. So you still have to relay data between the cartridge and the console for other addresses too.

The MMC5 also puts mapper registers at addresses $2002-2006 and $5000-$5FFF, so you should basically always enable translation any time M2 is high. (It might be more complicated than that. I'm not certain)

jwiggams
Posts: 6
Joined: Mon Feb 20, 2017 12:44 pm

Re: Trouble with level translation and wram

Post by jwiggams » Mon May 18, 2020 12:27 pm

Ahh of course! I knew it was something simple.

I wasn't taking into account that "console_prgce && console_prgrw" would be a logic 1 when the console is trying to read from wram, as both of those pins would be high during reads. Makes sense that it wasn't working now.

Thanks for the help lidnariq!

Post Reply