VS System coin acknowledge

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

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

Re: VS System coin acknowledge

Post by tepples »

perilsensitive wrote:- Since lock-out coils aren't common, games are written to check for coins all the time (VS. games seem to check at least once per frame) so there's essentially no risk of losing coins except during the self-test sequence at boot.
Do games continue to check once per NMI even while doing a (relatively) long load between screens? If so, the coin handler would have to be in all banks.
perilsensitive
Posts: 13
Joined: Mon Jul 15, 2013 3:35 pm

Re: VS System coin acknowledge

Post by perilsensitive »

That's a good question. Apparently the answer is no. Vs. Dr. Mario, for example, skips the check for two frames. Vs. Castlevania skips the check for 8 frames (probably due to loading CHR data). So there are some opportunities for missing a coin, but they would be pretty hard to hit in practice since they're no longer than a handful of frames. Some may in fact be impossible to hit if the coin switch is closed long enough. It would really be helpful to know more about the coin switch timing. :(
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: VS System coin acknowledge

Post by lidnariq »

To briefly drag this up from the past: I looked around for what seems to be the common name for these counters ("electromagnetic counter") to try to figure out what any of them said about the timing.
What I learned is 1- Almost none of them talk about minimum on-time or off-time requirements; 2- A large number of them can be run off either 50Hz AC or DC; 3- Most of them are specified for a maximum number of counts per second; most values I saw for modern counters are rated in the range of 10 to 15 counts per second, with a few DC-only counters at up to 20 CPS; 4- Omron (one manufacturer) says that the maximum possible speed happens when given a 50% duty cycle, but they no longer make electromagnetic counters.

#2 means that the on time must at least 20ms, or else these counters would do the wrong thing when fed AC. #3 implies the total on+off time doesn't have to be more than 100ms. Real-world game data implies that the on time doesn't need to be more than 50ms.

So it looks like the right recommendation is "3 vblanks on, 3 vblanks off, per count"
User avatar
Memblers
Site Admin
Posts: 4044
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Re: VS System coin acknowledge

Post by Memblers »

If anyone is interested enough to write a test ROM, I could run it on my VS board. It's in a single-screen Playchoice cabinet (not a conversion kit), that I currently have converted to VS SMB. But since VS boards also ran in Midway and Donkey Kong cabinets, there's not really one definitive type.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: VS System coin acknowledge

Post by lidnariq »

It took me far too long to do this, but I have gotten around to writing a set of simple tests for the Vs system.

The one enclosed here explicitly targets a board that already has Vs SMB; I reuse its CHR and use the palette of the 2C04-04. It should be relatively easy to retarget it to any other PPU and existing CHR with a reasonably complete set of alphanumerics, although I'm currently cheating in a few places and don't currently have a hexadecimal-to-chr lookup table.

There are five tests:
  • The VS system mainboard has a watchdog circuit made of a 74'123. The timeout should be somewhere around a second, but it'd be nice to know the actual value, and how consistent it is.
    If the watchdog fires, a 6 digit hexadecimal number will display, of which the bottom 20 bits are displaying the number of counts it took before the watchdog triggered. The topmost nybble should always be F. A count averages to just a little over 8cy, or about 4.5µs.
  • How long does it take for a coin to fall through the coinbox?
    Each time a coin is inserted, a 4 digit hexadecimal number will be added to the screen. Here a count averages to just a little over 11cy, or about 6.2µs.
  • The schematic implies that the coin counter is mirrored across the entire range of $4020-$5FFF. Is that true? We read from $5FFF and $5020 to attempt to cause it to count.
  • Is the extra memory for the Dual System available to us? It should be if we're in the master slot on the mainboard.
  • How fast can we drive the coin counter? The default (50ms on/50ms off) is guaranteed to work, but can it reliably go faster?
In the archive is e000.bin, which can replace the corresponding 'PROM (1A or 6A) in a board that already contains Vs SMB. There is no need to replace any of the other 5 'PROMs.

The code's a bit of crap, especially when it came to managing my time to not overrun vblank, so I turn rendering on and off too much. I have tested it in Nintendulator and Nestopia.
This might be the first 100% original homebrew (i.e. not romhack) that both has and needs a NES2.0 header (due to specifying which PPU).

EDIT: the previous version (.nes CRC of 4356ab7b, .nes date of 2014-03-26 20:22) had a stupid bug that didn't ever display the watchdog timer. Attached version now fixes that, plus the other idiosyncracies I've struck out above.
Attachments
characterize-for-vssmb.zip
(11.61 KiB) Downloaded 805 times
User avatar
Memblers
Site Admin
Posts: 4044
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Re: VS System coin acknowledge

Post by Memblers »

Watchdog occured after 48578, 43228, 484B2, 483F9, 43228, 446F7, etc
Coin elapsed times 26CC, 0001 1FA7 (bounce?), 237A, 2409, 312C, 2899, 2862, 29A2, etc
Coint counter mirror, works
memory test, clr- shm not disabled, set- shm enabled, 2kB shm mirrored
coin counter time, on time 10, off time 16 seems to be the minimum. Though I only pressed it maybe a dozen times or so.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: VS System coin acknowledge

Post by lidnariq »

Memblers wrote:memory test, clr- shm not disabled, set- shm enabled, 2kB shm mirrored
Was this test with the ROM in 6A or 1A? If in 6A, was the master 2A03 (2J) not populated?

This is very exciting: the numbers are fairly consistent! The watchdog resets the system after 1.23 to 1.33 seconds without a read from $4017; a coin takes about 65ms to fall through the coin drop (but sometimes as little as 50ms); and at least this coin counter can apparently run about as fast as 25Hz!
User avatar
Memblers
Site Admin
Posts: 4044
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Re: VS System coin acknowledge

Post by Memblers »

It was in 6A, actually with VS SMB part of the security includes putting a fake CPU in the other slot. A whole DIP-40 thing marked RP2-something, but all it does is short 2 of the pins together. My VS SMB is actually a homemade bootleg, so it has a wire instead of the fake chip, and a hacked the palette to match the Playchoice PPU.

Anything else I check let me know, thanks for writing a test program, the VS and Playchoice are both pretty neat to play with.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: VS System coin acknowledge

Post by lidnariq »

Memblers wrote:It was in 6A, actually with VS SMB part of the security includes putting a fake CPU in the other slot. A whole DIP-40 thing marked RP2-something, but all it does is short 2 of the pins together.
Ah, that exactly explains what's going on here. The RP2A04 ties OUT1 to ground in 2J, mapping the shared memory at $6000 constantly for the CPU in 8J.
and a hacked the palette to match the Playchoice PPU.
!!! If I'd known I would have made the palette look reasonable for the 2C03 instead of for the 2C04-04.

I should probably go back and add palette selection from the main menu.
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: VS System coin acknowledge

Post by Zepper »

Buttom "A" isn't working..? Both mine and Nintendulator seems to have problems with this test ROM.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: VS System coin acknowledge

Post by lidnariq »

Are you using controller "2" ($4017), by which the VS system means 1? Most of the emulators I've used don't seem to bother to switch the two inputs. Anyway, it definitely WFM in nestopia/nintendulator/no$nes. Not certain how to test it in MAME, but it would be nice to.

Unrelatedly, I'm working on a version with some UI improvements, but no new tests. I should have it done in a day or two.
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: VS System coin acknowledge

Post by Zepper »

lidnariq wrote:Are you using controller "2" ($4017), by which the VS system means 1? Most of the emulators I've used don't seem to bother to switch the two inputs. Anyway, it definitely WFM in nestopia/nintendulator/no$nes. Not certain how to test it in MAME, but it would be nice to.

Unrelatedly, I'm working on a version with some UI improvements, but no new tests. I should have it done in a day or two.
The test prints a message for pushing button "A". Is in the controller 2 !? :P
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: VS System coin acknowledge

Post by lidnariq »

If it's not acknowledging you when you think you're hitting player 1's A button ... then you're not hitting player 1's A button.

Furthermore, if you go straight to the coin timing screen rather than a selection menu, you're probably implementing open bus NES-style instead of correctly emulating the coin drops.
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: VS System coin acknowledge

Post by Zepper »

I get the selection menu, but button "A" is not responsive.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: VS System coin acknowledge

Post by lidnariq »

Ok, version with UI fixes:

Changes:
* 2C05 automatic detection and support
--- If the automatic detection fails (i.e. we don't get NMIs from setting 2000.7 or 2001.7) it makes an obnoxious noise and hangs.
* Runtime PPU selection
* Improve ease of future retargeting to games other than Vs SMB (add a few assemble-time constants and the hexadecimal-to-chr table that's unneeded for Vs SMB)
* Coin insert lasting longer than 406ms no longer quits coin insert test
* Returning to main menu from watchdog timer display no longer can trash palette
* Slightly more robust 2 KiB mirroring test
* Displays date/time of image build
* Does not automatically jump to coin insert timing test if a coin is inserted from the main menu
* Displays readback from 2002 (as write 0 to $2002, read, write FF to $2002, read)
* Displays dip switches (as [$4016] & $9A and [$4017] & $FE)
characterize-for-vssmb-v20140409.zip
(13.79 KiB) Downloaded 1802 times
Zepper wrote:I get the selection menu, but button "A" is not responsive.
I have no idea what's going wrong. It works fine on Memblers's hardware, and for all the emulators that I've used.
The archive includes the source, and a "build" file that produces the debugging information used by NintendulatorDX or NESICIDE, so you should be able to figure out where it's going wrong.
Post Reply