home *** CD-ROM | disk | FTP | other *** search
- ;«RM82»«TS8,16,24,32,40,48,56,64»
- ; Updated 11/20/90
-
- ;============================================================================
- ; Copyright (C) Copr. 1990 by Sidney J. Kelly
- ; All Rights Reserved.
- ; Sidney J. Kelly
- ; 150 Woodhaven Drive
- ; Pittsburgh, PA 15228
- ; home phone 412-561-0950 (7pm to 9:30pm EST)
- ;============================================================================
-
-
- DOSSEG
- .model medium, Basic
-
- .data
- ;external data so all video routines can access
- EVEN
- EXTRN B$DVIDEOSEG:WORD
- EXTRN B$DVIDEOPORT:WORD
- EXTRN B$DVIDEOINSTL:BYTE
- .code
-
- INCLUDE NOWAIT.INC
- EXTRN Get_Adapter:FAR
- EXTRN SET_DI:FAR
-
- ;============================================================================
- ; VPRINT.ASM - performs Vertical Printing in the QuickBASIC
- ; DECLARE SUB VPRINT (BYVAL ROW%, BYVAL COL%, Text$, BYVAL ATTRIBUTE%)
- ; Works in TextMode only, ignores all special characters
- ; Sensitive to all video modes (i.e. no snow on CGA's)
- ; If no attribute is selected, the default attribute is &H07 (normal)
- ; Assumes: Display width is 80 columns
- ;============================================================================
-
- EVEN
- VPRINT Proc FAR BASIC USES SI DI, \
- ROW:Ptr, COLL:Ptr, TEXTSTRG:Ptr, ATTRIB:Ptr
-
- comment |
- Register usage when all done:
- AH = Color attribute for printing entire string.
- AL = temporarily holds the character to print.
- CX = Length of Text string.
- DX = Port for CGA video retrace check, if necessary.
- 0 means display is not a not a CGA display
- DI = Offset of Screen for current character
- ES = Segment of Video display, 0xB000 or 0xB800
- SI = Offset of Text$ String
- DS = Assumed to point to segment containing Text string.
- Program does not set this, so string is assumed to
- be a near string in DGROUP, the default in QB 4.5
- BX = is used as a scratch variable register
- |
-
-
- Cmp B$DVIDEOINSTL,1 ;See if we have done this before
- JE Didit ;yep, so skip ahead
- Call Get_Adapter ;call routine to find display type
-
- Didit:
- Mov CX,ROW ;read value of Row
- ; allow EGA 43 line/ VGA 50 line
- Dec CX ;convert to BIOS format
- Cmp CX,49 ;check if within range 1 to 50
- JA Exit ;exit if too large, or 0
- Mov DH,CL ;store ROW (CL) in DH
-
- Mov CX,COLL ;read value of COLL
- Dec CX ;convert to BIOS format
- Cmp CX,79 ;check if within range 1 to 80
- JA Exit ;exit if too large, or 0
- Mov DL,CL ;store COLL (CL) in DL
- CALL SET_DI ;call routin to find video seg offset in DI
-
- Mov ES,B$DVIDEOSEG ;restore the initialized values
- Mov DX,B$DVIDEOPORT ;puts 0 in DX if not CGA
- Mov AX,ATTRIB ;get the color ATTRIBUTE% that was passed
- Mov AH,AL ;put it into AH for screen writing below
- Or AH,AH ;& make sure attribute is not &H00
- Jnz @f ;this is the default if no attribute selected
- Mov AH,07 ;Default of black background, white letters
- @@:
- Mov SI,TEXTSTRG ;put descriptor to TEXT$ into SI
- Mov CX,[SI] ;put Len(TEXT$) into CX for loop counter
- JCXZ Exit ;if CX is zero it's a null string, exit now
- Mov SI,[SI+02] ;put address of first character in X$ into SI
- Cld ;clear the direction flag to move data forward
-
- Main_Loop:
- Or DX,DX ;are we on a mono or EGA system (is DX = 0)?
- JZ Mono ;yes, skip over the retrace stuff
-
- EVEN
- CGA:
- CLI ;prevent interrupts to speed routine
- Wait_CGA_Retrace ;wait for CGA retrace MACRO
- Lodsb ;get the character from TEXT$ and increment SI
- Stosw ;store both the character and attribute
- STI ;allow interrupts again
- Add DI,158 ;skipping down each row (Stosw already
- ;increments one character)
- Loop CGA ;loop until CX is zero
- Jmp Short Exit
- EVEN
- Mono:
- Lodsb ;get the character from TEXT$ and increment SI
- Stosw ;store both the character and attribute
- Add DI,158 ;skipping down each row (Stosw already
- ;increments one character)
- Loop Mono ;loop until CX is zero
-
- Exit:
- Ret ;return skipping the passed parameters
- VPRINT Endp
-
- ;============================================================================
- ; VPRT.ASM - performs Vertical Printing in the QuickBASIC
- ; DECLARE SUB VPRT (BYVAL ROW%, BYVAL COL%, TEXT$)
- ; Works in TextMode only, ignores all special characters
- ; Sensitive to all video modes (i.e. no snow on CGA's)
- ; Does not change the attribute, uses whatever was there.
- ; Assumes: Display width is 80 columns
- ;============================================================================
-
- EVEN
- VPRT Proc FAR BASIC USES SI DI, \
- ROW:Ptr, COLL:Ptr, TEXTSTRG:Ptr,
-
- Cmp B$DVIDEOINSTL,1 ;See if we have done this before
- JE Didit1 ;yep, so skip ahead
- Call Get_Adapter ;call routine to find display type
-
- Didit1:
- Mov CX,ROW ;read value of ROW
- ;--allow EGA 43 line/ VGA 50 line
- Dec CX ;convert to BIOS format, 0 wd become &HFFFF
- Cmp CX,49 ;check if within range 1 to 50
- JA Exit1 ;exit if too large
- Mov DH,CL ;store CL in DH
-
- Mov CX,COLL ;read value of COLL
- Dec CX ;convert to BIOS format, a 0 wd become &HFFFF
- Cmp CX,79 ;check if within range 1 to 80,
- JA Exit1 ;exit if too large, exit if >80 or = 0
- Mov DL,CL ;store CL in DL
-
- CALL SET_DI ;call routine to find video seg offset in DI
-
- Mov ES,B$DVIDEOSEG ;restore the initialized values
- Mov DX,B$DVIDEOPORT ;DX = 0 if not CGA, else CGA retrace port
-
- Mov SI,TEXTSTRG ;put descriptor to TEXT$ into SI
- Mov CX,[SI] ;put Len(TEXT$) into CX for loop counter
- JCXZ Exit1 ;if CX is zero it's a null string, exit now
- Mov SI,[SI+02] ;put address of first character in X$ into SI
- Cld ;clear the direction flag to move data forward
-
- Main_Loop1:
- OR DX,DX ;are we on a mono or EGA system (is DX = 0)?
- JZ Mono1 ;yes, skip over the retrace stuff
-
- EVEN ; speeds loop
- CGA1:
- CLI ;prevent interrupts to speed routine
- Wait_CGA_Retrace ;wait for CGA retrace MACRO
- Lodsb ;get the character from TEXT$ and increment SI
- Stosb ;store just the character but not the attribute
- STI ;allow interrupts again
- Add DI,159 ;skipping down each row
- Loop CGA1 ;loop until CX is zero
- Jmp Short Exit1
-
- EVEN ; speeds loop
- Mono1:
- Lodsb ;get the character from TEXT$ and increment SI
- Stosb ;store just the character but not the attribute
- Add DI,159 ;skipping down each row
- Loop Mono1 ;loop until CX is zero
-
- Exit1:
- Ret ;return skipping the passed parameters
- VPRT Endp
- END
-