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

  1. /* ╓≈╠Γú║╠ß╩╛╨╨╧╘╩╛╣▄└φ */
  2. /*
  3.    1    SetPromptLineColor      ╓├╠ß╩╛╨╨╤╒╔½    AX=FF0FH,BL=8BH
  4.    2    GetPromptLineColor      ╢┴╠ß╩╛╨╨╤╒╔½    AX=FF0FH,BL=0BH
  5.    3    ClearPromptLine         ╟σ╠ß╩╛╨╨        AX=FF10H,BL=00H
  6.    4    WritePromptMoreChar     ╨┤╠ß╩╛╨╨╫╓╖√    AX=FF10H,BL=01H
  7.    5    SetPromptCursor         ╓├╠ß╩╛╨╨╣Γ▒Ω    AX=FF10H,BL=02H
  8.    6    WritePromptChar         ╨┤╠ß╩╛╨╨╫╓╖√    AX=FF10H,BL=03H
  9.    7    InitPromptLine          ╘╩╨φ╠ß╩╛╨╨      AX=FF07H,INT16H
  10.    8    DispPromptStr           ╨┤╓╪┬δ╫╓╖√┤«    AX=FF08H,INT16H
  11.    9    DisablePromptLine       ╜√╓╣╠ß╩╛╨╨      AX=FF0BH,INT16H
  12. */
  13. #include                "dos.h"
  14. #include                "stdio.h"
  15.  
  16. typedef                 unsigned char   BYTE;
  17. typedef                 unsigned int    WORD;
  18.  
  19. void SetPromptLineColor(int Color1,int Color2,int Color3,int Color4)
  20. {
  21.    union REGS regs;
  22.  
  23.    regs.x.ax = 0xff0f;
  24.    regs.h.bl = 0x8b;
  25.    regs.h.cl = Color1;
  26.    regs.h.ch = Color2;
  27.    regs.h.dl = Color3;
  28.    regs.h.dh = Color4;
  29.    int86(0x10,®s,®s);
  30. }
  31.  
  32. void GetPromptLineColor(int *Color1,int *Color2,int *Color3,int *Color4)
  33. {
  34.    union REGS regs;
  35.  
  36.    regs.x.ax = 0xff0f;
  37.    regs.h.bl = 0x0b;
  38.    int86(0x10,®s,®s);
  39.    *Color1 = (int)regs.h.al;
  40.    *Color2 = (int)regs.h.ah;
  41.    *Color3 = (int)regs.h.dl;
  42.    *Color4 = (int)regs.h.dh;
  43. }
  44.  
  45. void ClearPromptLine(int Color)
  46. {
  47.    union REGS regs;
  48.  
  49.    regs.x.ax = 0xff10;
  50.    regs.h.bl = 0;
  51.    regs.h.bh = Color;
  52.    int86(0x10,®s,®s);
  53. }
  54.  
  55. void WritePromptMoreChar(BYTE ch,int Color,int Count)
  56. {
  57.    union REGS regs;
  58.  
  59.    regs.x.ax = 0xff10;
  60.    regs.h.bl = 1;
  61.    regs.h.bh = Color;
  62.    regs.x.cx = Count;
  63.    regs.h.dl = ch;
  64.    int86(0x10,®s,®s);
  65. }
  66.  
  67. void SetPromptCursor(int CurPos)
  68. {
  69.    union REGS regs;
  70.  
  71.    regs.x.ax = 0xff10;
  72.    regs.h.bl = 2;
  73.    regs.h.dl = CurPos;
  74.    int86(0x10,®s,®s);
  75. }
  76.  
  77. void WritePromptChar(BYTE ch,int Color)
  78. {
  79.    union REGS regs;
  80.  
  81.    regs.x.ax = 0xff10;
  82.    regs.h.bl = 3;
  83.    regs.h.bh = Color;
  84.    regs.h.dl = ch;
  85.    int86(0x10,®s,®s);
  86. }
  87.  
  88. void InitPromptLine(void)
  89. {
  90.    union REGS regs;
  91.  
  92.    regs.x.ax = 0xff07;
  93.    int86(0x16,®s,®s);
  94. }
  95.  
  96. void DispPromptStr(BYTE * SelectString)
  97. {
  98.    _AX = 0xff08;
  99.    _DX = FP_OFF(SelectString);
  100.    geninterrupt(0x16);
  101. }
  102.  
  103. void DisablePromptLine(void)
  104. {
  105.    union REGS regs;
  106.  
  107.    regs.x.ax = 0xff0b;
  108.    int86(0x16,®s,®s);
  109. }
  110.  
  111. void main()
  112. {
  113.     int         i,Color1,Color2,Color3,Color4;
  114.     BYTE        PmtStr[] = " ╧ú═√║║╫╓╧╡═│í║UCDOS 6.0í╗▒Ω╫╝░µ";
  115.     BYTE        InputStr[] = "hello!       ";
  116.  
  117.     GetPromptLineColor(&Color1,&Color2,&Color3,&Color4);
  118.  
  119.     SetPromptLineColor(0x17,0x1e,0x1c,0x1f);
  120.     InitPromptLine();
  121.     getchar();
  122.     DispPromptStr("1╠ß 2╩╛ 3╨╨ 4╧╘ 5╩╛ 6║▄ 7╝≥ 8╡Ñ 9úí 0ú┐");
  123.     SetPromptCursor(15);
  124.     for (i = 0; i < 13; i++) {
  125.        WritePromptChar(InputStr[i],0x1c);
  126.        }
  127.     getch();
  128.  
  129.     ClearPromptLine(0x1d);
  130.     SetPromptCursor(0);
  131.     WritePromptMoreChar('*',0x5f,80);
  132.     SetPromptCursor(20);
  133.     for (i = 0; i < strlen(PmtStr); i++) {
  134.        WritePromptChar(PmtStr[i],(PmtStr[i] > 0xa0 ? 0x70 : 0x74));
  135.        }
  136.     getch();
  137.  
  138.     SetPromptLineColor(Color1,Color2,Color3,Color4);
  139.     DisablePromptLine();
  140. }
  141.