FCEUX famicom expansion port IO to parallel port on pc?

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
emerson
Posts: 30
Joined: Fri Nov 18, 2016 7:29 am

FCEUX famicom expansion port IO to parallel port on pc?

Post by emerson » Thu Aug 15, 2019 4:40 pm

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.

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

Re: FCEUX famicom expansion port IO to parallel port on pc?

Post by lidnariq » Thu Aug 15, 2019 4:53 pm

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.

creaothceann
Posts: 229
Joined: Mon Jan 23, 2006 7:47 am
Location: Germany
Contact:

Re: FCEUX famicom expansion port IO to parallel port on pc?

Post by creaothceann » Fri Aug 16, 2019 12:01 am

There are serial-to-USB adapters, I'd be surprised if there aren't parallel ones as well.
My current setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10

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

Re: FCEUX famicom expansion port IO to parallel port on pc?

Post by rainwarrior » Fri Aug 16, 2019 12:10 am

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.

User avatar
Memblers
Site Admin
Posts: 3858
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Re: FCEUX famicom expansion port IO to parallel port on pc?

Post by Memblers » Fri Aug 16, 2019 12:23 pm

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

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

Re: FCEUX famicom expansion port IO to parallel port on pc?

Post by lidnariq » Fri Aug 16, 2019 12:36 pm

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.

emerson
Posts: 30
Joined: Fri Nov 18, 2016 7:29 am

Re: FCEUX famicom expansion port IO to parallel port on pc?

Post by emerson » Fri Aug 16, 2019 4:11 pm

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?

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

Re: FCEUX famicom expansion port IO to parallel port on pc?

Post by lidnariq » Fri Aug 16, 2019 4:28 pm

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.

Post Reply