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 QwriteV will just overwrite the display
- using the current attributes. The upper left column is 1,1. }
-
- procedure QwriteV (Row, Col: byte; Attr: integer; VAR St);
- begin
- Inline(
- $31/$C0 { XOR AX,AX ;Set AX=0}
- /$89/$C1 { MOV CX,AX ;Set CX=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}
- { ;}
- /$C5/$76/<ST { LDS SI,[BP+<St] ;Place offset in SI}
- /$FC { CLD ;Set DF to increment}
- /$AD { LODSW ;Load St[1],St[0]}
- /$00/$C1 { ADD CL,AL ;Save length in CL}
- /$74/$41 { JZ ExitS ;Null string}
- /$88/$E0 { MOV AL,AH ;Move St[1] to AL}
- /$26/$80/$3E/$49/$04/$07{ ES: CMP BY[$0449],$07 ;Check video mode}
- /$75/$39 { 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/$18 { JS Mono1 ; use char only}
- { ;}
- {; -- Mono routine; Attr, Char and No Wait--}
- /$88/$DC { MOV AH,BL ;Copy attr to AH}
- /$41 {Mono2: INC CX ;Bump CX for odd char}
- /$D1/$E9 { SHR CX,1 ;Divide counter by 2}
- { ; CF=0 if odd length}
- /$EB/$08 { JMP SHORT Mon2b ;Jump into mono loop}
- { ;}
- /$AD {Mon2a: LODSW ;Load TWO char}
- /$88/$E7 { MOV BH,AH ;Move Ch2 to BH}
- /$88/$DC { MOV AH,BL ;Copy attr to AH}
- /$AB { STOSW ;To dest & inc DI 2}
- /$88/$F8 { MOV AL,BH ;Move Ch2 to AL}
- /$AB {Mon2b: STOSW ;To dest & inc DI 2}
- /$E2/$F5 { LOOP Mon2a ;Loop until CX=0}
- /$73/$75 { JNC Exit ;Exit if odd length}
- /$AC { LODSB ;Load last char}
- /$AB { STOSW ;To dest & inc DI 2}
- /$EB/$71 { JMP SHORT Exit ;Done}
- { ;}
- {; -- Mono routine; Char Only and No Wait--}
- /$41 {Mono1: INC CX ;Bump CX for odd char}
- /$89/$CA { MOV DX,CX ;Save CX in DX}
- /$D1/$E9 { SHR CX,1 ;Divide counter by 2}
- /$EB/$05 { JMP SHORT Mon1b ;Jump into mono loop}
- { ;}
- /$AD {Mon1a: LODSW ;Load TWO char}
- /$AA { STOSB ;To dest & inc DI 1}
- /$47 { INC DI ;Pass up attr}
- /$88/$E0 { MOV AL,AH ;Move Ch2 to AL}
- /$AA {Mon1b: STOSB ;To dest & inc DI 1}
- /$47 { INC DI ;Pass up attr}
- /$E2/$F7 { LOOP Mon1a ;Loop until CX=0}
- /$D1/$EA { SHR DX,1 ;Divide counter by 2}
- { ;CF=0 if odd length}
- /$73/$5D { JNC Exit ;Exit if odd length}
- /$AC { LODSB ;Load last char}
- /$AA { STOSB ;To dest & inc DI 1}
- /$EB/$59 {ExitS: JMP SHORT Exit ;Done}
- { ;}
- /$BA/$F6/$B7 {Color: MOV DX,$B7F6 ;Addr for Color}
- /$8E/$C2 { MOV ES,DX ;ES:DI dest pointer}
- /$79/$C5 { JNS EGA ;If EGA, do Mono}
- /$BA/$DA/$03 { MOV DX,$03DA ;CGA port}
- /$84/$FF { TEST BH,BH ;If Attr<0 ...}
- /$78/$2A { JS Col1b ; use char only}
- /$88/$DC { MOV AH,BL ;Move attr in AH}
- /$EB/$01 { JMP SHORT Col2b ;Attr and char}
- { ;}
- {; -- Color routine; Attr, Char and Wait --}
- /$AC {Col2a: LODSB ;Load source char}
- /$88/$C7 {Col2b: MOV BH,AL ;Save char in BH}
- /$FA { CLI ;Disable interrupts}
- /$EC {E4in2: IN AL,DX ;Check CGA status}
- /$A8/$08 { TEST AL,$08 ;If #3 bit clear ...}
- /$74/$0A { JZ Col2c ; skip tests}
- /$88/$F8 { MOV AL,BH ;Move char back in AL}
- /$81/$F9/$90/$00 { CMP CX,$0090 ;If <145 Cols left,}
- /$78/$AF { JS Mono2 ; do mono instead}
- /$EB/$0B { JMP SHORT Col2d ; else store direct}
- /$D0/$D8 {Col2c: 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/$F8 { MOV AL,BH ;Move char back in AL}
- /$AB {Col2d: STOSW ;Put in dest & inc DI}
- /$FB { STI ;Enable interrupts}
- /$E2/$DE { LOOP Col2a ;Loop till CX=0}
- /$EB/$23 { JMP SHORT Exit ;Done}
- { ;}
- {; -- Color routine; Char only and Wait --}
- /$AC {Col1a: LODSB ;Load source char}
- /$47 { INC DI ;Pass up attr}
- /$88/$C7 {Col1b: MOV BH,AL ;Save char in BH}
- /$FA { 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/$F8 { MOV AL,BH ;Move char back in AL}
- /$81/$F9/$80/$00 { CMP CX,$0080 ;If <129 Cols left,}
- /$78/$A0 { 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/$F8 { MOV AL,BH ;Move char back in AL}
- /$AA {Col1d: STOSB ;Put in dest & inc DI}
- /$FB { STI ;Enable interrupts}
- /$E2/$DD { LOOP Col1a ;Loop till CX=0}
- {Exit:}
- );
- end;