FCEUX famicom expansion port IO to parallel port on pc?

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
FCEUX famicom expansion port IO to parallel port on pc?
by on (#241826)
Is it possible to place $4016 out0-2 lines and $4017 D0-D4 on the parallel port of a pc? If so, how would I go about doing this? I'm in the middle of some hardware design and it would make testing much easier if I didn't have to reflash an EEPROM for every test.
Re: FCEUX famicom expansion port IO to parallel port on pc?
by on (#241827)
I believe there's no pre-existing standard for doing this, and Windows and Linux will make it harder to do this on any newer OS.

NO$NES includes some parallel-port mediated thing, but it doesn't appear to be related to the expansion port.

All that said, yes, it's technically doable, but I don't know how negatively IO port access will affect performance.
Re: FCEUX famicom expansion port IO to parallel port on pc?
by on (#241832)
There are serial-to-USB adapters, I'd be surprised if there aren't parallel ones as well.
Re: FCEUX famicom expansion port IO to parallel port on pc?
by on (#241833)
creaothceann wrote:
There are serial-to-USB adapters, I'd be surprised if there aren't parallel ones as well.

Every one I've seen is specifically for printers and not something that you can use in an immediate way like the actual parallel port.

I think there's some potential in using an arduino or similar microcontroller as a USB to Parallel port bridge, but for most purposes you probably need something programmable in the middle of the two protocol like this so that you can write something that operates according to your specific need.

I would hope that OP already has the "find a PC with a parallel port" problem solved though.
Re: FCEUX famicom expansion port IO to parallel port on pc?
by on (#241848)
Notes from my similar but different UART emulator project say it's input.cpp, JPRead and B4016. Based on "SetWriteHandler(0x4016" in there.

Maybe try this? I think this may be what I used on Win98 and XP, seems it has been ported to later Windows versions as well!
http://www.highrez.co.uk/downloads/inpout32/

I remember doing stuff like outp(0x378, ..). In Win98 it always worked fine, in XP there would be latency if I did anything, even moving the mouse. Not sure how well Win7 will do with it. At any rate, should be much easier than looking up the whole OS-provided way of doing it.

edit:
port reference:
https://wiki.osdev.org/Parallel_port
Re: FCEUX famicom expansion port IO to parallel port on pc?
by on (#241849)
On x86 port I/O requires elevated permissions ("ring 0"), so under linux you either have to run the thing as root, or have a kernel module to provide an interface for unprivileged applications. (and wine is really much too complicated of a thing to be comfortable run as root)

Under windows, there doesn't seem to be a sufficient equivalent to the former, so you have to use something that provides this abstraction - something like inpout, or GiveIO - or use Windows95/98/ME.
Re: FCEUX famicom expansion port IO to parallel port on pc?
by on (#241851)
Thanks for the responses everyone. If I can find some time this weekend I'll break out the Win98 laptop and see if I can get inpout32 working.

I've never done work like this before. Can I modify an external file or do I need to download the fceux source and rebuild it with my changes?
Re: FCEUX famicom expansion port IO to parallel port on pc?
by on (#241852)
You'll have to rebuild FCEUX.

Win95/98/ME shouldn't need inpout32 ; there you should be able to just use whatever abstraction the C compiler presents to generate the x86 outb and inb instructions.

Newer OSes (XP+) need inpout32, if that's even sufficient. At least the linked article says it worked on Vista.