Pirate Kid Dracula reverse engineering

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

Moderators: B00daW, Moderators

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

Re: Pirate Kid Dracula reverse engineering

Post by lidnariq » Tue Jan 03, 2017 8:48 pm

It looks like Nestopia, also, only supports M2- and PPUA12- based IRQs. I have no idea if any existing emulator can support this mapper hack authentically.

User avatar
Fisher
Posts: 1102
Joined: Sat Jul 04, 2015 9:58 am
Location: -29.794229 -55.795374

Re: Pirate Kid Dracula reverse engineering

Post by Fisher » Wed Jan 04, 2017 5:36 pm

Hey, looks like it's emulation is troublesome!!

Just a small epilogue... when I bought it, the vendor sold me cheaper because it was "defective":
KidDrac defect
KidDrac defect
I took the risk and bought it anyway, since it was playable at least.
I tested it in a couple of clones and this supposed deffect never showd up.
Looks like the defect was on his console, who knows...

zxbdragon
Posts: 488
Joined: Mon Dec 12, 2011 8:15 pm

Re: Pirate Kid Dracula reverse engineering

Post by zxbdragon » Sun Jan 08, 2017 1:17 am

Still can't working.

zxbdragon
Posts: 488
Joined: Mon Dec 12, 2011 8:15 pm

Re: Pirate Kid Dracula reverse engineering

Post by zxbdragon » Mon Jan 09, 2017 7:40 pm

joe,can you working fine?

User avatar
Punch
Posts: 362
Joined: Sat Feb 16, 2013 11:52 am

Re: Pirate Kid Dracula reverse engineering

Post by Punch » Thu Jan 12, 2017 1:19 pm

Fisher wrote: So it was kind of "Metal Gear" stealth action to hide myself and try to do at least part of the job.
I think that it's more of a Splinter Cell scenario in your case, Fisher.


sorry
This is a block of text that can be added to posts you make. There is a 255 character limit.

Joe
Posts: 437
Joined: Mon Apr 01, 2013 11:17 pm

Re: Pirate Kid Dracula reverse engineering

Post by Joe » Thu Jan 12, 2017 2:07 pm

zxbdragon wrote:joe,can you working fine?
Is there an emulator that can use PPU A13 to generate IRQs? (MMC3 uses PPU A12 to generate IRQs.)

Otherwise, you can use a hack to generate one IRQ for every two scanlines (count += 43 on each scanline), but timing won't be correct.

User avatar
Fisher
Posts: 1102
Joined: Sat Jul 04, 2015 9:58 am
Location: -29.794229 -55.795374

Re: Pirate Kid Dracula reverse engineering

Post by Fisher » Fri Jan 13, 2017 2:49 am

I think that it's more of a Splinter Cell scenario in your case, Fisher.
Oh yeah! :lol:
People keep saying I should play that series of games, and I always keep forgotting. :oops:

Code: Select all

sorry
Don't feel sorry!
It was a joke, intended to someone else to laugh and joke too, like you did. :lol:

Joe and Zxbdragon, I think proper support for this pirate mapper would need a rewrite of the emulator's core. Would it?
For a user's perspective this would not do much difference, since the original game is already playable.
But the on the developer's side, it's the challenge of doing it properly that makes all the difference.
If I'm understanding properly what I've been reading, this is the fuel that keeps emulation community as a whole active.
So I say: Power to you guys! Don't give up.
As a old boss I had said: The impossible is only a little bit protracted. (hope I have translated it right)

Joe
Posts: 437
Joined: Mon Apr 01, 2013 11:17 pm

Re: Pirate Kid Dracula reverse engineering

Post by Joe » Fri Jan 13, 2017 3:47 am

