Vs Dualsystem Watchdog Timer

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

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

Re: Vs Dualsystem Watchdog Timer

Post by lidnariq » Sun Nov 29, 2020 1:29 pm

There are two CPUs in the Vs. DualSystem, such as used in the "red tent" Vs. Systems. Only one (the seconary CPU) has to pet the watchdog; the other can't.

However, specifically in the case of a 4 player DualSystem game - using both CRTs, both PPUs, and both CPUs - the primary CPU has to hand off control to the shared memory to the secondary CPU, and the seconary CPU should probably deliberately stop reading $4017 if it doesn't get that RAM when it thinks it should

User avatar
rainwarrior
Posts: 8006
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Vs Dualsystem Watchdog Timer

Post by rainwarrior » Sun Nov 29, 2020 1:44 pm

Hmm, if the purpose is to recover from a crash, maybe my suggestion to put the $4017 read in NMI isn't quite appropriate, since that would probably continue operating during a crash...

Unless maybe using the opposite of the lockout I suggested, i.e. set a flag when you're not going to read controllers for a while that says "I'm going idle for a while, start polling it for me until I get back".

Though, as an alternative it's probably not hard to stick a few BIT $4017 instructions into a loading loop or whatever it is you're doing that takes a bunch of frames to process.

It still feels like a good idea to always read and process the coin slot in NMI though?

User avatar
Goose2k
Posts: 209
Joined: Wed Dec 11, 2019 9:38 pm
Contact:

Re: Vs Dualsystem Watchdog Timer

Post by Goose2k » Mon Nov 30, 2020 12:21 am

rainwarrior wrote:
Sun Nov 29, 2020 1:44 pm
It still feels like a good idea to always read and process the coin slot in NMI though?
Yes, I agree. I think I will catch coin events in NMI, and cache in a temp counter, which my main game loop will pick up when it can, and clear the NMI cache when it does.

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

Re: Vs Dualsystem Watchdog Timer

Post by lidnariq » Mon Nov 30, 2020 11:58 am

If you want to be extra paranoid, the coin drops can accept coins faster than the counter can count, so you need a queue like that anyway.

(It's a ridiculous concern, though. I'm hard pressed to believe there are any Vs. Systems still being paid with real money)

User avatar
Goose2k
Posts: 209
Joined: Wed Dec 11, 2019 9:38 pm
Contact:

Re: Vs Dualsystem Watchdog Timer

Post by Goose2k » Mon Nov 30, 2020 3:46 pm

Yah it's all just kind of a fun personal challenge at this point. I want to make it feel as authentic as possible.

I am curious how you would handle coins dropping faster than the counter can handle? I assume you mean that before the coin bit is cleared, another coin is dropped, so there will be no "break" where the bit goes from 1 to 0 and then 1 again?

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

Re: Vs Dualsystem Watchdog Timer

Post by lidnariq » Mon Nov 30, 2020 4:06 pm

No, that's indistinguishable from someone with a bogus coin-on-a-string. But you could end up with "coin counterdrop reads as true for 2 vsyncs, reads as false for 2 vsync" on both coin countersdrops for ... maybe two coins in a row? Probably not more.

So in this case I'd say one should do something like

Code: Select all

vsync [$4020] [$4016]&$60
0     0       00
1     0       60 <- first two coins, one in each slot
2     0       60
3     0       60
4     1       00 <- don't grant credits or count coins until they disappear
5     1       00
6     1       60 <- second two coins, 84ms later
7     0       60
8     0       60
9     0       00
10    1       00
11    1       unchanged hereafter
12    1       four coins need to be counted
13    0       but we've only had enough time to count 2 so far
14    0
15    0
16    1
17    1
18    1
19    0
20    0
21    0
22    1
23    1
24    1
25    0
26    0
27    0       these final three 0s are still required by the 10Hz coin counter
Even if you can't get two coins in the same slot this quickly, you can still insert two coins into the two slots at the same moment, and two credits should be granted and counted in this case.
Last edited by lidnariq on Mon Nov 30, 2020 4:47 pm, edited 1 time in total.

User avatar
Goose2k
Posts: 209
Joined: Wed Dec 11, 2019 9:38 pm
Contact:

Re: Vs Dualsystem Watchdog Timer

Post by Goose2k » Mon Nov 30, 2020 4:19 pm

Ohhhh you are talking about the "Coin counter ($4020-$403F, &c)" being slower than the speed at which people can drop coins (I thought "coin countered" meant the bits in $4016). I see what you mean now.

I haven't hooked up the coin counter at all yet. Unfortunately, I can't find any emulators that emulate it so far, but the guy who is testing on real hardware for me does have a working one, so I will try testing it out.

This part of the Wiki makes a lot more sense now that I see your example above too, thanks!

"driving the signal high for 50ms (3 vblanks) and then low for 50ms is guaranteed to work"

I've started a new thread on the Coin Counter just so this doesn't go too far off topic with my additional questions :)

viewtopic.php?f=2&t=21351&p=260937#p260937

Post Reply