home *** CD-ROM | disk | FTP | other *** search
- ; File......: SHADOW.ASM
- ; Author....: Reginald B. Walton; Modified by Ted Means
- ; Date......: $Date: 15 Aug 1991 23:07:26 $
- ; Revision..: $Revision: 1.2 $
- ; Log file..: $Logfile: E:/nanfor/src/shadow.asv $
- ;
- ; This is an original work by Reginald B. Walton and is placed in the
- ; public domain.
- ;
- ; Modification history:
- ; ---------------------
- ;
- ; $Log: E:/nanfor/src/shadow.asv $
- ;
- ; Rev 1.2 15 Aug 1991 23:07:26 GLENN
- ; Forest Belt proofread/edited/cleaned up doc
- ;
- ; Rev 1.1 11 May 1991 00:29:22 GLENN
- ; Major re-write by Ted Means. He sped it up. It will also cooperate
- ; with Clipper's internal _gtmaxrow and _gtmaxcol settings.
- ;
- ; Rev 1.0 02 Apr 1991 18:25:40 GLENN
- ; Nanforum Toolkit
- ;
- ;
-
-
- ; $DOC$
- ; $FUNCNAME$
- ; FT_SHADOW()
- ; $CATEGORY$
- ; Video
- ; $ONELINER$
- ; Draw a non-destructive shadow on the screen
- ; $SYNTAX$
- ; FT_SHADOW( <nTop>, <nLeft>, <nBottom>, <nRight> ) -> NIL
- ; $ARGUMENTS$
- ; <nTop> is the top row of the shadow area.
- ;
- ; <nLeft> is the upper left column of the shadow area.
- ;
- ; <nBottom> is the bottom row of the shadow area.
- ;
- ; <nRight> is the lower right column of the shadow area.
- ; $RETURNS$
- ; NIL
- ; $DESCRIPTION$
- ; This function was designed to have my application emulate the
- ; non-destructive shadowing of the PC-TOOLS application. This function
- ; was written in Assembly language for speed since, the same function
- ; written in Clipper was too slow. The size of this function could be
- ; reduced by re-writing the SET_CUR_POSITION, READ_CHARACTER, and
- ; WRITE_CHARACTER macros as procedures. Note: this will slow it down
- ; a tad, since stack manipulation will be involved.
- ;
- ; 1. If you are using the SAVESCREEN() function to save your screen,
- ; remember to save enough screen for the shadow. The shadow will
- ; require 1 row and 2 columns.
- ;
- ; save_win = SAVESCREEN(Trow,Tcol,Brow+1,Bcol+2)
- ;
- ; 2. *** INTERNALS ALERT *** This function uses several Clipper internal
- ; routines. If using internals scares you, then stay away from this
- ; function, you gutless weasel.
- ;
- ; The source code is written to MASM specifications. To use another
- ; assembler, either invoke that assembler's MASM compatibility switch,
- ; or make the required modifications to the source code.
- ; $EXAMPLES$
- ; LOCAL Save_Win := SaveScreen(10,10,21,52) // save enough for the shadow
- ; FT_SHADOW(10,10,20,50) // draw shadow
- ;
- ; ...
- ; do what ya' like
- ; ...
- ;
- ; RestScreen(10,10,21,52,Save_Win) // restore screen
- ; RETURN
- ; $END$
-
-
- Public FT_SHADOW
-
- TopRow EQU Word Ptr BP - 2 ; Top row
- TopCol EQU Word Ptr BP - 4 ; Top column
- BotRow EQU Word Ptr BP - 6 ; Bottom row
- BotCol EQU Word Ptr BP - 8 ; Bottom column
- MaxRow EQU Word Ptr BP - 10 ; MaxRow()
- MaxCol EQU Word Ptr BP - 12 ; MaxCol()
-
- Extrn __ParNI:Far
- Extrn __Ret:Far
- Extrn __gtMaxRow:Far ; INTERNAL!!! INTERNAL!!!
- Extrn __gtMaxCol:Far ; INTERNAL!!! INTERNAL!!!
- Extrn __No_Snow:Word ; INTERNAL!!! INTERNAL!!!
-
- _NanFor Segment Word PUBLIC 'CODE'
- Assume CS:_NanFor
-
- FT_SHADOW Proc Far
-
- Push BP ; Save BP
- Mov BP,SP ; Set up stack reference
- Sub SP,12 ; Allocate room for locals
-
- Call __gtMaxRow ; Get maxrow()
- Mov [MaxRow],AX ; Store it
- Call __gtMaxCol ; Get maxcol()
- Mov [MaxCol],AX ; Store it
-
- Mov AX,1 ; Specify param #
- Push AX ; Put on stack
- Call __ParNI ; Retrieve value
- Mov [TopRow],AX ; Store it in TopRow
-
- Mov AX,2 ; Specify param #
- Push AX ; Put on stack
- Call __ParNI ; Retrieve value
- Mov [TopCol],AX ; Store it in TopCol
-
- Mov AX,3 ; Specify param #
- Push AX ; Put on stack
- Call __ParNI ; Retrieve value
- Mov [BotRow],AX ; Store it in BotRow
-
- Mov AX,4 ; Specify param #
- Push AX ; Put on stack
- Call __ParNI ; Retrieve value
- Mov [BotCol],AX ; Store it in BotCol
-
- Xor AX,AX ; Clear AX
- Mov ES,AX ; Set ES to low memory
- Mov AX,0B800h ; Default to color
- Cmp [ES:463h],3B4h ; Monochrome present?
- JNE Vertical ; If not, continue
- Mov AX,0B000h ; Switch to mono video base
-
- Vertical:Mov ES,AX ; Initalize video base
- Mov AX,[TopRow] ; Get top row
- Inc AX ; Start one row down
- Mov DX,[MaxCol] ; Get maxcol()
- Inc DX ; Compensate for zero start
- Mul DX ; Calculate offset of row, 0
- Add AX,[BotCol] ; Now get offset of last column
- Inc AX ; Go one past for shadow location
- SHL AX,1 ; Multiply by two
- Inc AX ; Point to attribute byte
- Mov BX,AX ; Move offset to BX
- Mov CX,[BotRow] ; Get last row
- Sub CX,[TopRow] ; Subtract first row
-
- VTop: Cmp [__No_Snow],0 ; Snow check in effect?
- JE VSetAttr ; If not, continue
- Mov DX,3DAh ; Specify status port
- VWait: In AL,DX ; Get status
- Test AL,8 ; Vertical retrace in progress?
- JZ VWait ; No, so wait for it
- VSetAttr:Mov Byte Ptr [ES:BX],7 ; Set shadow attribute
- Mov Byte Ptr [ES:BX + 2],7 ; Set shadow attribute
- Mov DX,[MaxCol] ; Get maxcol
- Inc DX ; Compensate for zero start
- SHL DX,1 ; Multiply by two
- Add BX,DX ; Set offset to next column
- Loop VTop ; Do next row
-
- Horizontal:
- Mov AX,[BotRow] ; Get bottom row
- Inc AX ; Go one past for shadow
- Mov DX,[MaxCol] ; Get maxcol()
- Inc DX ; Compensate for zero start
- Mul DX ; Calculate offset of row, 0
- Add AX,[TopCol] ; Now get offset of first column
- Inc AX ; Start one column in
- SHL AX,1 ; Multiply by two
- Inc AX ; Point to attribute byte
- Mov BX,AX ; Move offset to BX
- Mov CX,[BotCol] ; Get last column
- Sub CX,[TopCol] ; Subtract first column
- Add CX,2 ; Calulate loop terminal value
-
- HTop: Cmp [__No_Snow],0 ; Snow check in effect?
- JE HSetAttr ; If not, continue
- Mov DX,3DAh ; Specify status port
- HWait: In AL,DX ; Get status
- Test AL,8 ; Vertical retrace in progress?
- JZ HWait ; No, so wait for it
- HSetAttr:Mov Byte Ptr [ES:BX],7 ; Set shadow attribute
- Add BX,2 ; Set offset to next column
- Loop HTop ; Do next row
-
- Exit: Mov SP,BP
- Pop BP
- Call __Ret ; Return NIL
- Ret ; Go on back to Clipper
-
- FT_SHADOW Endp
- _NanFor Ends
- End
-