home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / pibterm / pibt41s4.arc / SCROLL.MOD < prev    next >
Text File  |  1987-11-27  |  4KB  |  70 lines

  1. (*----------------------------------------------------------------------*)
  2. (*               Scroll --- Scroll section of screen                    *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE Scroll( Y1, Y2, X1, X2, Nlines, FG, BG : INTEGER );
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*   Procedure: Scroll                                                  *)
  10. (*                                                                      *)
  11. (*   Purpose:   Scrolls portion of screen.                              *)
  12. (*                                                                      *)
  13. (*   Calling sequence:                                                  *)
  14. (*                                                                      *)
  15. (*      Scroll( Y1, Y2, X1, X2, Nlines, FG, BG : INTEGER );             *)
  16. (*                                                                      *)
  17. (*          (X1,Y1); (X2,Y2) --- corners of region to scroll            *)
  18. (*          Nlines           --- number of lines to scroll              *)
  19. (*          (FG,BG)          --- foreground and background colors       *)
  20. (*                                                                      *)
  21. (*   Calls:  INTR                                                       *)
  22. (*                                                                      *)
  23. (*   Remarks:                                                           *)
  24. (*                                                                      *)
  25. (*      The indicated portion of the screen is scrolled up or down.     *)
  26. (*      If Nlines > 0, then the screen is scrolled up.  If Nlines < 0,  *)
  27. (*      the screen is scrolled down.  Setting Nlines to zero blanks     *)
  28. (*      the entire region.                                              *)
  29. (*                                                                      *)
  30. (*                                                                      *)
  31. (*----------------------------------------------------------------------*)
  32.  
  33. BEGIN (* Scroll *)
  34.  
  35. INLINE(
  36.   $55                    {          PUSH   BP                ;Save BP}
  37.                          {;}
  38.   /$8A/$8E/>X1           {          MOV    Cl,[BP+>X1]       ;Get screen area to clear}
  39.   /$FE/$C9               {          DEC    Cl}
  40.   /$8A/$AE/>Y1           {          MOV    Ch,[BP+>Y1]}
  41.   /$FE/$CD               {          DEC    Ch}
  42.   /$8A/$96/>X2           {          MOV    Dl,[BP+>X2]}
  43.   /$FE/$CA               {          DEC    Dl}
  44.   /$8A/$B6/>Y2           {          MOV    Dh,[BP+>Y2]}
  45.   /$FE/$CE               {          DEC    Dh}
  46.                          {;}
  47.   /$8A/$BE/>BG           {          MOV    Bh,[BP+>BG]       ;Get color for scrolled area}
  48.   /$80/$E7/$7F           {          AND    Bh,$7F            ;Clear high-order bit.}
  49.   /$D0/$E7               {          SHL    Bh,1}
  50.   /$D0/$E7               {          SHL    Bh,1}
  51.   /$D0/$E7               {          SHL    Bh,1}
  52.   /$D0/$E7               {          SHL    Bh,1}
  53.   /$0A/$BE/>FG           {          OR     Bh,[BP+>FG]}
  54.                          {;}
  55.   /$8B/$86/>NLINES       {          MOV    Ax,[BP+>NLines]   ;Get # of lines to scroll}
  56.   /$3D/$00/$00           {          CMP    Ax,0              ;Figure direction of scroll}
  57.   /$7D/$08               {          JGE    Scroll1}
  58.   /$F7/$D8               {          NEG    Ax                ;ABS( Nlines )}
  59.   /$0D/$00/$07           {          OR     Ax,$0700}
  60.   /$E9/$03/$00           {          JMP    Scroll2}
  61.                          {;}
  62.   /$0D/$00/$06           {Scroll1:  OR     Ax,$0600}
  63.                          {;}
  64.   /$CD/$10               {Scroll2:  INT    $10               ;Call BIOS video interrupt}
  65.                          {;}
  66.   /$5D                   {          POP    BP                ;Restore BP}
  67. );
  68.  
  69. END  (* Scroll *);
  70.