home *** CD-ROM | disk | FTP | other *** search
/ Programmer Power Tools / Programmer Power Tools.iso / pibterm / pibt41s4.arc / VIDINTP.MOD < prev    next >
Encoding:
Text File  |  1988-01-05  |  29.3 KB  |  451 lines

  1. (*----------------------------------------------------------------------*)
  2. (*  Video_Interrupt_Handler --- Replaces int $10 video handler          *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE Video_Interrupt_Handler(
  6.           Flags, CS, IP, AX, BX, CX, DX, SI, DI, DS, ES, BP : WORD );
  7.    (* Interrupt; *)
  8.  
  9. (*----------------------------------------------------------------------*)
  10. (*                                                                      *)
  11. (*     Procedure:  Video_Interrupt_Handler                              *)
  12. (*                                                                      *)
  13. (*     Purpose:    Replaces standard interrupt $10 video driver         *)
  14. (*                                                                      *)
  15. (*     Calling Sequence:                                                *)
  16. (*                                                                      *)
  17. (*                 -- Called by system only!                            *)
  18. (*     Remarks:                                                         *)
  19. (*                                                                      *)
  20. (*        This routine replaces the standard interrupt $10 video        *)
  21. (*        driver so that non-flickering scrolls can be performed.       *)
  22. (*                                                                      *)
  23. (*----------------------------------------------------------------------*)
  24.  
  25. CONST
  26.    ClrMaxVert  = 420         (* Max chars cleared during vertical retrace *);
  27.    MaxVert     = 210         (* Max chars moved during vertical retrace   *);
  28.    MaxHoriz    = 196;
  29.    VRetrace    = $08;
  30.    HRetrace    = $01;
  31.  
  32. BEGIN (* Video_Interrupt_Handler *)
  33.  
  34. INLINE(
  35.   $FB/                         {         STI                             ; Enable interrupts}
  36.                                {;}
  37.   $8B/$46/$10/                 {         MOV     AX,[BP+16]              ; Pick up arguments for INT $ 10}
  38.   $8B/$5E/$0E/                 {         MOV     BX,[BP+14]}
  39.   $8B/$4E/$0C/                 {         MOV     CX,[BP+12]}
  40.   $8B/$56/$0A/                 {         MOV     DX,[BP+10]}
  41.                                {;}
  42.   $80/$FC/$00/                 {         CMP     AH,0                    ; Check for mode switch}
  43.   $75/$05/                     {         JNE     ChkMode}
  44.                                {;}
  45.   $A2/>VIDEO_MODE/             {         MOV     [<Video_Mode],AL        ; Remember new mode}
  46.   $EB/$2E/                     {         JMP     SHORT NotOurs           ; and let bios change the mode}
  47.                                {;}
  48.                                {ChkMode:}
  49.   $80/$3E/>VIDEO_MODE/$03/     {         CMP     BYTE [<Video_Mode],3    ; We don't scroll graphics modes}
  50.   $7F/$27/                     {         JG      NotOurs}
  51.                                {;}
  52.                                {Chk5:}
  53.   $80/$FC/$05/                 {         CMP     AH,5                    ; Check for page switch}
  54.   $7C/$22/                     {         JL      NotOurs}
  55.   $75/$05/                     {         JNE     Chk6}
  56.                                {;}
  57.   $A2/>VIDEO_PAGE/             {         MOV     BYTE [<Video_Page],AL   ; Remember new page number}
  58.   $EB/$1B/                     {         JMP     SHORT NotOurs           ; and let bios change the page}
  59.                                {;}
  60.                                {Chk6:}
  61.   $80/$FC/$06/                 {         CMP     AH,6                    ; Check for scroll request}
  62.   $75/$11/                     {         JNE     Chk7}
  63.                                {;}
  64.                                {Chk6a:}
  65.   $80/$F9/$00/                 {         CMP     CL,0                    ; We do it only for complete lines}
  66.   $75/$11/                     {         JNE     NotOurs}
  67.   $50/                         {         PUSH    AX}
  68.   $A1/>MAX_SCREEN_COL/         {         MOV     AX,[>Max_Screen_Col]}
  69.   $48/                         {         DEC     AX}
  70.   $38/$C2/                     {         CMP     DL,AL}
  71.   $58/                         {         POP     AX}
  72.   $75/$07/                     {         JNE     NotOurs}
  73.   $EB/$1F/                     {         JMP     SHORT Scroll}
  74.                                {;}
  75.                                {Chk7:}
  76.   $80/$FC/$07/                 {         CMP     AH,7                    ; Check for scroll request}
  77.   $74/$EA/                     {         JE      Chk6a}
  78.                                {;}
  79.   $FF/$36/>VIDEO_SAVE_IADDR+2/ {NotOurs: PUSH    [>Video_Save_IAddr+2] ;Push address of old ISR onto stack}
  80.   $FF/$36/>VIDEO_SAVE_IADDR/   {         PUSH    [>Video_Save_IAddr]   ;Need to do this before DS restored!}
  81.   $5B/                         {         POP     BX                    ;BX = OFS(Old_Video_Interrupt)}
  82.   $58/                         {         POP     AX                    ;AX = SEG(Old_Video_Interrupt)}
  83.   $87/$5E/$0E/                 {         XCHG    BX,[BP+14]            ;Swap old BX and Ofs(Old_Video...)}
  84.   $87/$46/$10/                 {         XCHG    AX,[BP+16]            ;Swap old AX and Seg(Old_Video...)}
  85.   $89/$EC/                     {         MOV     SP,BP                 ;Restore other registers}
  86.   $5D/                         {         POP     BP}
  87.   $07/                         {         POP     ES}
  88.   $1F/                         {         POP     DS}
  89.   $5F/                         {         POP     DI}
  90.   $5E/                         {         POP     SI}
  91.   $5A/                         {         POP     DX}
  92.   $59/                         {         POP     CX}
  93.                                {;                                       ;BX and AX restored earlier.}
  94.                                {;                                       ;Their places on stack now have}
  95.                                {;                                       ;old video interrupt address,}
  96.                                {;                                       ;which is where return will go.}
  97.                                {;}
  98.   $CB/                         {         RETF                           ;Chain to Old_Video_Interrupt}
  99.                                {;}
  100.                                {Scroll:}
  101.   $A3/>VIDEO_REQUEST/          {         MOV     [>Video_Request],AX     ; Save request}
  102.                                {;}
  103.   $89/$1E/>VIDEO_FILL/         {         MOV     [>Video_Fill],BX        ; Save fill attribute for much later}
  104.                                {;}
  105.   $52/                         {         PUSH    DX                      ; Because MUL uses it}
  106.                                {;}
  107.   $80/$FD/$00/                 {         CMP     CH,0                    ; Check starting, ending Y for legality}
  108.   $7D/$04/                     {         JGE     ChkCH}
  109.                                {;}
  110.   $B5/$00/                     {         MOV     CH,0                    ; CH has starting Y}
  111.   $EB/$0C/                     {         JMP     SHORT ChkDH}
  112.                                {;}
  113.   $3A/$2E/>MAX_SCREEN_LINE/    {ChkCH:   CMP     CH,[>Max_Screen_Line]}
  114.   $7C/$06/                     {         JL      ChkDH}
  115.                                {;}
  116.   $8A/$2E/>MAX_SCREEN_LINE/    {         MOV     CH,[>Max_Screen_Line]}
  117.   $FE/$CD/                     {         DEC     CH}
  118.                                {;}
  119.                                {ChkDH:}
  120.   $80/$FE/$00/                 {         CMP     DH,0                    ; DH has ending Y}
  121.   $7D/$04/                     {         JGE     ChkDH2}
  122.                                {;}
  123.   $B6/$00/                     {         MOV     DH,0}
  124.   $EB/$0C/                     {         JMP     SHORT ChkAL}
  125.                                {;}
  126.   $3A/$36/>MAX_SCREEN_LINE/    {ChkDH2:  CMP     DH,[>Max_Screen_Line]}
  127.   $7C/$06/                     {         JL      ChkAL}
  128.                                {;}
  129.   $8A/$36/>MAX_SCREEN_LINE/    {         MOV     DH,[>Max_Screen_Line]}
  130.   $FE/$CE/                     {         DEC     DH}
  131.                                {;}
  132.                                {ChkAL:}
  133.   $A1/>VIDEO_REQUEST/          {         MOV     AX,[>Video_Request]     ; Check # of lines to scroll/clear}
  134.   $3C/$00/                     {         CMP     AL,0}
  135.   $7D/$05/                     {         JGE     ChkAL2}
  136.                                {;}
  137.   $A0/>MAX_SCREEN_LINE/        {         MOV     AL,[>Max_Screen_Line]}
  138.   $EB/$09/                     {         JMP     SHORT RegsOK}
  139.                                {;}
  140.   $3A/$06/>MAX_SCREEN_LINE/    {ChkAL2:  CMP     AL,[>Max_Screen_Line]}
  141.   $7E/$03/                     {         JLE     RegsOK}
  142.                                {;}
  143.   $A0/>MAX_SCREEN_LINE/        {         MOV     AL,[>Max_Screen_Line]}
  144.                                {;}
  145.                                {RegsOK:}
  146.   $A3/>VIDEO_REQUEST/          {         MOV     [>Video_Request],AX     ; In case we fixed it}
  147.   $30/$FF/                     {         XOR     BH,BH}
  148.   $8A/$1E/>VIDEO_PAGE/         {         MOV     BL,[<Video_Page]        ; Get the current page number}
  149.   $B8/$00/$10/                 {         MOV     AX,4096                 ; The size of a a page}
  150.   $F7/$E3/                     {         MUL     BX                      ; Multiply by the page number to}
  151.   $89/$C7/                     {         MOV     DI,AX                   ; and put it in the destination index}
  152.                                {                                         ; Now calculate the offset of th}
  153.   $88/$EB/                     {         MOV     BL,CH                   ; by getting the starting row}
  154.   $30/$FF/                     {         XOR     BH,BH}
  155.   $A1/>MAX_SCREEN_COL/         {         MOV     AX,[>Max_Screen_Col]    ; We only handle full rows}
  156.   $D1/$E0/                     {         SHL     AX,1                    ; # of chars per row}
  157.   $F7/$E3/                     {         MUL     BX                      ; Multiply by chars/row to get offset}
  158.   $01/$C7/                     {         ADD     DI,AX                   ; and adding to di to get address}
  159.   $89/$F8/                     {         MOV     AX,DI}
  160.   $89/$C6/                     {         MOV     SI,AX                   ; and put it in the source index as well}
  161.   $5A/                         {         POP     DX}
  162.   $A1/>VIDEO_REQUEST/          {         MOV     AX,[>Video_Request]     ; Get the original request}
  163.   $88/$F7/                     {         MOV     BH,DH                   ; Move bottom line to BH}
  164.   $28/$EF/                     {         SUB     BH,CH                   ; Subtract top line}
  165.   $FE/$C7/                     {         INC     BH                      ; BH now has number of lines in}
  166.   $FC/                         {         CLD                             ; We'll move forward unless scroll back}
  167.   $8E/$06/>VIDEO_SCREEN_ADDR/  {         MOV     ES,[>Video_Screen_Addr]}
  168.   $3C/$00/                     {         CMP     AL,0                    ; Clear the area?}
  169.   $76/$06/                     {         JBE     M1                      ; Yes}
  170.   $38/$F8/                     {         CMP     AL,BH}
  171.   $74/$07/                     {         JE      M1b                     ; We are clearing all the lines}
  172.   $72/$08/                     {         JB      M2                      ; We are clearing some of the lines}
  173.                                {M1:                                      ; We are clearing more than all the line}
  174.   $88/$F8/                     {         MOV     AL,BH                   ; Move number of lines in window to AL}
  175.   $A3/>VIDEO_REQUEST/          {         MOV     [>Video_Request],AX}
  176.                                {M1b:}
  177.   $E9/$9D/$00/                 {         JMP     ClrArea}
  178.                                {M2:                                      ; BH has lines in window, AL has lines}
  179.                                {                                         ; to scroll}
  180.   $80/$FC/$06/                 {         CMP     AH,6                    ; Up or down?}
  181.   $74/$25/                     {         JE      UP}
  182.                                {;}
  183.                                {Down:                                    ; We are scrolling down}
  184.   $FD/                         {         STD                             ; so we move backwards}
  185.                                {;}
  186.   $28/$F8/                     {         SUB     AL,BH                   ; The source is BH-AL lines below SI}
  187.   $F6/$D8/                     {         NEG     AL                      ; Correct the sign}
  188.   $98/                         {         CBW                             ; Convert to a word}
  189.   $8B/$0E/>MAX_SCREEN_COL/     {         MOV     CX,[>Max_Screen_Col]}
  190.   $D1/$E1/                     {         SHL     CX,1}
  191.   $F7/$E1/                     {         MUL     CX                      ; Multiply by chars/row}
  192.   $2D/$02/$00/                 {         SUB     AX,2                    ; Subtract a word to get end of}
  193.   $01/$C6/                     {         ADD     SI,AX                   ; and ADD to si, the address of the up l}
  194.                                {;}
  195.                                {; The destination is the lower right which is BH lines}
  196.                                {; below current di => di = di + BH*2*Max_Screen_Col - 2}
  197.                                {;}
  198.   $88/$F8/                     {         MOV     AL,BH                   ; Get lines in window into al}
  199.   $98/                         {         CBW}
  200.   $8B/$0E/>MAX_SCREEN_COL/     {         MOV     CX,[>Max_Screen_Col]}
  201.   $D1/$E1/                     {         SHL     CX,1}
  202.   $F7/$E1/                     {         MUL     CX}
  203.   $2D/$02/$00/                 {         SUB     AX,2                    ; Subtract a word to get end of}
  204.   $01/$C7/                     {         ADD     DI,AX                   ; DI now has address of destination}
  205.                                {;}
  206.   $EB/$0B/                     {         JMP     SHORT MoveM}
  207.                                {Up:                                      ; we are scrolling up}
  208.                                {;}
  209.                                {; The source is al lines below si which is al*160 chars below current SI}
  210.                                {;}
  211.   $98/                         {         CBW                             ; Gets number of lines into AX}
  212.   $8B/$0E/>MAX_SCREEN_COL/     {         MOV     CX,[>Max_Screen_Col]}
  213.   $D1/$E1/                     {         SHL     CX,1}
  214.   $F7/$E1/                     {         MUL     CX}
  215.   $01/$C6/                     {         ADD     SI,AX                   ; SI now has address of source}
  216.                                {;}
  217.                                {; The initial destination is correct, we don't need to change it}
  218.                                {;}
  219.                                {MoveM:                                   ; Now start to move words}
  220.                                {;}
  221.                                {; Fix BX such that it is number of words to move}
  222.                                {; = (number of lines in window minus number of lines to scroll)*80}
  223.                                {;}
  224.   $A1/>VIDEO_REQUEST/          {         MOV     AX,[>Video_Request]     ; Get number of lines to scroll}
  225.   $98/                         {         CBW                             ; Slightly faster than XOR ah,ah}
  226.   $28/$F8/                     {         SUB     AL,BH                   ; Subtract lines in window from lines to}
  227.                                {                                         ; to scroll}
  228.   $F6/$D8/                     {         NEG     AL                      ; after correcting the sign, AX}
  229.   $8B/$0E/>MAX_SCREEN_COL/     {         MOV     CX,[>Max_Screen_Col]    ; words/line}
  230.   $F7/$E1/                     {         MUL     CX                      ; multiply to get words to move}
  231.   $89/$C3/                     {         MOV     BX,AX                   ; BX now has number of words to move}
  232.                                {;}
  233.   $1E/                         {         PUSH    DS                      ; We're about to change it to di}
  234.   $BA/>CRT_STATUS/             {         MOV     DX,>CRT_Status          ; The video status register}
  235.   $8E/$1E/>VIDEO_SCREEN_ADDR/  {         MOV     DS,[>Video_Screen_Addr] ; Load address of display segment}
  236.                                {;}
  237.                                {MvMVert:                                 ; First wait for a vertical refresh}
  238.   $89/$D9/                     {         MOV     CX,BX                   ; Move words remaining to CX}
  239.   $81/$F9/>MAXVERT/            {         CMP     CX,>MaxVert             ; Too  many?}
  240.   $7E/$03/                     {         JLE     MvMMany                 ; No, go move them}
  241.   $B9/>MAXVERT/                {         MOV     CX,>MaxVert             ; Yes, move MaxVert more}
  242.                                {;}
  243.                                {MvMMany:}
  244.   $29/$CB/                     {         SUB     BX,CX                   ; That many remain when rep movsw ends}
  245.                                {;}
  246.                                {MvMVRefresh:}
  247.   $EC/                         {         IN      AL,DX}
  248.   $A8/<VRETRACE/               {         TEST    AL,<VRetrace}
  249.   $75/$FB/                     {         JNZ     MvMVRefresh             ; Wait for a non retrace period}
  250.                                {;}
  251.                                {MvMVWait:}
  252.   $EC/                         {         IN      AL,DX                   ; Get the retrace status}
  253.   $A8/<VRETRACE/               {         TEST    AL,<VRetrace            ; Check for retrace in progress}
  254.   $74/$FB/                     {         JZ      MvMVWait                ; Wait until retrace}
  255.                                {;}
  256.                                {; During a vertical retrace, we can move many}
  257.                                {;}
  258.   $F2/$A5/                     {         REP     MOVSW}
  259.   $81/$FB/$00/$00/             {         CMP     BX,0}
  260.   $74/$30/                     {         JE      MvMEnd}
  261.                                {;}
  262.   $B9/>MAXHORIZ/               {         MOV     CX,>MaxHoriz}
  263.   $D1/$E3/                     {         SHL     BX,1                    ; To convert words to bytes}
  264.                                {;}
  265.                                {MvM1:}
  266.   $4B/                         {         DEC     BX}
  267.                                {;}
  268.                                {MvMHRefresh:}
  269.   $EC/                         {         IN      AL,DX}
  270.   $A8/<HRETRACE/               {         TEST    AL,<HRetrace}
  271.   $75/$FB/                     {         JNZ     MvMHRefresh             ; Wait for a non retrace period}
  272.                                {;}
  273.                                {;        CLI                             ; Disable interrupts while waiting}
  274.                                {;}
  275.                                {MvMHWait:}
  276.   $EC/                         {         IN      AL,DX                   ; Get the retrace status}
  277.   $A8/<HRETRACE/               {         TEST    AL,<HRetrace            ; Check for retrace in progress}
  278.   $74/$FB/                     {         JZ      MvMHWait                ; Wait until retrace}
  279.                                {;}
  280.   $A4/                         {         MOVSB                           ; Now move one byte}
  281.                                {;        STI                             ; Enable interrupts again}
  282.                                {;}
  283.   $81/$FB/$00/$00/             {         CMP     BX,0                    ; Are we finished?}
  284.   $74/$19/                     {         JE      MvMEnd}
  285.   $E2/$EC/                     {         LOOP    MvM1                    ; Only if CX not 0}
  286.   $81/$FB/$00/$00/             {         CMP     BX,0}
  287.   $74/$11/                     {         JE      MvMEnd}
  288.                                {;}
  289.                                {MvMDoCXAgain:}
  290.   $D1/$EB/                     {         SHR     BX,1                    ; Convert back to words}
  291.   $89/$D9/                     {         MOV     CX,BX                   ; Move words remaining to CX}
  292.   $81/$F9/>MAXVERT/            {         CMP     CX,>MaxVert             ; Too many?}
  293.   $7E/$03/                     {         JLE     MvMhMany                ; No, go move them.}
  294.   $B9/>MAXVERT/                {         MOV     CX,>MaxVert             ; Yes, move MaxVert more}
  295.                                {;}
  296.                                {MvMhMany:}
  297.   $29/$CB/                     {         SUB     BX,CX                   ; That many remain when movsw ends}
  298.   $EB/$C3/                     {         JMP     MvMVWait}
  299.                                {;}
  300.                                {MvMEnd:                                  ; We've finished moving}
  301.   $1F/                         {         POP     DS                      ; Restore the data segment}
  302.                                {;}
  303.                                {ClrArea:}
  304.                                {;}
  305.                                {;       We're now ready to blank the number of lines that were scrolled.}
  306.                                {;       The direction flag and di and es are set correctly, given}
  307.                                {;       what we've done so far.  All we need to do is calculate number of}
  308.                                {;       words to blank.}
  309.                                {;}
  310.   $A1/>VIDEO_REQUEST/          {         MOV     AX,[>Video_Request]     ; To get number lines to scroll}
  311.   $98/                         {         CBW}
  312.   $8B/$0E/>MAX_SCREEN_COL/     {         MOV     CX,[>Max_Screen_Col]    ; Words/line}
  313.   $F7/$E1/                     {         MUL     CX                      ; AX now has words to blank}
  314.   $89/$C3/                     {         MOV     BX,AX                   ; Put it in BX}
  315.                                {;}
  316.   $8B/$16/>VIDEO_FILL/         {         MOV     DX,[>Video_Fill]        ; DH now has the fill attribute}
  317.   $B2/$20/                     {         MOV     DL,' '                  ; Move a space to DL}
  318.                                {;}
  319.   $89/$D6/                     {         MOV     SI,DX                   ; Move clear char to si}
  320.   $BA/>CRT_STATUS/             {         MOV     DX,>CRT_Status          ; Get video status register}
  321.                                {;}
  322.                                {ClrVert:                                 ; First wait for a vertical refresh}
  323.   $89/$D9/                     {         MOV     CX,BX                   ; Move words remaining to CX}
  324.   $81/$F9/>CLRMAXVERT/         {         CMP     CX,>ClrMaxVert          ; Too many?}
  325.   $7E/$03/                     {         JLE     ClrMany                 ; No, go move them.}
  326.   $B9/>CLRMAXVERT/             {         MOV     CX,>ClrMaxVert          ; Yes, move ClrMaxVert more}
  327.                                {;}
  328.                                {ClrMany:}
  329.   $29/$CB/                     {         SUB     BX,CX                   ; That many remain when stosw ends}
  330.                                {;}
  331.                                {ClrVRefresh:}
  332.   $EC/                         {         IN      AL,DX}
  333.   $A8/<VRETRACE/               {         TEST    AL,<VRetrace}
  334.   $75/$FB/                     {         JNZ     ClrVRefresh             ; Wait for a non retrace period}
  335.                                {;}
  336.                                {ClrVWait:}
  337.   $EC/                         {         IN      AL,DX                   ; Get the retrace status}
  338.   $A8/<VRETRACE/               {         TEST    AL,<VRetrace            ; Check for retrace in progress}
  339.   $74/$FB/                     {         JZ      ClrVWait                ; Wait until retrace}
  340.   $96/                         {         XCHG    AX,SI}
  341.   $F2/$AB/                     {         REP     STOSW}
  342.   $96/                         {         XCHG    AX,SI}
  343.   $81/$FB/$00/$00/             {         CMP     BX,0}
  344.   $74/$2E/                     {         JE      ClrEnd}
  345.                                {;}
  346.   $B9/>MAXHORIZ/               {         MOV     CX,>MaxHoriz}
  347.                                {;}
  348.                                {Clr1:}
  349.   $4B/                         {         DEC     BX}
  350.                                {;}
  351.                                {ClrHRefresh:}
  352.   $EC/                         {         IN      AL,DX}
  353.   $A8/<HRETRACE/               {         TEST    AL,<HRetrace}
  354.   $75/$FB/                     {         JNZ     ClrHRefresh             ; Wait for a non retrace period}
  355.                                {;}
  356.                                {;        CLI                             ; Disable interrupts while waiting}
  357.                                {;}
  358.                                {ClrHWait:}
  359.   $EC/                         {         IN      AL,DX                   ; Get the retrace status}
  360.   $A8/<HRETRACE/               {         TEST    AL,<HRetrace            ; Check for retrace in progress}
  361.   $74/$FB/                     {         JZ      ClrHWait                ; Wait until retrace}
  362.   $96/                         {         XCHG    AX,SI}
  363.   $AB/                         {         STOSW                           ; Now move one word}
  364.                                {;        STI                             ; Enable interrupts again}
  365.   $96/                         {         XCHG    AX,SI}
  366.   $81/$FB/$00/$00/             {         CMP     BX,0                    ; Are we finished?}
  367.   $74/$17/                     {         JE      ClrEnd}
  368.   $E2/$EA/                     {         LOOP    Clr1}
  369.   $81/$FB/$00/$00/             {         CMP     BX,0}
  370.   $74/$0F/                     {         JE      ClrEnd}
  371.                                {;}
  372.                                {ClrDoCXAgain:}
  373.   $89/$D9/                     {         MOV     CX,BX                   ; Move words remaining to CX}
  374.   $81/$F9/>CLRMAXVERT/         {         CMP     CX,>ClrMaxVert          ; Too many?}
  375.   $7E/$03/                     {         JLE     ClrhMany                ; No, go move'm}
  376.   $B9/>CLRMAXVERT/             {         MOV     CX,>ClrMaxVert          ; Yes, move ClrMaxVert more, Maximum}
  377.                                {;}
  378.                                {ClrHMany:}
  379.   $29/$CB/                     {         SUB     BX,CX                   ; That many will remain when rep movsw e}
  380.   $EB/$C3);                    {         JMP     ClrVWait}
  381.                                {;}
  382.                                {ClrEnd:                                  ; We've finished moving}
  383.                                {;}
  384.  
  385. END   (* Video_Interrupt_Handler *);
  386.  
  387. (*----------------------------------------------------------------------*)
  388. (* Install_Video_Handler --- Installs new interrupt $10 video driver    *)
  389. (*----------------------------------------------------------------------*)
  390.  
  391. PROCEDURE Install_Video_Handler;
  392.  
  393. (*----------------------------------------------------------------------*)
  394. (*                                                                      *)
  395. (*     Procedure:  Install_Video_Handler                                *)
  396. (*                                                                      *)
  397. (*     Purpose:    Replaces standard interrupt $10 video driver         *)
  398. (*                                                                      *)
  399. (*     Calling Sequence:                                                *)
  400. (*                                                                      *)
  401. (*        Install_Video_Handler;                                        *)
  402. (*                                                                      *)
  403. (*----------------------------------------------------------------------*)
  404.  
  405. BEGIN (* Install_Video_Handler *)
  406.  
  407.                                    (* Initialize video variables    *)
  408.    Video_Request     := 0;
  409.    Video_Fill        := 0;
  410.    Video_Page        := 0;
  411.    Video_Mode        := Current_Video_Mode;
  412.    Video_Screen_Addr := SEG( DesqView_Screen^ );
  413.  
  414.                                    (* Set interrupt routine address,  *)
  415.                                    (* but only if software scrolling. *)
  416.    IF Software_Scroll THEN
  417.       BEGIN
  418.          SetIntVec( Video_Interrupt , @Video_Interrupt_Handler );
  419.          Video_Handler_Installed := TRUE;
  420.       END;
  421.  
  422. END   (* Install_Video_Handler *);
  423.  
  424. (*----------------------------------------------------------------------*)
  425. (*  Remove_Video_Handler --- Removes installed interrupt $10 driver     *)
  426. (*----------------------------------------------------------------------*)
  427.  
  428. PROCEDURE Remove_Video_Handler;
  429.  
  430. (*----------------------------------------------------------------------*)
  431. (*                                                                      *)
  432. (*     Procedure:  Remove_Video_Handler                                 *)
  433. (*                                                                      *)
  434. (*     Purpose:    Restores standard interrupt $10 video driver         *)
  435. (*                                                                      *)
  436. (*     Calling Sequence:                                                *)
  437. (*                                                                      *)
  438. (*        Remove_Video_Handler;                                         *)
  439. (*                                                                      *)
  440. (*----------------------------------------------------------------------*)
  441.  
  442. BEGIN (* Remove_Video_Handler *)
  443.  
  444.                      (* Restore the previous interrupt pointers *)
  445.  
  446.    SetIntVec( Video_Interrupt , Video_Save_Iaddr );
  447.  
  448.    Video_Handler_Installed := FALSE;
  449.  
  450. END   (* Remove_Video_Handler *);
  451.