Expose a parallel port - #1613
Conversation
| // For Types Only | ||
| import { CPU } from "./cpu.js"; | ||
| import { BusConnector } from "./bus.js"; |
There was a problem hiding this comment.
nit-pick: move this to the top of file
|
It would be good if you could create multiple LPT ports like in UART: Lines 1184 to 1195 in 2f1346b |
|
Thanks for the review. Added LPT2, but I don't think seabios or boch's support LPT3/LPT4. |
| @@ -0,0 +1,150 @@ | |||
| #!/usr/bin/env node | |||
There was a problem hiding this comment.
To be honest, I don't find this test very useful: It tests mostly internal implementation details, not whether this presents a working parallel port to the guest OS.
A more useful test would be to boot Linux or DOS, run some commands that interact with the parallel port and test that the corresponding events get called.
There was a problem hiding this comment.
I see what you mean. test/api/floppy.js seems to do what you're asking so I tweaked it a bit to make a higher-level parallel port test.
|
Thank you! |
This adds a "device" that only emits bus events for the LPT1 registers. The goal is to make it possible to add a virtual printer from outside the emulator.
Parallel port logic is timing based, but this hacks around it by latching falling ACK events until the guest reads the status register. For both bochs and seabios that's enough to keep int 17h synchronized while the bus blasts status and control register updates at whatever speed.
I would have also included a printer, but the best library for parsing printer protocols, GhostPDL, has a copyleft license that isn't compatible with v86. So I made a separate GhostPDL-based PCL5 printer that can be wired to this interface but has an AGPL3 license:
https://github.com/parkertomatoes/inkjet-emu
And some demos with DOS and Windows 3.x printing with v86 and inkjet-emu:
https://inkjet-emu-demo.swannerfly42.workers.dev/