#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <dos.h>
void main (void)
{
int a,b,d;
int c=0;
clrscr();
randomize();
while (1)
{
b=0x00;
b=inportb(0x379);
b&=0x80;
if(b==0x80)
{
clrscr();
a=rand()%6+1;
gotoxy(27,12);
textcolor(14);
cprintf("The number on the dice is: %d",a);
switch(a)
{
case 1:c=0x77;
break;
case 2:c=0x6b;
break;
case 3:c=0x36;
break;
case 4:c=0x2a;
break;
case 5:c=0x22;
break;
case 6:c=0x08;
break;
}
outp(0x378,c);
}
}
}