Fisher wrote:Joe and Zxbdragon, I think proper support for this pirate mapper would need a rewrite of the emulator's core. Would it?
That depends on the emulator. I've only looked at FCEUX, and it doesn't provide any way for the mapper to track PPU A13. The easy hack would be to just trigger the IRQ every other scanline, but timing would be wrong. It may be possible to do it better using a combination of scanline and CPU-cycle counters in FCEUX, but that's more work than I'm willing to put into this (and probably still wouldn't be accurate).

If there's an emulator core that has some way for the mapper to track the PPU A13 line, then I'll give it a shot.

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

Re: Pirate Kid Dracula reverse engineering

Post by lidnariq » Fri Jan 13, 2017 12:12 pm

Nestopia's code base also seems to have only implemented support for PPU A12 and M2-based IRQs, even though the OO goo makes it look like it should be more useful... ("What do you mean no one ever implemented Nst::Core::Timer::A13 ?")

I strongly suspect the answer is "no one has ever written support for that in an emulator because this is the first board documented to do this"

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

Re: Pirate Kid Dracula reverse engineering

Post by tepples » Fri Jan 13, 2017 1:37 pm

I thought MMC5's timer used three consecutive PPU reads with A13 low as the trigger to find the next scanline. What did I miss?

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

Re: Pirate Kid Dracula reverse engineering

Post by lidnariq » Fri Jan 13, 2017 1:59 pm

Nestopia doesn't implement it that way.

It implements the MMC5 IRQ by violating the abstraction around the PPU's H and V counters.

zxbdragon
Posts: 488
Joined: Mon Dec 12, 2011 8:15 pm

Re: Pirate Kid Dracula reverse engineering

Post by zxbdragon » Wed Jan 18, 2017 3:04 am

What is the difference between A13,A12?

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

Re: Pirate Kid Dracula reverse engineering

Post by tepples » Wed Jan 18, 2017 8:48 am

There are 341 dots in each scanline. The PPU reads memory every other dot, or 170 reads per scanline.
Normally, the PPU alternates between two nametable reads and two pattern table reads, performing 42 full sets of four reads each scanline.
When the PPU is reading the first pattern table, A12 and A13 are both low.
When the PPU is reading the second pattern table, A12 is high and and A13 is low.
When the PPU is reading nametables, A12 is low and and A13 is high.

How an A12-based timer works: (MMC3)
The PPU performs 32 sets of reads for background, 8 sets of reads for sprites, and then 2 more sets of reads for the background to set up the next scanline. If a game puts background tiles in the first pattern table and sprite tiles in the second pattern table, then A12 will be low during nametable and background pattern fetches, which represent most of the line, and it will go high several times near the end of the scanline when the PPU is fetching sprite patterns. By watching for several successive reads with A12 low followed by a read with A12 high, the mapper can infer that a new scanline has started.

How an A13-based timer might work:
Between one scanline and the next, the PPU's state machine pauses, causing it to read nametables four times in a row: the first of a set of four twice (ignored) plus the first two of the next set of four (used). By watching for several successive reads with A13 low, the mapper can infer that a new scanline has started.

EDIT: MMC5 relies on the same phenomenon as an A13 spreader but compares the whole address instead of just watching A13.

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

Re: Pirate Kid Dracula reverse engineering

Post by lidnariq » Wed Jan 18, 2017 4:46 pm

This should be titled "How the MMC5's scanline timer works":
tepples wrote:Between one scanline and the next, the PPU's state machine pauses, causing it to read nametables four times in a row: two that don't belong to a set of four plus the first two of the next set of four. By watching for several successive reads with A13 low, the mapper can infer that a new scanline has started.
This pirate port instead just counts falling edges of PPU A13, which happens during at the beginning of each pattern table fetches for both sprites and background tiles.

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

Re: Pirate Kid Dracula reverse engineering

Post by tepples » Wed Jan 18, 2017 4:56 pm

So I guess this must be the PA13 counterpart of the JY Company mapper (209 and its subsets 90 and 211), whose PA12 counter is followed by a division by 8 instead of a pulse spreader.

M2 prescaler: VRC IRQ, JY Company
PA12 spreader: MMC3
PA12 prescaler: JY Company
PA13 spreader: MMC5
PA13 prescaler: This


EDIT: Mistake stricken per Drag's result

Post Reply