Scanline counters on BNROM

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

Moderator: Moderators

Post Reply
User avatar
pubby
Posts: 583
Joined: Thu Mar 31, 2016 11:15 am

Scanline counters on BNROM

Post by pubby »

I made a programming language for the NES which generates ROMs in 32K banks. Several people have requested that this language supports IRQ scanline counters, but the problem is mappers like MMC3 have complicated banking schemes which cannot be handled by my language.

I'm wondering how feasible it is to take a mapper like BNROM and tack on an IRQ scanline counter. I assume it requires a FPGA, but perhaps it wouldn't be too much work because people have already cloned MMC3 before?

P.S. I'd also be interested in hearing opinions on what makes a scanline counter good. Does MMC3 even do it "right"?
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Scanline counters on BNROM

Post by tokumaru »

There are no technical reasons preventing an scanline counter from being added to BNROM, but getting a new mapper out there is always a challenge. First you have to convince people to help you with adding support for it in emulators, and with the crazy amount of forks and ports and pirate devices, achieving widespread support is never easy. Then you need to find someone who will design and manufacture cartridges for you and for the users of your programming language, and switching suppliers later on if needed might not be so trivial. It would be much better if you could make this work with a common mapper instead.

As for the quality of MMC3's scanline counter, I guess it's capable enough for most uses, and is what the vast majority of the original NES library used. It actually counts scanlines, instead of CPU cycles, which makes it simpler to use across consoles with different scanline timing (NTSC vs. PAL). The only serious problem with the MMC3's scanline counter IMO is that it breaks if you have 8x16-pixel sprites use tiles from the background pattern table. The fact that it has IRQs fire after the start of hblank isn't great either, because there's not enough time to pull off any raster effects in the amount of hblank that's left, so you generally have to wait nearly a whole scanline before the next hblank in order to do your effects.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Scanline counters on BNROM

Post by lidnariq »

Someone made a board for ... I think na_th_an ... that is GNROM plus a scanline counter.

If I remember, it's MMC3 minus the registers at 8000/8001, and those two have been replaced with direct PRG and CHR banks.

But for versatility, I'd either use MMC5 (three NT fetches in a row mark a new scanline) or VRC4 (CPU timer with correct prescaler) instead.
User avatar
aquasnake
Posts: 515
Joined: Fri Sep 13, 2019 11:22 pm

Re: Scanline counters on BNROM

Post by aquasnake »

mapper #208 with no databus read check?
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Scanline counters on BNROM

Post by tepples »

Based on discussions we've had on Discord, you could make a subset of MMC5 that's just the timer and PRG mode 0 (32K).

These registers are relevant to the functionality you want:
$5117=bb (PRG bank number shifted left 2)
$5203=yy (scanline on which to assert IRQ)
$5204=e0 ($00 to disable or $80 to enable; read to acknowledge)
To save I/Os, it could cheat by decoding $5xx3, $5xx4, and $5xx7 using only A14-12 and A2-1.

When running on MMC5 in an emulator, a game would also need to write these:
$5200=$00 (disable vertical split)
$5100=$00 (32K PRG ROM mode)
$5101=$00 (8K CHR ROM mode)
$5103=$03 (Disable ExRAM)
$5105=$44 (horizontal arrangement) or $50 (vertical arrangement)
User avatar
pubby
Posts: 583
Joined: Thu Mar 31, 2016 11:15 am

Re: Scanline counters on BNROM

Post by pubby »

Some helpful ideas in this thread :beer:
aquasnake wrote: Thu Mar 09, 2023 8:11 pm mapper #208 with no databus read check?
That's interesting I've never heard about this mapper before. Is mapper 189 the same thing without the protection scheme?
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Scanline counters on BNROM

Post by lidnariq »

Mapper 189 might exclusively refer to Namco 108 clones and not MMC3 clones, I'm not certain.
NewRisingSun
Posts: 1510
Joined: Thu May 19, 2005 11:30 am

Re: Scanline counters on BNROM

Post by NewRisingSun »

Mapper 189 is used by a Street Fighter II backport that uses the MMC3's scanline IRQ.
Post Reply