Back when I owned a Commodore 64 (and a PET before that) I wrote a lot of programs that interacted with the outside world. By "interacted with the outside world" I mean the program could test whether a switch was on or off, and it could force a single pin on a port to go high or low. By switch I mean a physical toggle switch that a person turned on or off by hand, a relay, a thermostat, etc. The output pin could turn a light on or off, open or close a relay, etc. The C-64 had a "port" on the back that you could connect to simple home-brew circuit boards to accomplish this. The programs, in BASIC of course, used PEEK and POKE commands with a logical mask to read from and write to the port which was at a certain address in the machine.
I'd like to do this with a PC and Pascal but don't know how. The natural choice for a port is the Centronics parallel port but I have no idea how to read or write to it.
Another idea. Is it possible to build a board that would allow you to "PEEK" and "POKE" to a port like on the C-64?