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

  1. /* ╓≈╠Γú║╞┴─╗╣÷╢»╙δ╓▒╜╙╨┤╞┴ */
  2. /*
  3.    1    ScrollUpScreen          ╞┴─╗╔╧╣÷        AH=06H
  4.    2    ScrollDownScreen        ╞┴─╗╧┬╣÷        AH=07H
  5.    3    ScrollLeftScreen        ╞┴─╗╫≤╣÷        AX=FF0CH
  6.    4    ScrollRightScreen       ╞┴─╗╙╥╣÷        AX=FF0DH
  7.    5    SetDirectVideoStatus    ╓├╓▒╜╙╨┤╞┴╫┤╠¼  AX=FF0FH,BL=00H
  8.    6    GetDirectVideoStatus    ╢┴╓▒╜╙╨┤╞┴╫┤╠¼  AX=FF0FH,BL=80H
  9. */
  10. #include                "dos.h"
  11. #include                "stdio.h"
  12.  
  13. typedef                 unsigned char   BYTE;
  14. typedef                 unsigned int    WORD;
  15.  
  16. void ScrollUpScreen(int Lines,int Color,int R1,int C1,int R2,int C2)
  17. {
  18.    union REGS regs;
  19.  
  20.    regs.h.ah = 6;
  21.    regs.h.al = Lines;
  22.    regs.h.bh = Color;
  23.    regs.h.ch = R1;
  24.    regs.h.cl = C1;
  25.    regs.h.dh = R2;
  26.    regs.h.dl = C2;
  27.    int86(0x10,®s,®s);
  28. }
  29.  
  30. void ScrollDownScreen(int Lines,int Color,int R1,int C1,int R2,int C2)
  31. {
  32.    union REGS regs;
  33.  
  34.    regs.h.ah = 7;
  35.    regs.h.al = Lines;
  36.    regs.h.bh = Color;
  37.    regs.h.ch = R1;
  38.    regs.h.cl = C1;
  39.    regs.h.dh = R2;
  40.    regs.h.dl = C2;
  41.    int86(0x10,®s,®s);
  42. }
  43.  
  44. void ScrollLeftScreen(int Lines,int Color,int R1,int C1,int R2,int C2)
  45. {
  46.    union REGS regs;
  47.  
  48.    regs.x.ax = 0xff0c;
  49.    regs.h.bh = Color;
  50.    regs.h.bl = Lines;
  51.    regs.h.ch = R1;
  52.    regs.h.cl = C1;
  53.    regs.h.dh = R2;
  54.    regs.h.dl = C2;
  55.    int86(0x10,®s,®s);
  56. }
  57.  
  58. void ScrollRightScreen(int Lines,int Color,int R1,int C1,int R2,int C2)
  59. {
  60.    union REGS regs;
  61.  
  62.    regs.x.ax = 0xff0d;
  63.    regs.h.bh = Color;
  64.    regs.h.bl = Lines;
  65.    regs.h.ch = R1;
  66.    regs.h.cl = C1;
  67.    regs.h.dh = R2;
  68.    regs.h.dl = C2;
  69.    int86(0x10,®s,®s);
  70. }
  71.  
  72. void SetDirectVideoStatus(int EnableDirectVideo)
  73. {
  74.    union REGS regs;
  75.  
  76.    regs.x.ax = 0xff0f;
  77.    regs.h.bl = 0;
  78.    regs.h.bh = EnableDirectVideo;
  79.    int86(0x10,®s,®s);
  80. }
  81.  
  82. int GetDirectVideoStatus(void)
  83. {
  84.    union REGS regs;
  85.  
  86.    regs.x.ax = 0xff0f;
  87.    regs.h.bl = 0x80;
  88.    int86(0x10,®s,®s);
  89.    return regs.h.al;
  90. }
  91.  
  92. void FillScreen(BYTE ch,int Color,int R1,int C1,int R2,int C2)
  93. {
  94.    int          Row,Col;
  95.  
  96.    for (Row = R1; Row <= R2; Row++) {
  97.       for (Col = C1; Col <= C2; Col++) {
  98.          *(char far *)MK_FP(0xb800,(Row*80+Col)*2) = ch;
  99.          *(char far *)MK_FP(0xb800,(Row*80+Col)*2+1) = Color;
  100.          }
  101.       }
  102. }
  103.  
  104. void SetDisplayMode(BYTE Mode)
  105. {
  106.    union REGS regs;
  107.  
  108.    regs.h.ah = 0;
  109.    regs.h.al = Mode;
  110.    int86(0x10,®s,®s);
  111. }
  112.  
  113. void main()
  114. {
  115.    int SaveDV;
  116.  
  117.    SaveDV = GetDirectVideoStatus();
  118.    SetDirectVideoStatus(1);
  119.    SetDisplayMode(0x3);
  120.  
  121.    FillScreen(0x7f,0x3f,6,20,18,60);
  122.    getch();
  123.    ScrollUpScreen(0,0x17,7,21,17,59);
  124.    getch();
  125.    FillScreen(0x25,0x2e,7,21,17,59);
  126.    ScrollUpScreen(4,0x47,7,21,17,59);
  127.    getch();
  128.    ScrollDownScreen(2,0x5f,7,21,17,59);
  129.    getch();
  130.    ScrollDownScreen(0,0x82,10,22,14,58);
  131.    getch();
  132.  
  133.    FillScreen(0x5c,0x71,5,10,18,70);
  134.    ScrollLeftScreen(0,0x5f,9,24,13,56);
  135.    getch();
  136.    FillScreen(0x23,0x38,10,25,12,55);
  137.    ScrollLeftScreen(8,0x2e,10,25,12,55);
  138.    getch();
  139.    ScrollRightScreen(4,0x4f,10,25,12,55);
  140.    getch();
  141.    ScrollRightScreen(0,0x17,6,11,17,69);
  142.    getch();
  143.  
  144.    SetDisplayMode(0x3);
  145.    SetDirectVideoStatus(SaveDV);
  146.  
  147. }
  148.