home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR2
/
DIGIPROG.ZIP
/
FCT4.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-29
|
2KB
|
91 lines
#include <dos.h>
#include <stdio.h>
main()
{
struct REGPACK sregs;
int y,x,numbytes,dx;
union REGS regs;
/*struct SREGS sregs;*/
/* special char - <CR> */
regs.x.ax = regs.x.bx = regs.x.cx = 0;
regs.h.ah = 0x04;
printf("\nEnter DX : ");
scanf("%d",&dx); while(kbhit()) getch();
printf("Set Break ? (Y/*) : ");
if(toupper(getch()) == 'Y') regs.h.al = 1;
Par:
printf("\nSelect Parity N)one O)dd E)ven : ");
switch(toupper(getch()))
{
case 'N' : regs.h.bh |= 0x0; break;
case 'O' : regs.h.bh |= 0x1; break;
case 'E' : regs.h.bh |= 0x2; break;
default : goto Par;
}
SBits:
printf("\nSelect Stop Bits 1) 2) : ");
switch(toupper(getch()))
{
case '1' : regs.h.bl |= 0x0; break;
case '2' : regs.h.bl |= 0x1; break;
default : goto SBits;
}
DBits:
printf("\nSelect Data Bits 5) 6) 7) 8) : ");
switch(toupper(getch()))
{
case '5' : regs.h.ch |= 0x0; break;
case '6' : regs.h.ch |= 0x1; break;
case '7' : regs.h.ch |= 0x2; break;
case '8' : regs.h.ch |= 0x3; break;
default : goto DBits;
}
Baud:
printf("\nSelect Parity A) 110 B) 150 C) 300 D) 600 E) 1200 F) 2400 \n");
printf(" G) 4800 H) 9600 I) 19200 J) 38400 K) 57600 L) 76800 \n");
printf(" M) 115.2k N) 50 O) 75 P) 134 Q) 200 R) 1800 ");
switch(toupper(getch()))
{
case 'A' : regs.h.cl = 0x00; break;
case 'B' : regs.h.cl = 0x01; break;
case 'C' : regs.h.cl = 0x02; break;
case 'D' : regs.h.cl = 0x03; break;
case 'E' : regs.h.cl = 0x04; break;
case 'F' : regs.h.cl = 0x05; break;
case 'G' : regs.h.cl = 0x06; break;
case 'H' : regs.h.cl = 0x07; break;
case 'I' : regs.h.cl = 0x08; break;
case 'J' : regs.h.cl = 0x09; break;
case 'K' : regs.h.cl = 0x0A; break;
case 'L' : regs.h.cl = 0x0B; break;
case 'M' : regs.h.cl = 0x0C; break;
case 'N' : regs.h.cl = 0x0D; break;
case 'O' : regs.h.cl = 0x0E; break;
case 'P' : regs.h.cl = 0x0F; break;
case 'Q' : regs.h.cl = 0x10; break;
case 'R' : regs.h.cl = 0x11; break;
default : goto Par;
}
regs.x.dx = dx;
printf("\n Call - AH : %02X AL : %02X ",regs.h.ah, regs.h.al);
printf("\n - BH : %02X BL : %02X ",regs.h.bh, regs.h.bl);
printf("\n - CH : %02X CL : %02X ",regs.h.ch, regs.h.cl);
int86(0x14,®s,®s);
printf("\n Return - AH : %02X AL : %02X",regs.h.ah,regs.h.al);
}