To be able to read and write from the PC ports like the parallel port, one needs to understand it workings. And a way to circumvent the operating system from accessing directly the ports.
This document describers all you need to know about the parallel port in bidirectional mode.
Elektor magazine published an article on testing the parallel port with a device showing with LEDs the state of every pin of the port. I have build one and its very handy testing devices and in general the elementary programs for the parallel port.
DLPORTIO is a driver and API to read and write ports in a PC under Windows 95/98/2000/XP.
DLPORTIO.PAS is a unit for Delphi/FreePascal with the API to DLPORTIO. See this page for Windows 64!
To combine all this knowledge and get started again with Delphi I have written a simple but effective program, TESTLPT, to read and write all ports relevant for the parallel port.
Here you find TESTLPT, complete with DLPORTIO , all automatically installed in Windows.