home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR2
/
DIGIPROG.ZIP
/
LOOPTEST.C
< prev
next >
Wrap
Text File
|
1991-11-21
|
2KB
|
80 lines
#include <dos.h>
#include <stdio.h>
main()
{
struct REGPACK sregs;
int y,x,cnt,dx1,dx2;
union REGS regs;
char *str = "DigiBoard";
char buff[100];
/*
This program transmits a string, 'DigiBoard', from one channel to
another. This requires a null modem conector and a gender bender
between the two channel legs of the DigiBoard cable. It is assumed
that both channels are configured for the same baud rates ect..
*/
printf("\nEnter TX channel # : ");
scanf("%d",&dx1); while(kbhit()) getch();
printf("\nEnter RX channel # : ");
scanf("%d",&dx2); while(kbhit()) getch();
/* The ports are configured with xidoscfg.exe */
/* Get TX free space */
sregs.r_ax = 0x1200;
sregs.r_dx = dx1;
intr(0x14,&sregs);
printf("\nChnl %d TX free space : %04X",dx1, sregs.r_ax);
sregs.r_ax = 0x1200;
sregs.r_dx = dx2;
intr(0x14,&sregs);
printf("\nChnl %d TX free space : %04X",dx2, sregs.r_ax);
/* write string */
sregs.r_ax = 0x0e00;
sregs.r_cx = strlen(str);
sregs.r_dx = dx1;
sregs.r_es = FP_SEG(str);
sregs.r_bx = FP_OFF(str);
intr(0x14,&sregs);
delay(1000); /* wait for data to be transmitted */
/* Get input character count */
sregs.r_ax = 0x0A00;
sregs.r_dx = dx2;
intr(0x14,&sregs);
printf("\nChnl %d Input count : %04X",dx2,sregs.r_ax);
/* Read string */
sregs.r_cx = cnt = sregs.r_ax;
sregs.r_ax = 0x0F00;
sregs.r_dx = dx2;
sregs.r_es = FP_SEG(buff);
sregs.r_bx = FP_OFF(buff);
intr(0x14,&sregs);
printf("\nChnl %d read data : ",dx2);
for(x=0; x<cnt; x++)
printf("%c",buff[x]);
}