04-27-2012, 10:58 PM
Code:
#include <dos.h>
#include <bios.h>
#include <conio.h>
void initialize (unsigned int far *com)
{
outportb ( (*com)+3, inport ((*com)+3) | 0x80);
outportb ( (*com),0x60);
outportb( (*com) +1, 0x00);
outportb ( (*com)+3, 0x02);
}
void SelfTestOn(unsigned int far * com)
{
outportb((*com)+4,inport((*com)+4)|0x10);
}
void SelfTestOff(unsigned int far * com)
{
outportb( (*com)+4, inport((*com)+4) & 0xEf);
}
void writechar( char ch, unsigned int far * com)
{
while ( !((inportb((*com)+5) & 0x20) == 0x20));
outport(*com,ch);
}
char readchar( unsigned int far *com)
{
while (!((inportb((*com)+5) & 0x01)==0x01));
return inportb(*com);
}
unsigned int far *com=(unsigned int far*) 0x00400002;
void main ()
{
char ch = 0; int i = 1;int j= 1;
char ch2='A';
initialize( com);
SelfTestOn(com);
clrscr();
while (ch!=64)
{
if (i==80)
{
j++;
i=0;
}
if (j==13)
j=0;
gotoxy(i,j);
ch=getche();
writechar(ch,com);
ch2=readchar(com);
gotoxy(80-i,j+14);
putch(ch2);
i++;
}
SelfTestOff (com);
}
Allah Help those Who help them Selves
mileys44:
mileys44:
