Search code examples
assemblyx86parallel-port

Getting input from the printer port in assembly?


Is there a way to accept input through the parallel (printer) port in x86 assembly? My friend is designing a chip, that connects to the printer port, that has switches on it to poll for input. He wrote a program in VB but he wanted me to make a program in assembly since he had to use a timer.


Solution

  • Just read at the corresponding memory addresses (0x378-0x37f for LPT1). But be aware that this will require elevated privileges (root/kernel) depending on your operating system.

    Edit: On modern operating systems this will not work at all due to security limitations. You cannot access the port directly from a userspace program, you have to use the corresponding kernel functions.