KEPCO BIT 232F User Manual
Page 67

BIT 232 022800
F-3
F.6
CHECK TO SEE IF A CHARACTER WAS RECEIVED
This function checks to see if a character was received using the ROM BIOS routine; if the com-
puter is not IBM-PC-compatible the ROM BIOS routine must be replaced by an equivalent.
/* check to see if a character was received */
int in_ready(int n)
{
union REGS regs;
/* AH has the function code */
regs.h.ah = 0x03;
/* DX has the port number */
if (n == 1)
regs.x.dx = 0;
else
regs.x.dx = 1;
/* call the ROM BIOS routine */
int86(0x14, ®s, ®s);
/* check for received data ready */
if (regs.h.ah & 1)
return TRUE;
return FALSE;
}
F.7
SEND COMMAND
This function sends a character string to the BIT Card and sends the echoed characters to the
monitor screen. The SendWecho function is used to send the command, byte by byte, to the BIT
Card. After the last byte of the command is sent, the Carriage Return (CR) character is sent to
the BIT Card to cause the parser to execute the command, and CR and Line Feed (LF) charac-
ters are sent to the monitor screen.
This function could be modified by comparing the character sent with the echoed character,
then if they do not match, send the last character again.
void SendCommand(char *send_cmmd)
{
int chr;
while( *send_cmmd != ‘\0’) {
/* output character here */
chr = *send_cmmd ++;
SendWecho(PORT,chr);
/* display returned byte if available */
if (chr != EOF)
putch(chr);
}
/* output end command */
chr = ‘\r’;
SendWecho(PORT,chr);
/* display returned byte if available */
if (chr != EOF)
putch(chr);
if (chr == ‘\r’)
putch(‘\n’);
}