home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR2
/
DIGIPROG.ZIP
/
FCT1.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-04-01
|
1KB
|
61 lines
#include <dos.h>
#include <stdio.h>
main()
{
struct REGPACK sregs;
int y,x,numbytes,dx,hexflg=0, numflg=0, hex, num=-1;
unsigned char byte;
union REGS regs;
printf("\nEnter DX : ");
scanf("%d",&dx); while(kbhit()) getch();
printf("\nA)SCII or H)ex : ");
if(toupper(getch()) == 'H') hexflg=1;
printf("\nSpecify D)ata to send N)umber of bytes to send : ");
{
if(toupper(getch()) == 'N')
{
numflg++;
printf("\nEnter Number of Bytes to Send : ");
scanf("%x", &num); while(kbhit()) getch();
printf("\nSpecify Byte to Send : ");
if(hexflg) scanf("%x",&hex);
else byte=getche();
}
}
if(hexflg && !numflg) printf("\nEnter 0xFFFF to Quit");
else if(!hexflg && !numflg) printf("\nEnter ESC to Quit ");
while(num--)
{
printf("\nEnter byte : ");
if(hexflg) goto hexcode;
if(!numflg) byte = getch();
if(byte == 0x1b) break;
regs.h.ah = 0x01;
regs.h.al = byte;
regs.x.dx = dx;
printf("Send - %c ",byte);
int86(0x14,®s,®s);
printf("Return - AL : %c AH : %02X",regs.h.al,regs.h.ah);
continue;
hexcode:
if(!numflg) scanf("%x",&hex);
if(hex == 0xFFFF) break;
regs.h.ah = 0x01;
regs.h.al = (char)hex;
regs.x.dx = dx;
printf(" Send - %02X ",(char)hex);
int86(0x14,®s,®s);
printf("Return - AL : %02x AH : %02X",regs.h.al,regs.h.ah);
}
}