Petrius and Spehro gave you the solutions, but not the problem explanation.
What you propose would have worked perfectly in DOS, or on a machine that is running in 'real' mode. Your problem is that if you have any OS later than Windows 2.x (OK, maybe 3.x) the OS will intercept the output instruction and whang you with a big illegal access exception. IIRC the page that Spehro pointed you to will give you a driver that intercepts the output to the port then outputs the byte to the port. It's kind of like trying to go take a pee when you're in 5th grade -- you need a hall pass, which is what the driver provides.
I'm sorry I missed some news. My current (third) ISP also has no reliable newsservers. (Sigh.)
You're only partial right about Windows. I wrote a lot of C programs using Turbo C using direct I/O to UARTS and printerports. All of them did well when running W95. I was told they did so too running W98 and Wmil but I did not check that out myself. They will sure not function running W2k or WXP. The old Turbo C is not the right tool to write programs for that OSes.
Tim, you've spent too much time with NT-based O/Ses. That HAL-interception is a feature of those, but Win9x doesn't have that problem. I do extensive parallel port I/O under 98SE and don't have any dramas. The only caveat is that if Windoze gets to use the port first, it soemtimes keeps some sort of hold over it.
No, he'll be fine in W95,98 and Me. He'll also be OK in NT, 2000 and XP if he installs the (free) giveio.sys utility or one of several others of a similar nature.
As others have mentioned, you have to check to see if your operating system will let you output data like this straight to the parallel port. It can be done under Linux with root privileges and a system call to get parallel port access, IIRC.
Even if you're under an older Windows that allows direct access to hardware, check very carefully for any other drivers such as printers or scanners that might interfere with your parallel port experiments. This happened to me, and I was pulling out my hair when all that was happening was interference with a system driver that used the parallel port.
--
Jem Berkes
Software design for Windows and Linux/Unix-like systems
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.