home *** CD-ROM | disk | FTP | other *** search
- { Qfills.inc - QfillC, Qfill, Qattr, QattrC ver 2.1, 12-09-86 }
- { This procedure does fast screen writes and automatically configures to
- your machine for Mono, CGA, and EGA. It also has the feature of leaving the
- attribute alone by setting Attr<0; then Qfill will just overwrite the display
- using the current attributes while Qattr will simply abort the procedure.
- The upper left column is 1,1. Cols can range from 1 to 80 and Rows from
- 1 to 25 (a full screen on 80x25), but EGA can handle more. Example
- applications for Qfill is a fast screen clear or clear EOL; for Qattr is
- changing the highlighted cursor in pull down menus without the need of a
- string. Please limit Cols to the number in one row (<200).
- You MUST read MODIFICATIONS in QWIK21.DOC for any changes in this file! }
-
- { QfillC - Quick screen repetitive fill, self-centering ver 2.0, 11-24-86 }
- procedure QfillC (Row, ColL, ColR, Rows, Cols: byte; Attr: integer; Ch: char);
- begin
- Inline(
- $8B/$46/<ROW { MOV AX,[BP+<Row] ;Move row}
- /$8B/$7E/<COLL { MOV DI,[BP+<ColL] ;Move left col}
- /$03/$7E/<COLR { ADD DI,[BP+<ColR] ;Add right col}
- /$4F { DEC DI ;Convert to 0-?? range}
- /$8B/$76/<ROWS { MOV SI,[BP+<Rows] ;Move number of rows}
- /$8B/$4E/<COLS { MOV CX,[BP+<Cols] ;Move number of cols}
- /$29/$CF { SUB DI,CX ;Offset calc'd in DI}
- /$81/$E7/$FE/$FF { AND DI,$FFFE ;Make even}
- /$8B/$5E/<ATTR { MOV BX,[BP+<Attr] ;Move attr to BX}
- /$8A/$6E/<CH { MOV CH,[BP+<Ch] ;Move char to CH}
- /$E8/$38/$00 { CALL NEAR Qdisp ;Call Qdisp, address}
- { ; is pre-compiled!}
- );
- end;
-
- { Qfill - Quick screen repetitive fill ver 2.0, 11-24-86 }
- procedure Qfill (Row, Col, Rows, Cols: byte; Attr: integer; Ch: char);
- begin
- Inline(
- $8B/$46/<ROW { MOV AX,[BP+<Row] ;Move row}
- /$8B/$7E/<COL { MOV DI,[BP+<Col] ;Move col}
- /$4F { DEC DI ;Convert to 0-?? range}
- /$D1/$E7 { SHL DI,1 ;Mult by 2}
- /$8B/$76/<ROWS { MOV SI,[BP+<Rows] ;Move number of rows}
- /$8A/$4E/<COLS { MOV CL,[BP+<Cols] ;Move number of cols}
- /$8B/$5E/<ATTR { MOV BX,[BP+<Attr] ;Move attr to BX}
- /$8A/$6E/<CH { MOV CH,[BP+<Ch] ;Move char to CH}
- /$E8/$10/$00 { CALL NEAR Qdisp ;Call Qdisp, address}
- { ; is pre-compiled!}
- );
- end;
-
- { QfillsDisp - Subroutine for all Qfills procedures ver 2.1, 12-09-86 }
- procedure QfillsDisp;
- begin
- Inline(
- $48 {Qdisp: DEC AX ;Convert to 0-?? range}
- /$31/$D2 { XOR DX,DX ;Set DX=0}
- /$8E/$C2 { MOV ES,DX ;Set ES=0}
- /$26/$8B/$16/$4A/$04 { ES: MOV DX,[$044A] ;Get CRT columns}
- /$F6/$E2 { MUL DL ;(CRT columns)*(Row-1)}
- /$D1/$E0 { SHL AX,1 ;Mult by 2}
- /$01/$C7 { ADD DI,AX ;Dest offset in DI}
- /$88/$E8 { MOV AL,CH ;Move attr to AH}
- /$30/$ED { XOR CH,CH ;Set CH=0}
- /$29/$CA { SUB DX,CX ;Subract Cols}
- /$D1/$E2 { SHL DX,1 ;Mult by 2}
- /$52 { PUSH DX ;Save # to next row}
- /$51 { PUSH CX ;Save # of Cols}
- { ;}
- /$85/$F6 { TEST SI,SI ;If Rows<=0 ...}
- /$7E/$31 { JLE DoneS ; nothing to do}
- /$85/$C9 { TEST CX,CX ;If Cols<=0 ...}
- /$7E/$2D { JLE DoneS ; nothing to do}
- { ;}
- /$88/$DC { MOV AH,BL ;Move attr to AH}
- /$FC { CLD ;Set DF to increment}
- /$3A/$2E/>QWAIT { CMP CH,[>Qwait] ;Check need for wait}
- /$8E/$06/>QSEG { MOV ES,[>Qseg] ;ES:DI dest pointer}
- /$75/$29 { JNE Color ; use Color routine}
- /$84/$FF { TEST BH,BH ;If Attr<0 ...}
- /$78/$0E { JS Mono1 ; use char only}
- { ;}
- {; -- Mono routine; Attr, Char and No Wait--}
- /$89/$CA { MOV DX,CX ;Save Cols in DX}
- /$F2/$AB {Mono2: REP STOSW ;To dest & inc DI 2}
- /$4E { DEC SI ;Decrement rows left}
- /$74/$15 { JZ DoneS ;If Rows=0, done}
- /$89/$D1 { MOV CX,DX ;Restore Cols}
- /$03/$7E/$FA { ADD DI,[BP-$06] ;Dest for next row}
- /$EB/$F4 { JMP SHORT Mono2 ;Next row}
- { ;}
- {; -- Mono routine; Char/Attr Only and No Wait--}
- {; Algorithm packs in an extra STOSB per LOOP}
- /$41 {Mono1: INC CX ;Bump CX for odd col}
- /$89/$CA { MOV DX,CX ;Save Cols in DX}
- /$D1/$E9 {Mon1a: SHR CX,1 ;Divide counter by 2}
- { ; CF=0 if odd count}
- /$73/$02 { JNC Mon1c ;Jump if odd count}
- { ;}
- /$AA {Mon1b: STOSB ;To dest & inc DI 1}
- /$47 { INC DI ;Pass up attr/char}
- /$AA {Mon1c: STOSB ;To dest & inc DI 1}
- /$47 { INC DI ;Pass up attr/char}
- /$E2/$FA { LOOP Mon1b ;Loop until CX=0}
- /$4E { DEC SI ;Decrement rows left}
- /$7E/$58 {DoneS: JLE Done ;If Rows=0, done}
- /$89/$D1 { MOV CX,DX ;Restore Cols}
- /$03/$7E/$FA { ADD DI,[BP-$06] ;Dest for next row}
- /$EB/$EC { JMP SHORT Mon1a ;Next row}
- { ;}
- /$BA/$DA/$03 {Color: MOV DX,$03DA ;CGA port}
- /$88/$C3 { MOV BL,AL ;Save char in BL}
- /$84/$FF { TEST BH,BH ;If Attr<0 ...}
- /$78/$27 { JS Col1a ; use char/attr only}
- { ;}
- {; -- Color routine; Attr, Char and Wait --}
- /$FA {Col2a: CLI ;Disable interrupts}
- /$EC {E4in2: IN AL,DX ;Check CGA status}
- /$A8/$08 { TEST AL,$08 ;If #3 bit clear ...}
- /$74/$07 { JZ Col2b ; check #0 bit.}
- /$88/$D8 { MOV AL,BL ;Move char back in AL}
- /$F2/$AB { REP STOSW ;Quick storage}
- /$FB { STI ;Enable interrupts}
- /$EB/$0F { JMP SHORT Col2c ; finished row}
- /$D0/$D8 {Col2b: RCR AL,1 ;If #0 bit set ...}
- /$72/$F0 { JC E4in2 ; try again for $E4}
- /$EC {E5in2: IN AL,DX ;Check CGA status}
- /$D0/$D8 { RCR AL,1 ;If #0 bit clear ...}
- /$73/$FB { JNC E5in2 ; try again for $E5}
- /$88/$D8 { MOV AL,BL ;Move char back in AL}
- /$AB { STOSW ;Put in dest & inc DI}
- /$FB { STI ;Enable interrupts}
- /$E2/$E4 { LOOP Col2a ;Loop till CX=0}
- /$4E {Col2c: DEC SI ;Decrement rows left}
- /$74/$29 { JZ Done ;If Rows=0, done}
- /$8B/$4E/$F8 { MOV CX,[BP-$08] ;Restore Cols}
- /$03/$7E/$FA { ADD DI,[BP-$06] ;Dest for next row}
- /$EB/$D9 { JMP SHORT Col2a ;Next row}
- { ;}
- {; -- Color routine; Char/Attr only and Wait --}
- /$FA {Col1a: CLI ;Disable interrupts}
- /$EC {E4in1: IN AL,DX ;Check CGA status}
- /$A8/$08 { TEST AL,$08 ;If #3 bit set ...}
- /$75/$09 { JNZ Col1b ; skip wait.}
- /$D0/$D8 { RCR AL,1 ;If #0 bit set ...}
- /$72/$F7 { JC E4in1 ; try again for $E4}
- /$EC {E5in1: IN AL,DX ;Check CGA status}
- /$D0/$D8 { RCR AL,1 ;If #0 bit clear ...}
- /$73/$FB { JNC E5in1 ; try again for $E5}
- /$88/$D8 {Col1b: MOV AL,BL ;Move char/attr in AL}
- /$AA { STOSB ;Put in dest & inc DI}
- /$FB { STI ;Enable interrupts}
- /$47 { INC DI ;Pass up attr/char}
- /$E2/$EA { LOOP Col1a ;Loop till CX=0}
- /$4E { DEC SI ;Decrement rows left}
- /$74/$08 { JZ Done ;If Rows=0, done}
- /$8B/$4E/$F8 { MOV CX,[BP-$08] ;Restore Cols}
- /$03/$7E/$FA { ADD DI,[BP-$06] ;Dest for next row}
- /$EB/$DF { JMP SHORT Col1a ;Next row}
- { ;}
- /$81/$C4/$04/$00 {Done: ADD SP,$0004 ;Restore stack ptr}
- /$C3 { RET ;Return to call}
- );
- end;
-
- { Qattr - Quick screen attribute change ver 2.1, 12-09-86 }
- procedure Qattr (Row, Col, Rows, Cols: byte; Attr: integer);
- begin
- Inline(
- $8B/$46/<ROW { MOV AX,[BP+<Row] ;Move row}
- /$8B/$7E/<COL { MOV DI,[BP+<Col] ;Move col}
- /$4F { DEC DI ;Convert to 0-?? range}
- /$D1/$E7 { SHL DI,1 ;Mult by 2}
- /$47 { INC DI ;Pass up char}
- /$8B/$76/<ROWS { MOV SI,[BP+<Rows] ;Move number of rows}
- /$8A/$4E/<COLS { MOV CL,[BP+<Cols] ;Move number of cols}
- /$8B/$5E/<ATTR { MOV BX,[BP+<Attr] ;Move attr to BX}
- /$84/$FF { TEST BH,BH ;If Attr<0 ...}
- /$78/$07 { JS Exit1 ; nothing to do.}
- /$88/$DD { MOV CH,BL ;Move attr in CH}
- /$B7/$80 { MOV BH,$80 ;Make BH negative}
- /$E8/$26/$FF { CALL NEAR Qdisp ;Call Qdisp, address}
- { ; is pre-compiled!}
- {Exit1:}
- );
- end;
-
- { QattrC - Quick screen attribute change, self-centering ver 2.1, 12-09-86 }
- procedure QattrC (Row, ColL, ColR, Rows, Cols: byte; Attr: integer);
- begin
- Inline(
- $8B/$46/<ROW { MOV AX,[BP+<Row] ;Move row}
- /$8B/$7E/<COLL { MOV DI,[BP+<ColL] ;Move left col}
- /$03/$7E/<COLR { ADD DI,[BP+<ColR] ;Add right col}
- /$4F { DEC DI ;Convert to 0-?? range}
- /$8B/$76/<ROWS { MOV SI,[BP+<Rows] ;Move number of rows}
- /$8B/$4E/<COLS { MOV CX,[BP+<Cols] ;Move number of cols}
- /$29/$CF { SUB DI,CX ;Offset calc'd in DI}
- /$81/$CF/$01/$00 { OR DI,$0001 ;Make odd;pass up char}
- /$8B/$5E/<ATTR { MOV BX,[BP+<Attr] ;Move attr to BX}
- /$84/$FF { TEST BH,BH ;If Attr<0 ...}
- /$78/$07 { JS Exit2 ; nothing to do.}
- /$88/$DD { MOV CH,BL ;Move attr in CH}
- /$B7/$80 { MOV BH,$80 ;Make BH negative}
- /$E8/$F2/$FE { CALL NEAR Qdisp ;Call Qdisp, address}
- { ; is pre-compiled!}
- {Exit2:}
- );
- end;
-