#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <asm/io.h>

#define base 0x378

#define led_start 1
#define led_on 5
#define led_off 4
#define finish 2


main (int argc, char *argv[])
{

    int i;
    int j;
    int length;
    char *buffer;


    if (ioperm(base,1,1))
    fprintf(stderr, "Couldn't get the port at %x\n", base), exit(1);

    for (i = 0; i < 9; i++) {

     switch (argv[1][i]) {
     case '1':   outb(1,base); outb(led_on, base); outb(0, base);
                 printf("o");
                 break;
     case '0':   outb(0,base); outb(led_off, base); outb(0, base);
                 printf(".");
                 break;
                         }
      }

     outb(finish, base); 
     outb(1, base); outb(0,base);

     for (j = 0; j < 9; j++) {
      switch (argv[2][j]) {
      case '1':  outb(1,base); outb(led_on, base); outb(0, base);
                 printf("O");
                 break;
      case '0':  outb(0,base); outb(led_off, base); outb(0, base);
                 printf("-");
                 break;
      }
     }    

        outb(finish, base);
        outb(1, base); 
        outb(0, base); 
        printf("\n");
}
