Skip to content

Instantly share code, notes, and snippets.

@brunopk
Last active September 15, 2019 20:48
Show Gist options
  • Save brunopk/6b390430e51bb648cb608083f917955f to your computer and use it in GitHub Desktop.
Save brunopk/6b390430e51bb648cb608083f917955f to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/io.h>
#define base 0x378 /* parallel port base address */
int main(){
int y;
if (ioperm(base,1,1)){
fprintf(stderr, "Access denied to %x\n", base);
exit(1);
}
/* Send 00000000 to parallel port to clear all bits */
outb(0x00, base);
/* Send 00001111 to parallel port */
outb(0xF0, base);
scanf("%d", &y);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment