home *** CD-ROM | disk | FTP | other *** search
/ Computer Installation Guide - Dragon Clan Series / CD2.iso / ucdos70 / 5 / SRC.ZIP / API / APITEST7.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-25  |  1.1 KB  |  53 lines

  1. /* ╓≈╠Γú║║║╫╓╩Σ╚δ */
  2. /*
  3.    1            ReadChar        ╢┴╥╗╕÷╫╓╖√      AH=00H
  4.    2            CheckKeyboard   ╝∞▓Θ╝ⁿ┼╠╗║│σ╟°  AH=01H
  5. */
  6. #include                "dos.h"
  7. #include                "stdio.h"
  8.  
  9. typedef                 unsigned char   BYTE;
  10. typedef                 unsigned int    WORD;
  11.  
  12. BYTE ReadChar(void)
  13. {
  14.    union REGS regs;
  15.  
  16.    regs.h.ah = 0;
  17.    int86(0x16,®s,®s);
  18.    return regs.h.al;
  19. }
  20.  
  21. int CheckKeyBoard(void)
  22. {
  23.     union REGS regs;
  24.  
  25.     regs.h.ah = 1;
  26.     int86(0x16,®s,®s);
  27.     return (regs.x.flags & 0x40) ? 0 : 1;
  28. }
  29.  
  30. void InitPromptLine(void)
  31. {
  32.    union REGS regs;
  33.  
  34.    regs.x.ax = 0xff07;
  35.    int86(0x16,®s,®s);
  36. }
  37.  
  38. void main()
  39. {
  40.    BYTE         FirstByte,SecondByte;
  41.  
  42.    InitPromptLine();
  43.    printf("╩Σ╚δ╥╗╕÷║║╫╓:");
  44.    while (!CheckKeyBoard());
  45.    FirstByte = ReadChar();
  46.    while (!CheckKeyBoard());
  47.    SecondByte = ReadChar();
  48.    printf("%c%c\n",FirstByte,SecondByte);
  49.    printf("╩Σ╚δ║║╫╓╬¬ú║%c%c\n",FirstByte,SecondByte);
  50.    printf("─┌┬δ╬¬%2x%2xh\n",FirstByte,SecondByte);
  51.    while (CheckKeyBoard()) ReadChar();
  52. }
  53.