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

  1. /* ╓≈╠Γú║║║╫╓╧╘╩╛ */
  2. /*
  3.    1    WriteChineseChar    ╨┤║║╫╓(╙╨╩⌠╨╘)      AH=09H
  4.    2    WriteCharNoAttr     ╨┤║║╫╓(╬▐╩⌠╨╘)      AH=0AH
  5.    3    WriteChineseString  ╨┤║║╫╓┤«(TTY╖╜╩╜)   AH=0EH
  6.    4    WriteChineseStrApp  ╨┤║║╫╓┤«(╙╨╩⌠╨╘)    AH=13H
  7. */
  8.  
  9. #include                "dos.h"
  10. #include                "stdio.h"
  11.  
  12. typedef                 unsigned char   BYTE;
  13. typedef                 unsigned int    WORD;
  14.  
  15. void GotoXY(int Row,int Col);
  16. void WriteChineseChar(int Row,int Col,int Color,WORD Hz)
  17. {
  18.    union REGS regs;
  19.  
  20.    GotoXY(Row,Col);
  21.    regs.h.ah = 9;
  22.    regs.h.al = Hz & 0xff;
  23.    regs.h.bh = 0;
  24.    regs.h.bl = Color;
  25.    regs.x.cx = 1;
  26.    int86(0x10,®s,®s);
  27.    GotoXY(Row,Col+1);
  28.    regs.h.ah = 9;
  29.    regs.h.al = Hz >> 8;
  30.    regs.h.bh = 0;
  31.    regs.h.bl = Color;
  32.    regs.x.cx = 1;
  33.    int86(0x10,®s,®s);
  34. }
  35.  
  36. void WriteCharNoAttr(int Row,int Col,BYTE ch)
  37. {
  38.    union REGS regs;
  39.  
  40.    GotoXY(Row,Col);
  41.    regs.h.ah = 0xa;
  42.    regs.h.al = ch;
  43.    regs.h.bh = 0;
  44.    regs.x.cx = 1;
  45.    int86(0x10,®s,®s);
  46. }
  47.  
  48. void WriteChineseString(int Row,int Col,BYTE *HzString)
  49. {
  50.    union REGS regs;
  51.  
  52.    GotoXY(Row,Col);
  53.    while (*HzString) {
  54.       regs.h.ah = 0xe;
  55.       regs.h.al = *HzString++;
  56.       regs.h.bh = 0;
  57.       int86(0x10,®s,®s);
  58.       }
  59. }
  60.  
  61. void WriteChineseStrApp(int Row,int Col,int Color,BYTE far *HzString)
  62. {
  63.    _BX = Color & 0xff;
  64.    _DX = (Row << 8) + (Col & 0xff);
  65.    _CX = strlen(HzString);
  66.    _BP = FP_OFF(HzString);
  67.    _ES = _DS;
  68.    _AX = 0x1300;
  69.    geninterrupt(0x10);
  70. }
  71.  
  72. void SetDisplayMode(BYTE Mode)
  73. {
  74.    union REGS regs;
  75.  
  76.    regs.h.ah = 0;
  77.    regs.h.al = Mode;
  78.    int86(0x10,®s,®s);
  79. }
  80.  
  81. void GotoXY(int Row,int Col)
  82. {
  83.    union REGS regs;
  84.  
  85.    regs.h.ah = 2;
  86.    regs.h.bh = 0;
  87.    regs.h.dh = Row;
  88.    regs.h.dl = Col;
  89.    int86(0x10,®s,®s);
  90. }
  91.  
  92. void main()
  93. {
  94.    int          i;
  95.    WORD         Hz;
  96.    BYTE         s[] = "╧ú═√║║╫╓╧╡═│";
  97.  
  98.    SetDisplayMode(0x3);
  99.  
  100.    for (i = 0; i < 6; i++) {
  101.       WriteChineseChar(12,20+i*2,0x4F,*(WORD *)&s[i*2]);
  102.       }
  103.  
  104.    WriteChineseString(14,20,"TTY╖╜╩╜╧╘╩╛╡─║║╫╓╫╓╖√┤«");
  105.  
  106.    WriteChineseStrApp(16,20,0x3e,"░┤╚╬╥╗╝ⁿ╖╡╗╪DOS ");
  107.  
  108.    WriteCharNoAttr(16,35,'!');
  109.  
  110.    getch();
  111.    SetDisplayMode(0x3);
  112.  
  113. }
  114.