home *** CD-ROM | disk | FTP | other *** search
- { This procedure does fast screen writes and automatically configures to
- your machine for Mono, CGA, and EGA. It also has the feature of suppressing
- the attribute by setting Attr<0; then Qfill will just overwrite the display
- using the current attributes. The upper left column is 1,1. Cols can range
- from 1 to 2000 (a full screen). An example application is a fast screen
- clear or clear EOL. }
-
- procedure Qfill (Row, Col: byte; Attr: integer; Ch: char; Cols: integer);
- begin
- Inline(
- $31/$C0 { XOR AX,AX ;Set AX=0}
- /$8E/$C0 { MOV ES,AX ;Set ES=0}
- /$8A/$66/<ROW { MOV AH,[BP+<Row] ;Move row (Row*256)}
- /$D1/$E8 { SHR AX,1 ;(Row*128)}
- /$89/$C7 { MOV DI,AX ;Save (Row*128) in DI}
- /$D1/$E8 { SHR AX,1 ;(Row*64)}
- /$D1/$E8 { SHR AX,1 ;(Row*32)}
- /$01/$C7 { ADD DI,AX ;Save (Row*160) in DI}
- /$8B/$46/<COL { MOV AX,[BP+<Col] ;Move col}
- /$48 { DEC AX ;Convert to 0-79 range}
- /$D1/$E0 { SHL AX,1 ;Mult by 2}
- /$01/$C7 { ADD DI,AX ;Offset calc'd in DI}
- { ;}
- /$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}
- /$85/$C9 { TEST CX,CX ;If CX<=0 ...}
- /$7E/$75 { JLE Exit ; nothing to do}
- { ;}
- /$FC { CLD ;Set DF to increment}
- /$26/$80/$3E/$49/$04/$07{ ES: CMP BY[$0449],$07 ;Check video mode}
- /$75/$1B { 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/$5F { JMP SHORT Exit ;Done}
- { ;}
- {; -- Mono routine; Char Only and No Wait--}
- {; Algorithm packs in an extra STOSB per LOOP}
- /$41 {Mono1: INC CX ;Bump CX for odd char}
- /$41 { INC CX ;Bump CX for odd char}
- /$D1/$E9 { SHR CX,1 ;Divide counter by 2}
- { ; CF=1 if odd count}
- /$72/$02 { JC Mon1b ;Jump if odd count}
- { ;}
- /$AA {Mon1a: STOSB ;To dest & inc DI 1}
- /$47 { INC DI ;Pass up attr}
- /$AA {Mon1b: STOSB ;To dest & inc DI 1}
- /$47 { INC DI ;Pass up attr}
- /$E2/$FA { LOOP Mon1a ;Loop until CX=0}
- /$EB/$51 { JMP SHORT Exit ;Done}
- { ;}
- /$BA/$F6/$B7 {Color: MOV DX,$B7F6 ;Addr for Color}
- /$8E/$C2 { MOV ES,DX ;ES:DI dest pointer}
- /$79/$E3 { JNS 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/$22 { JS Col1b ; use char 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/$D0 { 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 Exit ;Done}
- { ;}
- {; -- Color routine; Char only and Wait --}
- /$47 {Col1a: INC DI ;Pass up attr}
- /$FA {Col1b: CLI ;Disable interrupts}
- /$EC {E4in1: IN AL,DX ;Check CGA status}
- /$A8/$08 { TEST AL,$08 ;If #3 bit clear ...}
- /$74/$0A { JZ Col1c ; skip tests}
- /$88/$D8 { MOV AL,BL ;Move char back in AL}
- /$81/$F9/$90/$00 { CMP CX,$0090 ;If <145 Cols left,}
- /$78/$B2 { JS Mono1 ; do mono instead.}
- /$EB/$0B { JMP SHORT Col1d ; else store direct}
- /$D0/$D8 {Col1c: 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 back in AL}
- /$AA {Col1d: STOSB ;Put in dest & inc DI}
- /$FB { STI ;Enable interrupts}
- /$E2/$E0 { LOOP Col1a ;Loop till CX=0}
- {Exit:}
- );
- end;