home *** CD-ROM | disk | FTP | other *** search
- { Qfills - Qfill, Qattr ver 1.3, 11-10-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 2000 (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.
- You MUST read MODIFICATIONS in QWIK13.DOC for any changes in this file! }
-
- { Qfill - Quick screen repetitive fill ver 1.3, 11-10-86 }
- procedure Qfill (Row, Col: byte; Attr: integer; Ch: char; Cols: integer);
- begin
- Inline(
- $31/$D2 { XOR DX,DX ;Set DX=0}
- /$8E/$C2 { MOV ES,DX ;Set ES=0}
- /$8A/$76/<ROW { MOV DH,[BP+<Row] ;Move row (Row*256)}
- /$8B/$7E/<COL { MOV DI,[BP+<Col] ;Move col}
- /$4F { DEC DI ;Convert to 0-79 range}
- /$D1/$E7 { SHL DI,1 ;Mult by 2}
- /$8B/$5E/<ATTR { MOV BX,[BP+<Attr] ;Move attr to BX}
- /$88/$DC { MOV AH,BL ;Move attr to AH}
- /$8A/$46/<CH { MOV AL,[BP+<Ch] ;Move char to AL}
- /$8B/$4E/<COLS { MOV CX,[BP+<Cols] ;Move number of cols}
- /$E8/$10/$00 { CALL NEAR Qdisp ;Call Qdisp, address}
- { ; is calculated!}
- );
- end;
-
- { QfillsDisp - Subroutine for all Qfills procedures ver 1.3, 11-10-86 }
- procedure QfillsDisp;
- begin
- Inline(
- $85/$C9 {Qdisp: TEST CX,CX ;If CX<=0 ...}
- /$7E/$1E { JLE ExitS ; nothing to do}
- /$D1/$EA { SHR DX,1 ;(Row*128)}
- /$01/$D7 { ADD DI,DX ;Save (Row*128) in DI}
- /$D1/$EA { SHR DX,1 ;(Row*64)}
- /$D1/$EA { SHR DX,1 ;(Row*32)}
- /$01/$D7 { ADD DI,DX ;Dest offset in DI}
- /$FC { CLD ;Set DF to increment}
- /$26/$80/$3E/$49/$04/$07{ ES: CMP BY[$0449],$07 ;Check video mode}
- /$75/$1A { JNE Color ; use Color routine}
- { ;}
- /$BA/$F6/$AF { MOV DX,$AFF6 ;Addr for Mono}
- /$8E/$C2 { MOV ES,DX ;ES:DI dest pointer}
- /$84/$FF {EGA: TEST BH,BH ;If Attr<0 ...}
- /$78/$04 { JS Mono1 ; use char only}
- { ;}
- {; -- Mono routine; Attr, Char and No Wait--}
- /$F2/$AB {Mono2: REP STOSW ;To dest & inc DI 2}
- /$EB/$63 {ExitS: JMP SHORT Done ;Done}
- { ;}
- {; -- 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}
- /$D1/$E9 { SHR CX,1 ;Divide counter by 2}
- { ; CF=0 if odd count}
- /$73/$02 { JNC Mon1b ;Jump if odd count}
- { ;}
- /$AA {Mon1a: STOSB ;To dest & inc DI 1}
- /$47 { INC DI ;Pass up attr/char}
- /$AA {Mon1b: STOSB ;To dest & inc DI 1}
- /$47 { INC DI ;Pass up attr/char}
- /$E2/$FA { LOOP Mon1a ;Loop until CX=0}
- /$EB/$56 { JMP SHORT Done ;Done}
- { ;}
- /$80/$3E/>TOEGA/$00 {Color: CMP BY[>ToEGA],$00 ;Check for EGA}
- /$BA/$F6/$B7 { MOV DX,$B7F6 ;Addr for Color}
- /$8E/$C2 { MOV ES,DX ;ES:DI dest pointer}
- /$75/$DF { JNE EGA ;If EGA, do Mono}
- /$BA/$DA/$03 { MOV DX,$03DA ;CGA port}
- /$88/$C3 { MOV BL,AL ;Save char in BL}
- /$84/$FF { TEST BH,BH ;If Attr<0 ...}
- /$78/$21 { 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/$0A { JZ Col2b ; skip tests}
- /$88/$D8 { MOV AL,BL ;Move char back in AL}
- /$81/$F9/$D0/$00 { CMP CX,$00D0 ;If <209 Cols left,}
- /$78/$CC { JS Mono2 ; do mono instead}
- /$EB/$0B { JMP SHORT Col2c ; else store direct}
- /$D0/$D8 {Col2b: RCR AL,1 ;If #0 bit set ...}
- /$72/$ED { 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 {Col2c: STOSW ;Put in dest & inc DI}
- /$FB { STI ;Enable interrupts}
- /$E2/$E1 { LOOP Col2a ;Loop till CX=0}
- /$EB/$20 { JMP SHORT Done ;Done}
- { ;}
- {; -- 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 clear ...}
- /$74/$0A { JZ Col1b ; skip tests}
- /$88/$D8 { MOV AL,BL ;Move char/attr in AL}
- /$81/$F9/$90/$00 { CMP CX,$0090 ;If <145 Cols left,}
- /$78/$AF { JS Mono1 ; do mono instead.}
- /$EB/$0B { JMP SHORT Col1c ; else store direct}
- /$D0/$D8 {Col1b: RCR AL,1 ;If #0 bit set ...}
- /$72/$ED { 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 { MOV AL,BL ;Move char/attr in AL}
- /$AA {Col1c: STOSB ;Put in dest & inc DI}
- /$FB { STI ;Enable interrupts}
- /$47 { INC DI ;Pass up attr/char}
- /$E2/$E0 { LOOP Col1a ;Loop till CX=0}
- /$C3 {Done: RET ;Return to call}
- );
- end;
-
- { Qattr - Quick screen attribute change ver 1.3, 11-10-86 }
- procedure Qattr (Row, Col: byte; Attr, Cols: integer);
- begin
- Inline(
- $31/$D2 { XOR DX,DX ;Set DX=0}
- /$8E/$C2 { MOV ES,DX ;Set ES=0}
- /$8A/$76/<ROW { MOV DH,[BP+<Row] ;Move row (Row*256)}
- /$8B/$7E/<COL { MOV DI,[BP+<Col] ;Move col}
- /$4F { DEC DI ;Convert to 0-79 range}
- /$D1/$E7 { SHL DI,1 ;Mult by 2}
- /$47 { INC DI ;Pass up char}
- /$8B/$5E/<ATTR { MOV BX,[BP+<Attr] ;Move attr to BX}
- /$84/$FF { TEST BH,BH ;If Attr<0 ...}
- /$78/$0A { JS Exit2 ; nothing to do.}
- /$88/$D8 { MOV AL,BL ;Move attr in AL}
- /$B7/$80 { MOV BH,$80 ;Make BH negative}
- /$8B/$4E/<COLS { MOV CX,[BP+<Cols] ;Move number of cols}
- /$E8/$4B/$FF { CALL NEAR Qdisp ;Call Qdisp, address}
- { ; is calculated!}
- {Exit2:}
- );
- end;