/*==================== basic IO access : port_read.c ===============

  PURPOSE - show port read.
          - usage ./port_read port_num
*/
#include <stdio.h>
#include <unistd.h>
#include <sys/io.h>

int main(int argc, char *argv[])
{ /*--- check have one parameter. */
    if (argc != 2)
      { printf("   Usage is \"./port_value port_num\", 888 = LP1 data port.\n") ;
        exit( -1) ;
      }
  
  /*--- Read the data byte port.*/
    int  port_num = atoi( argv[1]) & 0x3FF ;
    int value = inb(port_num ) & 0xFF ;
    printf("    Read from port 0x%X ( %i), data value 0x%X (%i).\n", 
                         port_num, port_num, value, value  );
    exit(0); 
}
 
