home *** CD-ROM | disk | FTP | other *** search
- PAGE 60,132
- TITLE fxVD.ASM -- PCX Effects
- SUBTTL Copyright (c) Genus Microprogramming, Inc. 1988-89
-
- ; fxVD.ASM ;
- ; Copyright (c) Genus Microprogramming, Inc. 1988-89 All Rights Reserved. ;
-
- ;****************************************************************************;
- ; ;
- ; This file contains procedures for taking a pcx virtual buffer and ;
- ; 'wiping' it on the display, diagonally. ;
- ; ;
- ; Procedures: fxVirtualGrid ;
- ; fxVirtualBox ;
- ; fxVirtualDiag ;
- ; ;
- ; ;
- ; Microsoft ASM 5.x version. Programmer: Chris Howard 3/15/89 ;
- ; ;
- ;****************************************************************************;
-
- ; Include files
- INCLUDE ..\inc\pcxDefs.inc
- INCLUDE ..\inc\pcxMacs.inc
- INCLUDE ..\inc\pcxErrs.inc
-
- INCLUDE ..\inc\fxDefs.inc
- INCLUDE ..\inc\fxMacs.inc
- INCLUDE ..\inc\fxErrs.inc
-
- @SetModel
-
- @BegData
- @EndData
-
- @BegCode
-
- EXTRN pcxVirtualDisplay : FAR
- EXTRN fxEffectDelay : FAR
-
- PUBLIC fxVirtualGrid
- PUBLIC fxVirtualBox
- PUBLIC fxVirtualDiag
-
- ;**********
-
- ;
- ; This is a short procedure that initializes the box grid for the diagonal
- ; and spiral type effects.
- ;
- ;
-
- fxVirtualGrid PROC FAR
-
- mov ax,vedepth ;Calc number of grids down
- xor dx,dx ; (We actually divide, then
- mov bx,vevgrain ; add one for remainder, and
- div bx ; sub one to make it zero based)
- cmp dx,0
- jne fxVG_jmax
-
- dec ax ;Adjust for even number of grids
-
- fxVG_jmax:
-
- mov vejmax,ax ;Store it
-
- mov ax,vewidth ;Calc number of grids across
- xor dx,dx
- div bx
- cmp dx,0
- jne fxVG_imax
-
- dec ax ;Adjust for even number of grids
-
- fxVG_imax:
-
- mov veimax,ax ;Store it
-
- mov ax,vevgrain ;Get the grain
- sub vewidth,ax ; and modify the width and
- sub vedepth,ax ; depth
-
- ret
-
- fxVirtualGrid ENDP
-
- ;**********
-
- ;
- ; This is a short procedure that displays a box of a given size, located
- ; on a (row,col) grid.
- ;
- ;
-
- fxVirtualBox PROC FAR
-
- push cx
-
- mov ax,vevseg ;vptr
- push ax
- mov ax,vevofs
- push ax
-
- mov ax,si ;vx = row*grain
- mov bx,vevgrain
- mul bx
-
- cmp ax,vewidth ;Make sure within bounds
- jb fxVB_vx
-
- mov ax,vewidth
-
- fxVB_vx:
-
- mov cx,ax ;Save this value
- push ax
-
- mov ax,di ;vy = col*grain
- mul bx
-
- cmp ax,vedepth ;Make sure within bounds
- jb fxVB_vy
-
- mov ax,vedepth
-
- fxVB_vy:
-
- mov dx,ax ;Save this value
- push ax
-
- add cx,vex ;x = x+vx
- push cx
- add dx,vey ;y = y+vy
- push dx
-
- fxVB_grain:
-
- add cx,vevgrain ;x2 = x+grain
- dec cx
- push cx
- add dx,vevgrain ;y2 = y+grain
- dec dx
- push dx
- mov ax,vepage ;page = current
- push ax
-
- call pcxVirtualDisplay ;Display this part
-
- pop cx
-
- ret
-
- fxVirtualBox ENDP
-
- ;**********
-
- ;
- ; This is the Virtual Diag effect procedure, for the fxVirtualEffect
- ; interface. It is an INTERNAL routine only.
- ;
- ; On Entry: SS:BP points to pcxVirtualEffect frame
- ; ES:DI points to display structure
- ; DS:SI points to buffer
- ;
- ; On Exit: retcode contains error code, if any
- ;
-
- fxVirtualDiag PROC FAR
-
- mov ax,vedepth ;Get the depth
- add ax,vewidth
- mov bx,vevgrain ; and sub the grain
- xor dx,dx
- div bx
- mov veloopmax,ax ;Store as the loop maximum
-
- call fxVirtualGrid
-
- fxVD_dir:
-
- mov ax,vedir ;What direction?
- cmp ax,fxRIGHT+fxUP ;Right and up
- jne fxVD_lefttest
-
- jmp fxVD_right
-
- fxVD_lefttest:
-
- cmp ax,fxLEFT+fxDOWN ;Left and down
- jne fxVD_uptest
-
- jmp fxVD_left
-
- fxVD_uptest:
-
- cmp ax,fxLEFT+fxUP ;Left and up
- jne fxVD_down
-
- jmp SHORT fxVD_up
-
- fxVD_down:
-
- mov si,0 ;Initialize loop counters
- mov di,0
-
- mov vei,si ;Store index
-
- mov cx,veloopmax ;Loop set number of times
-
- fxVD_downloop:
-
- call fxVirtualBox ;Display this box
-
- cmp si,0 ;Have we reached the left edge?
- je fxVD_downcol ;If so, bump down
-
- cmp di,vejmax ;Have we reached the bottom edge?
- je fxVD_downcol ;If so, bump down
-
- dec si ;Otherwise, shift left a column
- inc di ; and down a row
-
- jmp fxVD_downloop ;Loop
-
- fxVD_downcol:
-
- mov ax,vedelay ;Get the delay count
- push ax
-
- call fxEffectDelay ; and delay
-
- jnc fxVD_downbump ;If no error, continue
- jmp fxVD_error
-
- fxVD_downbump:
-
- mov si,vei ;Get the current index
- inc si ; bump
- mov vei,si ; and store again
-
- xor di,di ;Clear row index
-
- cmp si,veimax ;Are we past the right edge?
- jle fxVD_downchk ;If not, loop
-
- mov di,si ;We are, so reposition
- sub di,veimax
-
- mov si,veimax
-
- fxVD_downchk:
-
- loop fxVD_downloop ;If not, loop
-
- @SetRet veret,fxSUCCESS ;Set the return code
- jmp fxVD_exit ; and exit
-
- fxVD_up:
-
- mov si,veimax ;Initialize loop counters
- mov di,vejmax
-
- mov vei,si ;Store index
-
- mov cx,veloopmax ;Loop set number of times
-
- fxVD_uploop:
-
- call fxVirtualBox ;Display this box
-
- cmp si,veimax ;Have we reached the right edge?
- je fxVD_upcol ;If so, bump up
-
- cmp di,0 ;Have we reached the top edge?
- je fxVD_upcol ;If so, bump up
-
- inc si ;Otherwise, shift left a column
- dec di ; and up a row
-
- jmp fxVD_uploop ;Loop
-
- fxVD_upcol:
-
- mov ax,vedelay ;Get the delay count
- push ax
-
- call fxEffectDelay ; and delay
-
- jnc fxVD_upbump ;If no error, continue
- jmp fxVD_error
-
- fxVD_upbump:
-
- mov si,vei ;Get the current index
- dec si ; bump
- mov vei,si ; and store again
-
- mov di,vejmax ;Clear row index
-
- cmp si,0 ;Are we past the left edge?
- jge fxVD_upchk ;If not, loop
-
- add di,si ;We are, so reposition
- mov si,0
-
- fxVD_upchk:
-
- loop fxVD_uploop ;If not, loop
-
- @SetRet veret,fxSUCCESS ;Set the return code
- jmp fxVD_exit ; and exit
-
- fxVD_right:
-
- mov si,0 ;Initialize loop counters
- mov di,vejmax
-
- mov vei,si ;Store index
-
- mov cx,veloopmax ;Loop set number of times
-
- fxVD_rightloop:
-
- call fxVirtualBox ;Display this box
-
- cmp si,0 ;Have we reached the left edge?
- je fxVD_rightcol ;If so, bump down
-
- cmp di,0 ;Have we reached the top edge?
- je fxVD_rightcol ;If so, bump down
-
- dec si ;Otherwise, shift left a column
- dec di ; and down a row
-
- jmp fxVD_rightloop ;Loop
-
- fxVD_rightcol:
-
- mov ax,vedelay ;Get the delay count
- push ax
-
- call fxEffectDelay ; and delay
-
- jnc fxVD_rightbump ;If no error, continue
- jmp SHORT fxVD_error
-
- fxVD_rightbump:
-
- mov si,vei ;Get the current index
- inc si ; bump
- mov vei,si ; and store again
-
- mov di,vejmax ;Reset row index
-
- cmp si,veimax ;Are we past the right edge?
- jle fxVD_rightchk ;If not, loop
-
- sub si,veimax ;We are, so reposition
- sub di,si
-
- mov si,veimax
-
- fxVD_rightchk:
-
- loop fxVD_rightloop ;If not, loop
-
- @SetRet veret,fxSUCCESS ;Set the return code
- jmp SHORT fxVD_exit ; and exit
-
- fxVD_left:
-
- mov si,veimax ;Initialize loop counters
- mov di,0
-
- mov vei,si ;Store index
-
- mov cx,veloopmax ;Loop set number of times
-
- fxVD_leftloop:
-
- call fxVirtualBox ;Display this box
-
- cmp si,veimax ;Have we reached the right edge?
- je fxVD_leftcol ;If so, bump down
-
- cmp di,vejmax ;Have we reached the bottom edge?
- je fxVD_leftcol ;If so, bump down
-
- inc si ;Otherwise, shift left a column
- inc di ; and down a row
-
- jmp fxVD_leftloop ;Loop
-
- fxVD_leftcol:
-
- mov ax,vedelay ;Get the delay count
- push ax
-
- call fxEffectDelay ; and delay
-
- jnc fxVD_leftbump ;If no error, continue
- jmp SHORT fxVD_error
-
- fxVD_leftbump:
-
- mov si,vei ;Get the current index
- dec si ; bump
- mov vei,si ; and store again
-
- mov di,0 ;Reset row index
-
- cmp si,0 ;Are we past the left edge?
- jge fxVD_leftchk ;If not, loop
-
- neg si ;We are, so reposition
- add di,si
-
- mov si,0
-
- fxVD_leftchk:
-
- loop fxVD_leftloop ;If not, loop
-
- @SetRet veret,fxSUCCESS ;Set the return code
- jmp SHORT fxVD_exit ; and exit
-
- fxVD_error:
-
- @SetRet veret,ax ;Set the return code
-
- fxVD_exit:
-
- @Exit veret,veparm ;Return
-
- fxVirtualDiag ENDP
-
- @EndCode
-
- END
-