home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR2 / DIGIPROG.ZIP / FCT2.C < prev    next >
C/C++ Source or Header  |  1993-03-29  |  645b  |  40 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,hex=0;
  11.  
  12.  
  13. union REGS regs;
  14. /*struct SREGS sregs;*/
  15.  
  16. /* special char - <CR> */
  17.  
  18.  
  19. printf("\nEnter DX : ");
  20. scanf("%d",&dx); while(kbhit()) getch();
  21.  
  22. printf("A)SCII or H)ex : ");
  23. if(toupper(getch()) == 'H') hex++;
  24.  
  25. printf("\nEnter # bytes : ");
  26. scanf("%x",&numbytes); while(kbhit()) getch();
  27.  
  28. for(x=0; x<numbytes; x++)
  29. {
  30.  
  31.     regs.h.ah = 0x02;
  32.     regs.x.dx = dx;
  33.     int86(0x14,®s,®s);
  34.     if(hex)
  35.         printf("AH : %02X  AL : %02X    ",regs.h.ah,regs.h.al);
  36.     else
  37.         printf("AH : %02X  AL : %c     ",regs.h.ah,regs.h.al);
  38. }
  39.  
  40. }