home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR2 / DIGIPROG.ZIP / FCTFB.C < prev    next >
C/C++ Source or Header  |  1993-03-30  |  1KB  |  69 lines

  1.  
  2. #include <dos.h>
  3. #include <stdio.h>
  4.  
  5. main()
  6. {
  7.  
  8. struct REGPACK  sregs;
  9.  
  10.     int    y,x,numbytes,dx,quit,xx,yy;
  11.     char    byte;
  12.  
  13.     union REGS regs;
  14.     /*struct SREGS sregs;*/
  15.  
  16.     clrscr();
  17.     printf("\nEnter DX : ");
  18.     scanf("%d",&dx); while(kbhit()) getch();
  19.  
  20.     regs.h.ah = 0xfb;
  21.     regs.h.al = 0;
  22.  
  23.     printf("\nEnter Selection To Toggle ");
  24.     printf("\nA) DTR Line    : "); xx=wherex(); yy=wherey();
  25.     printf("\nB) RTS Line    : ");
  26.     printf("\nC) CTS TX Flow : ");
  27.     printf("\nD) DSR TX Flow : ");
  28.     printf("\nE) DCD TX Flow : ");
  29.     printf("\nQ)uit          : ");
  30.  
  31.     quit = byte = 0;
  32.     Toggle(byte,xx,yy);
  33.  
  34.     while(!quit)
  35.     {
  36.         switch(toupper(getch()))
  37.         {
  38.             case 'A' : byte ^= 0x01; break;
  39.             case 'B' : byte ^= 0x02; break;
  40.             case 'C' : byte ^= 0x10; break;
  41.             case 'D' : byte ^= 0x20; break;
  42.             case 'E' : byte ^= 0x80; break;
  43.             case 'Q' : quit = 1; break;
  44.         }
  45.         Toggle(byte,xx,yy);
  46.     }
  47.  
  48.     regs.h.al = byte;
  49.     regs.x.dx = dx;
  50.     printf("\nCall   - AH : %02X     AL : %02X",regs.h.ah, regs.h.al);
  51.     int86(0x14,®s,®s);
  52.  
  53.  
  54. }
  55.  
  56. Toggle(unsigned char al,int xx, int yy)
  57. {
  58.     int x,y;
  59.     char    *Str[2] = {"OFF"," ON"};
  60.  
  61.     x = wherex(); y=wherey();
  62.  
  63.     gotoxy(xx,yy++); printf("%s",Str[al&0x1]);
  64.     gotoxy(xx,yy++); printf("%s",Str[(al&0x2)>>1]);
  65.     gotoxy(xx,yy++); printf("%s",Str[(al&0x10)>>4]);
  66.     gotoxy(xx,yy++); printf("%s",Str[(al&0x20)>>5]);
  67.     gotoxy(xx,yy++); printf("%s",Str[(al&0x80)>>7]);
  68.     gotoxy(x,y);
  69. }