home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR2
/
DIGIPROG.ZIP
/
FCT1F.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-23
|
2KB
|
87 lines
#include <dos.h>
#include <stdio.h>
main()
{
struct REGPACK sregs;
int y,x,numbytes,dx,quit,xx,yy,mask;
union REGS regs;
/*struct SREGS sregs;*/
clrscr();
printf("\nEnter DX : ");
scanf("%d",&dx); while(kbhit()) getch();
regs.h.ah = 0x1f;
regs.h.al = 0;
regs.x.dx = dx;
printf("A) Enable Events B) Disable Events : ");
if(toupper(getch()) == 'A')
{
printf("\nEnter Selection To Toggle ");
printf("\nA) Event on Break : "); xx=wherex(); yy=wherey();
printf("\nB) Event on TxLow : ");
printf("\nC) Event on TxBuff Empty : ");
printf("\nD) Event on RX data present : ");
printf("\nE) Event on CTS change : ");
printf("\nF) Event on DSR change : ");
printf("\nG) Event on RI change : ");
printf("\nH) Event on DCD change : ");
printf("\nQ)uit : ");
quit = mask = 0;
Toggle(mask,xx,yy);
while(!quit)
{
switch(toupper(getch()))
{
case 'A' : mask ^= 0x01; break;
case 'B' : mask ^= 0x02; break;
case 'C' : mask ^= 0x04; break;
case 'D' : mask ^= 0x08; break;
case 'E' : mask ^= 0x1000; break;
case 'F' : mask ^= 0x2000; break;
case 'G' : mask ^= 0x4000; break;
case 'H' : mask ^= 0x8000; break;
case 'Q' : quit = 1; break;
}
Toggle(mask,xx,yy);
}
regs.h.al = mask & 0x00ff;
if(mask & 0xf000) mask |= 0x20; /* Set mdm chng IRQ */
else mask &= 0xffdf; /* Clear mdm chng IRQ */
regs.h.al = mask & 0x00ff;
regs.h.bl = mask >> 8;
}
else
regs.h.al = 0;
printf("\nCall - AH : %02X AL : %02X BL : %02X",
regs.h.ah, regs.h.al, regs.h.bl);
int86(0x14,®s,®s);
}
Toggle(unsigned mask,int xx, int yy)
{
int x,y;
char *Str[2] = {"OFF"," ON"};
x = wherex(); y=wherey();
gotoxy(xx,yy++); printf("%s",Str[mask&0x1]);
gotoxy(xx,yy++); printf("%s",Str[(mask&0x2)>>1]);
gotoxy(xx,yy++); printf("%s",Str[(mask&0x4)>>2]);
gotoxy(xx,yy++); printf("%s",Str[(mask&0x8)>>3]);
gotoxy(xx,yy++); printf("%s",Str[(mask&0x1000)>>12]);
gotoxy(xx,yy++); printf("%s",Str[(mask&0x2000)>>13]);
gotoxy(xx,yy++); printf("%s",Str[(mask&0x4000)>>14]);
gotoxy(xx,yy++); printf("%s",Str[(mask&0x8000)>>15]);
gotoxy(x,y);
}