In my computer networks course we are supposed to learn parallel port programming by using the native registers (like using outportb like commands). I don't have a parallel port (because I live in 2011) but want to practice the programs (I installed the old turboc 3 IDE using dosbox). Is there a program which emulates parallel ports like this program emulates serial ports?
相关问题
- Multiple sockets for clients to connect to
- What is the best way to do a search in a large fil
- glDrawElements only draws half a quad
- Index of single bit in long integer (in C) [duplic
- Equivalent of std::pair in C
It looks like dosbox may not support parallel ports without patches. It also appears that virtualbox also doesn't yet support parallel ports. But even if they did support parallel ports, you'd still need something on the other end - either a debug-driver on your host operating system, or something like a USB to Parallel adapter (available at the usual retailers).
Can you say more about why you want to learn about the parallel port? It is a mostly dead interface in 2011, as you suggest. If you really want to play with low-level parallel-style I/O, you may want to look in to the Arduino platform.
I don't know of any software offhand, though I would not be surprised if Linux Wine did a good job of supporting a parallel port, though I don't know if it can be completely virtualized when lacking a physical LPT.
When having to do legacy compatibility testing, I'm always amazed out how easy it is to find a cheap old PC.
Alas, this is highly regionally-centric, but visit a local resale store or computer recycling operation. For example, in Portland, I would visit Free Geek and Goodwill and not expect to pay more than $15. If your time is worth much, this is probably more affordable than messing around with emulators and then wondering how good they are.
Since the environment is fake anyway, i.e. you don't have an actual port to play with, you could just as well emulate the port functionality in your program.
Here's how to do it in Windows using Structured Exception Handling (SEH):
Output:
Just alter the implementation of
ReadPort()
andWritePort()
to do something more useful or more in line with the printer port operation.