home *** CD-ROM | disk | FTP | other *** search
- ; File......: RESTATT.ASM
- ; Author....: Ted Means
- ; Date......: $Date: 15 Aug 1991 23:08:02 $
- ; Revision..: $Revision: 1.1 $
- ; Log file..: $Logfile: E:/nanfor/src/restatt.asv $
- ;
- ; This is an original work by Ted Means and is placed in the
- ; public domain.
- ;
- ; Modification history:
- ; ---------------------
- ;
- ; $Log: E:/nanfor/src/restatt.asv $
- ;
- ; Rev 1.1 15 Aug 1991 23:08:02 GLENN
- ; Forest Belt proofread/edited/cleaned up doc
- ;
- ; Rev 1.0 12 Jun 1991 01:30:14 GLENN
- ; Initial revision.
- ;
-
-
- ; $DOC$
- ; $FUNCNAME$
- ; FT_RESTATT()
- ; $CATEGORY$
- ; Video
- ; $ONELINER$
- ; Restore the attribute bytes of a specified screen region.
- ; $SYNTAX$
- ; FT_RESTATT( <nTop>, <nLeft>, <nBottom>, <nRight>, <cAttributes> ) -> NIL
- ; $ARGUMENTS$
- ; <nTop>, <nLeft>, <nBottom>, and <nRight> define the screen region.
- ; <cAttributes> is a character string containing the attribute bytes
- ; for the screen region. This will most often be a string
- ; previously returned by FT_SAVEATT(), but any character
- ; string may be used (provided it is of the proper size).
- ; $RETURNS$
- ; NIL
- ; $DESCRIPTION$
- ; This function is similar to Clipper's RestScreen(), except that it only
- ; restores the attribute bytes. This is useful if you want to change the
- ; screen color without affecting the text.
- ;
- ; *** INTERNALS ALERT ***
- ;
- ; This function calls the Clipper internal __gtMaxCol to obtain the
- ; maximum column value for the current video mode. If you're too gutless
- ; to use internals, then this function isn't for you.
- ; $EXAMPLES$
- ; // Restore attributes of row 4
- ; FT_RESTATT( 4, 0, 4, maxcol(), cBuffer)
- ;
- ; // Restore attributes to middle of screen
- ; FT_RESTATT(10,20,14,59,cBuffer)
- ; $SEEALSO$
- ; FT_SAVEATT()
- ; $END$
- ;
-
- IDEAL
-
- Public FT_RESTATT
-
- Extrn __ParNI:Far
- Extrn __ParC:Far
- Extrn __gtMaxCol:Far ; INTERNAL!! INTERNAL!!
-
- Upper EQU Word Ptr BP - 2
- Left EQU Word Ptr BP - 4
- Lower EQU Word Ptr BP - 6
- Right EQU Word Ptr BP - 8
- MaxCol EQU Word Ptr BP - 10
-
- Segment _NanFor Word "CODE"
- Assume CS:_NanFor
-
- Proc FT_RESTATT Far
-
- Push BP ; Save BP
- Mov BP,SP ; Set up stack reference
- Sub SP,10 ; Allocate space for locals
-
- Call __gtMaxCol ; Get current value of maxcol()
- Inc AX ; Get column count
- Mov [MaxCol],AX ; Store in local
-
- Mov AX,1 ; Specify param #1
- Push AX ; Put on stack
- Call __ParNI ; Get value
- Mov [Upper],AX ; Store in local
-
- Mov AX,2 ; Specify param #2
- Push AX ; Put on stack
- Call __ParNI ; Get value
- Mov [Left],AX ; Store in local
-
- Mov AX,3 ; Specify param #3
- Push AX ; Put on stack
- Call __ParNI ; Get value
- Mov [Lower],AX ; Store in local
-
- Mov AX,4 ; Specify param #4
- Push AX ; Put on stack
- Call __ParNI ; Get value
- Mov [Right],AX ; Store in local
-
- Mov AX,5 ; Specify param #5
- Push AX ; Put on stack
- Call __ParC ; Get pointer to buffer
- Add SP,10 ; Realign stack
-
- SetPtr: Push DS ; Save registers and ensure
- Push SI ; clear direction flag
- Push DI
- CLD
-
- Mov DS,DX ; Set up DS:SI to point to
- Mov SI,AX ; passed buffer
- Xor AX,AX ; Clear AX
- Mov ES,AX ; Point ES to low memory
- Mov AX,0B800h ; Initalize video base
- Cmp [Word Ptr ES:463h],3B4h ; Monochrome?
- JNE SetVid ; No, continue
- Mov AX,0B000h ; Set video base to mono
-
- SetVid: Mov ES,AX ; Set video base
- Xor DI,DI ; Start at offset 0
- Mov CX,[Lower] ; Get lower row
- Sub CX,[Upper] ; Subtract upper row
- Inc CX ; Get number of rows
-
- Rows: Mov AX,CX ; Get row number
- Sub AX,[Lower] ; Subtract last row
- Dec AX ; Get negation of row
- Neg AX ; Convert to abs()
- Mul [MaxCol] ; Multiply by column count
- SHL AX,1 ; Multiply by two
- Mov BX,[Left] ; Get left column
- SHL BX,1 ; Multiply by two
- Inc BX ; Point to attribute byte
- Add BX,AX ; Add rows * columns
- Push CX ; Save row indicator
- Mov CX,[Right] ; Load right column
- Sub CX,[Left] ; Subtract left column
- Inc CX ; Get number of columns
- Cols: Lodsb ; Get attribute byte
- Mov [Byte Ptr ES:BX + DI],AL ; Store attribute byte
- Add BX,2 ; Point to next attribute byte
- Loop Cols ; Get next byte
- Pop CX ; Restore row indicator
- Loop Rows ; Do next row
-
- Done: Pop DI
- Pop SI
- Pop DS
- Mov SP,BP
- Pop BP
- Ret
- Endp FT_RESTATT
- Ends _NanFor
- End
-
-
-