C++ help

engg_rsakm

New Member
can any one tell what is the following code doing
#include<dos.h>
#include<graphics.h>
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>

#define ENABLE_KEYBOARD
// comment the above line to disable display of number
// through keyboard...

#define port 0x378

void ready(int);
void que(int,int);
void setscreen (void);
void kbpress (int );
void showteam(int);


int flag[7]={0,0,0,0,0,0};
int mx,my,j=0,order[7];
int team[8][7]={ {1,1,1,0,1,1,1},
{0,0,0,0,0,1,1},
{0,1,1,1,1,1,0},
{0,0,1,1,1,1,1},
{1,0,0,1,0,1,1},
{1,0,1,1,1,0,1},
{1,1,1,1,1,0,1},
{0,0,0,0,0,0,0} };

/*ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
ÃÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ´
ÃÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ´
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ*/

void main()
{
int gd=DETECT,gm;
char key;
int t;

initgraph(&gd,&gm,"");
cleardevice();

mx=getmaxx();
my=getmaxy();

setscreen();
/*---------------------------------------------*/
while(1)
{
outportb(port, port | 0x02);
delay(10);
t=inportb(port+1);
if((t&0x80)==0x80 && flag[1]==0) showteam(1);
if((t<<2 & 0x80)==0x00 && flag[2]==0) showteam(2);
if((t<<3&0x80)==0x00 && flag[3]==0) showteam(3);
outportb(port, port & 0xfd);
delay(10);
t=inportb(port+1);
if((t & 0x80)==0x80 && flag[6]==0) showteam(6);
if((t<<2 & 0x80)==0x00 && flag[5]==0) showteam(5);
if((t<<3 & 0x80)==0x00 && flag[4]==0) showteam(4);
if(kbhit()) kbpress(getch());
}

}
 
It's writing to the parallel port, then reading from the port and calling some showteam() function, which must be defined somehwere else.

But I wouldn't worry about it. It's an old DOS program for the old Turbo C compiler, and won't likely run on your OS.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…