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

  1.  
  2. #include <dos.h>
  3. #include <stdio.h>
  4.  
  5. main()
  6. {
  7.  
  8.     struct REGPACK  sregs;
  9.     union REGS         regs;
  10.  
  11.     int                y,x,numbytes,tdx,rdx,hex=0;
  12.     unsigned char    buff[0x200];
  13.  
  14.  
  15.     printf("\nEnter Tx DX : ");
  16.     scanf("%d",&tdx);
  17.  
  18.     printf("\nEnter Rx DX : ");
  19.     scanf("%d",&rdx);
  20.  
  21.  
  22.     for(x=0; x<0x100; x++)
  23.     {
  24.  
  25.         regs.h.ah = 0x01;                    /* Write character */
  26.         regs.h.al = (unsigned char) x;
  27.         regs.x.dx = tdx;
  28.         int86(0x14,®s,®s);
  29.     }
  30.  
  31.     printf("\nRx'ed hex data using fct 02h");
  32.  
  33.     for(x=0; x<0x100; x++)
  34.     {
  35.         if( !(x%0x10) ) printf("\n");
  36.  
  37.         regs.h.ah = 0x02;                     /* Read Character */
  38.         regs.x.dx = rdx;
  39.         int86(0x14,®s,®s);
  40.         if(regs.h.ah & 0x80) { printf("\n Timeout ... "); break;}
  41.         printf("%02X  ",regs.h.al);
  42.  
  43.     }
  44.  
  45.     printf("\n\nPress any Key for read string"); getch();
  46.  
  47.     for(x=0; x<0x100; x++)
  48.     {
  49.  
  50.         regs.h.ah = 0x01;                    /* Write Character */
  51.         regs.h.al = (unsigned char) x;
  52.         regs.x.dx = tdx;
  53.         int86(0x14,®s,®s);
  54.     }
  55.  
  56.     printf("\nRx'ed hex data using fct 0fh\n");
  57.  
  58.     sregs.r_dx = rdx;
  59.     sregs.r_ax = 0x0f00;                    /* Read String */
  60.     sregs.r_cx = 0x100;
  61.     sregs.r_es = _DS;
  62.     sregs.r_bx = FP_OFF(buff);
  63.     intr(0x14,&sregs);
  64.  
  65.     for(x=0; x<0x100; x++)
  66.     {
  67.         if( !(x%0x10) ) printf("\n");
  68.  
  69.         printf("%02X  ",buff[x]);
  70.  
  71.     }
  72.  
  73. }