#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/io.h>

//#define BASEPORT 0x3bc
#define BASEPORT 0x378

int main()
{
    /* Get access to the ports */
    if (ioperm(BASEPORT, 3, 1)) {perror("ioperm"); exit(1);}

    char c;
    while(1) {
        /* Set the data signals (D0-7) of the port to all low (0) */

        cout << "high\n";
        outb(0xFF, BASEPORT);
        /* Sleep for a while (100 ms) */
        usleep(1000000);
        cout << "low\n";
        outb(0x00, BASEPORT);
        usleep(1000000);
        
    }
    /* We don't need the ports anymore */
    if (ioperm(BASEPORT, 3, 0)) {perror("ioperm"); exit(1);}

    return 0;
}

