VS Dual System question about $4016

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

Post Reply
User avatar
oRBIT2002
Posts: 687
Joined: Sun Mar 19, 2006 3:06 am
Location: Gothenburg/Sweden

VS Dual System question about $4016

Post by oRBIT2002 »

The Wiki mentions this concerning $4016-writes (bit 2):
"In the DualSystem, connects to 1- /IRQ of the other CPU and 2- when high on the primary
specifies that 2KiB of RAM is mapped from $6000-$7FFF, else mapped for the secondary CPU"
What does this mean? :)
User avatar
Hamtaro126
Posts: 818
Joined: Thu Jan 19, 2006 5:08 pm

Re: VS Dual System question about $4016

Post by Hamtaro126 »

oRBIT2002 wrote:The Wiki mentions this concerning $4016-writes (bit 2):
"In the DualSystem, connects to 1- /IRQ of the other CPU and 2- when high on the primary
specifies that 2KiB of RAM is mapped from $6000-$7FFF, else mapped for the secondary CPU"
What does this mean? :)
BTW, This needs a bit more cleaner on the wiki, as to be less vague and easier to read!
AKA SmilyMZX/AtariHacker.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: VS Dual System question about $4016

Post by lidnariq »

Please point out what specific points in that description confuse you?
Since I wrote most of this documentation, I am so familiar with it that I can't see what's unclear about it.
User avatar
oRBIT2002
Posts: 687
Joined: Sun Mar 19, 2006 3:06 am
Location: Gothenburg/Sweden

Re: VS Dual System question about $4016

Post by oRBIT2002 »

Mostly everything to be honest. Can I get it in a little more newbie kind of way? :)
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: VS Dual System question about $4016

Post by lidnariq »

Saying "throw it all out and start from scratch" doesn't help me clarify anything. :|

Seriously, copy and paste the original text and interrupt it the moment you don't understand something or have a question about it. Don't allow yourself to read the whole sentence and just get to the end and only then go "I have no idea what I just read".
User avatar
oRBIT2002
Posts: 687
Joined: Sun Mar 19, 2006 3:06 am
Location: Gothenburg/Sweden

Re: VS Dual System question about $4016

Post by oRBIT2002 »

"In the DualSystem, connects to 1- /IRQ of the other CPU and 2- when high on the primary
specifies that 2KiB of RAM is mapped from $6000-$7FFF, else mapped for the secondary CPU"

"In the DualSystem, connects to 1- /IRQ of the other CPU and 2- when high on the primary"
What does this mean? 1-? 2-? High on the primary?
Is there some kind of "memory-sharing" going on between the two "devices/CPUs" using this bit?

How does this bit affects emulators? How should it be handled?
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: VS Dual System question about $4016

Post by lidnariq »

"In the DualSystem, connects to 1- /IRQ of the other CPU and 2- when high on the primary"
What does this mean? 1-? 2-?
That's me trying to make a list.
High on the primary?
Is there some kind of "memory-sharing" going on between the two "devices/CPUs" using this bit?
Exactly.

I've edited to make these clearer. Would you read the article again and see if it makes more sense to you now?
How does this bit affects emulators? How should it be handled?
Almost no emulators support the DualSystem itself; as far as I know only MAME ?

For single-CPU games an emulator could probably just use the NES2.0 headers to say "2K of PRG RAM requested by header and Vs. System→/IRQ is always asserted and game can never CLI"
User avatar
oRBIT2002
Posts: 687
Joined: Sun Mar 19, 2006 3:06 am
Location: Gothenburg/Sweden

Re: VS Dual System question about $4016

Post by oRBIT2002 »

By your explanation (which is a bit better now btw, thanks), this shared RAM at $6000, it can only be accessed by one system at a time?
And by "asserts /IRQ on the other CPU", you mean it actually triggers an IRQ on the other CPU when writing to $4016 when bit 2 is 0?
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: VS Dual System question about $4016

Post by lidnariq »

Only one of the two CPUs, yes. That's why they can communicate using OUT1 and /IRQ: so that they can agree when it's time to swap off access.

It's pretty clearly intended to be something like
* Master drives OUT1 high, puts stuff in RAM
* Master drives OUT1 low, slave enters IRQ handler
* Slave reads data from, and puts data into, RAM
* Slave drives its OUT1 low until master drives its OUT1 high.
* repeat
Post Reply