im getting mad by this mmc3 thing. I understand the docs, the behavor, etc, but games glitches... and blargg's test throw me errors.
Can somebody tell me how a modern nes emulator handles mmc3/IRQ/A12? cos i have been doing something tricky when chr-rom is readed i check if the addr has A12 ON and i clock the IRQ counter when chenges from 0->1, i know.. i know it must be at last 9 cycles "off" to detect a chenge i mean clock the counter, but all i wanna do is a modular soft.. i mean keeping out mmc3 core from the ppu emu core.
Thanks in advance.
In my emu, mappers which have an IRQ counter typically have their own timestamp and run like a 4th system (CPU, PPU, APU, and mapper all run independently)
Since my timestamp system is based on the PPU frame, the current scanline number and cycle can be easily figured from the timestamp and vice versa -- for example, on NTSC, timestamp 35805 would be the end of VBlank -- the start of the pre-render scanline (21 * 341 * 5 = 35805 --- 21 because I start my frame with that idle scanline, and *5 because 1 PPU cycle is 5 "master" cycles in my system).
Because of this, when I "catch up" my mapper code, I can figure which scanlines and cycles the MMC3 has to run though -- and thusly, how many rising edges have occured in that time. The exact calculation gets pretty hairy, since I have to check for that ~13 or so cycle delay between rising edges to actually clock the IRQ counter, but that's more or less my system.
My MMC3 does sort of need to consult the PPU in a few ways. Firstly, it needs to know if the PPU is on or not ($2001), as well as whether 8x16 sprites are enabled, and it also needs to know which Pattern table the BG and CHR are using ($2000). In addition it needs to be able to quickly get a list of all the sprites which will be fetched on any given scanline, in the order they're fetched -- so that in the case of 8x16 sprites, I can see which pattern table each sprite is being fetched from. Because in the case of sprites fetching from alternating pattern tables, it's possible for the IRQ counter to clock more than once in a scanline.
IRQ prediction uses the same routine as my "catch up" function with a few modifications. I actually have both my Catch Up and IRQ Predict routines call a "Calculate" function which will simulate the MMC3 running to a given timestamp, or until a given number of A12 rises have occurred, and it returns the number of A12 rises that occured, as well as the timestamp which the final one occured (which will be used for IRQ prediction).
I'll upload my horribly messy code later tonight if you'd like, but right now I gotta run! Gonna be late for work!!!!
Could you paste a link to nesdev wiki "mmc3 irq thing"?
Fx3 wrote:
Could you paste a link to nesdev wiki "mmc3 irq thing"?
Is it that hard to browse to the wiki and find it yourself?
http://nesdevwiki.ath.cx/index.php/Nintendo_MMC3
Quietust wrote:
Is it that hard to browse to the wiki
It is if ath.cx or nesdevwiki.ath.cx was down at the last time someone tried to check the wiki.
Well if the site was down what good would a link do?
It might have been down when Anes checked it but back up by the time Q posted the link. It still seems down for me in the minute I post this.
Well regardless... if the site is down, the link is useless, and if the site is up, he wouldn't have any trouble browsing the wiki and finding the link himself (since it's right there easy to see on the front page), which is what I gathered Q's point to be.
Disch wrote:
and if the site is up, he wouldn't have any trouble browsing the wiki and finding the link himself
And my point was that if the site had just come back up in the last couple days, he would not have thought to check the wiki, thinking that it was still down.
tepples wrote:
he would not have thought to check the wiki, thinking that it was still down.
Of course he thought of it.... he
specifically asked for a link to a page
on the wiki:
Fx3 wrote:
Could you paste a link to nesdev wiki "mmc3 irq thing"?
He knew the desired page was on the wiki. So what would a link tell him that he couldn't get on his own by just going to the wiki? Nothing.
Even if he thought the page was down -- then he would know the link someone gave him would be down too -- so why ask for it?
You're flaming me because of a single link request? You forgot to mention "Google" to blow me out.
I'm sorry.
Heh. Sorry... I wasn't trying to flame you. I actually was sort of just challenging tepples because he likes to play devil's advocate a lot. So I thought I'd fight fire with fire. Immature, I know, but it was kind of fun.