Possible to map NBA Fastbreak serial link to Windows COM port
I'd like to explore the NBA Fastbreak communications protocol, and it would be helpful if I can use PinMAME as one side of that communications.
What sort of work would I need to do in order to make that happen? Did the WPC-95 hardware use that serial port for other purposes? Is it already emulated, or would I need to hook in emulation of the 16C450 UART at the correct address? And potentially implement an emulator for the features of the 16C450 that WPC-95 used?
I've done some work in PinMAME before. I improved the P-ROC integration, and I brought the Demolition Man simulator from "prelim" to "full" status, so I'm comfortable digging into the codebase. I'd probably work to get Fastbreak's simulator into "full" status as well, at least so I can use the keyboard to simulate activity while I log the communications with a physical machine.
I don't know the answer to any of these questions, but i think it would be awesome to have something like that. Maybe a bit more abstractly packaged, so that the COM port would only be one possible implementation? (sounds more future proof ;))
So please go ahead, we'll be happy to take the changes..
So, I'm off to a good start.
I was able to hook a logic probe to my physical machine and determine that the WPC95 UART is mapped to addresses 0x3FB0 to 0x3FB7. I have completed code to emulate the sending side of this UART, and I'm able to use the service menu's printout menu to dump text. Once I complete the read-related routines, it should be possible to run two instances of PinMAME with the NBA Fastbreak ROMs and have them communicate with each other over the paired virtual serial ports I've set up.
I've added a separate .c/.h file with the 16C450 emulation code. It currently has a bare-bones Windows-only serial driver embedded in it, but I can move that to a separate file.
I'm currently using a hard-coded serial port in the EXE file to select the serial port.
I'd like some guidance on adding a new command-line parameter to pinmame.exe to specify the serial port ("COMxxx" for Windows and "/dev/ttyXXX" for Unix), which would also enable the serial port code that I'm working on.
I can move the serial port code into windows/serial.c and create an equivalent unix/serial.c. I based the routines off of code I'd previously written under an MPL 2.0 license.
I plan to move the hooks directly into the wpc_r() and wpc_w() routines. Is there some way to identify whether the current machine definition is wpc_m95S? Maybe access the core_tGameData structure and check for .gen == GEN_WPC95?
For older WPC games, it should be possible to emulate the Printer Interface Board which used an 8251 UART.
Considering adding serial_device to pmoptions and for use in -showusage and -showconfig.
Looks like I would need to:
- Add new
serial_deviceelement (string type) totPMoptionsindriver.h. - Add usage/config to data structures in
ui/options.c,ui/Win32ui.c,unix/config.c, andwindows/config.c. - Check
pmoptions.serial_devicein code that's deciding whether to try using the simulated 16C450.
I'm curious about duplicated options entries in the Windows and Unix config.c files. Couldn't those go into a file shared between the two platforms?
Hi again, in principle all sounds good as you proposed it.
As for adding new options: This is exactly what i wonder each time i add another one ;). So i always just go copy/pasting from existing options, as i have no real clue about all the implications under the hood. :/
As for generation detection: Yes, exactly like that.
Making good progress. I just aded the 8251 UART from the WPC Printer Option Kit and had Demolition Man dumping printouts as well. The Open Source com0com project might be a good resource for setting up a virtual COM port that you can connect to from a terminal emulator or any other program. I've been using the commercial Virtual Serial Port Driver Pro by Electronic Team, Inc.
I'm putting the feature behind the macro PINMAME_HOST_UART since I can't easily update all of the different Makefiles. I'll need some guidance on how to tweak the Visual Studio project files to define that macro and add some new .C/.H files. I've been doing development in the PinMAME target, and I'm not sure if there are other targets that should have the feature enabled by default.
As this is now in (minus explicit documentation), closing.. Thanks again!