home *** CD-ROM | disk | FTP | other *** search
- PAGE 60,132
- TITLE fxVX.ASM -- PCX Effects
- SUBTTL Copyright (c) Genus Microprogramming, Inc. 1988-89
-
- ; fxVX.ASM ;
- ; Copyright (c) Genus Microprogramming, Inc. 1988-89 All Rights Reserved. ;
-
- ;****************************************************************************;
- ; ;
- ; This file contains procedures for taking a pcx virtual buffer and ;
- ; 'exploding' it on the display. ;
- ; ;
- ; Procedures: fxVirtualExplode ;
- ; ;
- ; ;
- ; ;
- ; Microsoft ASM 5.x version. Programmer: Chris Howard 5/02/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 fxVirtualExplode
-
- ;**********
-
- ;
- ; This is the Virtual Explode 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
- ;
-
- fxVirtualExplode PROC FAR
-
- mov ax,vedir ;What direction?
- cmp ax,fxIN ;IN?
- je fxVX_in
-
- jmp fxVX_out ;Default to OUT ...
-
- fxVX_in:
-
- mov ax,vedepth ;Get the depth
- sub ax,vevgrain ; and sub the grain
- dec ax
- mov veloopmax,ax ;Store as the loop maximum
-
- mov si,0 ;Initialize loop counters
- mov di,vevgrain
- inc di
-
- mov ax,veloopmax ; and get others
- push ax
- push di
- push si
-
- fxVX_invert:
-
- mov ax,vevhalf ;Get the middle
- sub ax,vevgrain ;Sub the grain
- mov veloopmax,ax ;Store as the loop maximum
-
- mov si,0 ;Initialize left
- mov di,vevgrain ; and right loop counters
-
- fxVX_invertloop:
-
- mov ax,vevseg ;vptr
- push ax
- mov ax,vevofs
- push ax
-
- mov dx,si
- cmp dx,veloopmax ;Is loop past a grain increment?
- jle fxVX_inrightvx ;If not, continue
-
- mov dx,veloopmax ;Otherwise, reset
-
- fxVX_inrightvx:
-
- push dx ;vx = loop
- xor ax,ax ;vy = 0
- push ax
- mov bx,vex ;x = x+loop
- add bx,dx
- push bx
- mov ax,vey ;y = y
- push ax
- add bx,vevgrain ;x2 = x+loop+grain
- push bx
- mov ax,vey2 ;y2 = y2
- push ax
- mov ax,vepage ;page = current
- push ax
-
- call pcxVirtualDisplay ;Display this part
-
- mov ax,vevseg ;vptr
- push ax
- mov ax,vevofs
- push ax
-
- cmp di,vewidth ;Is loop past a grain increment?
- jle fxVX_inleftvx ;If not, continue
-
- mov di,vewidth ;Otherwise, reset
-
- fxVX_inleftvx:
-
- mov ax,vewidth ;vx = width-loop
- sub ax,di
- push ax
- xor ax,ax ;vy = 0
- push ax
- mov bx,vex2 ;x = x2-loop
- inc bx
- sub bx,di
- push bx
- mov ax,vey ;y = y
- push ax
- add bx,vevgrain ;x2 = x2-loop+grain
- push bx
- mov ax,vey2 ;y2 = y2
- push ax
- mov ax,vepage ;page = current
- push ax
-
- call pcxVirtualDisplay ;Display this part
-
- pop ax ;Get previous pointers
- pop bx
- pop cx
-
- mov dx,veloopmax ; and get others
- push dx
- push di
- push si
-
- mov si,ax ;Put into appropriate regs
- mov di,bx
-
- mov veloopmax,cx
-
- fxVX_inhorizloop:
-
- mov ax,vevseg ;vptr
- push ax
- mov ax,vevofs
- push ax
- xor ax,ax ;vx = 0
- push ax
-
- mov dx,si
- cmp dx,veloopmax ;Is loop past a grain increment?
- jle fxVX_indownvy ;If not, continue
-
- mov dx,veloopmax ;Otherwise, reset
-
- fxVX_indownvy:
-
- push dx ;vy = loop
- mov ax,vex ;x = x
- push ax
- mov bx,vey ;y = y+loop
- add bx,dx
- push bx
- mov ax,vex2 ;x2 = x2
- push ax
- add bx,vevgrain ;y2 = y+loop+grain
- push bx
- mov ax,vepage ;page = current
- push ax
-
- call pcxVirtualDisplay ;Display this part
-
- mov ax,vevseg ;vptr
- push ax
- mov ax,vevofs
- push ax
- xor ax,ax ;vx = 0
- push ax
-
- cmp di,vedepth ;Is loop past a grain increment?
- jle fxVX_inupvy ;If not, continue
-
- mov di,vedepth ;Otherwise, reset
-
- fxVX_inupvy:
-
- mov ax,vedepth ;vy = depth-loop
- sub ax,di
- push ax
- mov ax,vex ;x = x
- push ax
- mov bx,vey2 ;y = y2-loop
- inc bx
- sub bx,di
- push bx
- mov ax,vex2 ;x2 = x2
- push ax
- add bx,vevgrain ;y2 = y2-loop+grain
- push bx
- mov ax,vepage ;page = current
- push ax
-
- call pcxVirtualDisplay ;Display this part
-
- mov ax,vedelay ;Get the delay count
- push ax
-
- call fxEffectDelay ; and delay
-
- jnc fxVX_inhorizbump ;If no error, continue
- jmp fxVX_error
-
- fxVX_inhorizbump:
-
- add di,vevgrain ;Bump our loop counters
- add si,vevgrain
- cmp si,vehhalf ;Have we done the entire image?
- jl fxVX_inhorizdone ;If not, continue
-
- sub di,vevgrain
- sub si,vevgrain
-
- fxVX_inhorizdone:
-
- pop ax ;Get previous pointers
- pop bx
- pop cx
-
- mov dx,veloopmax ; and get others
- push dx
- push di
- push si
-
- mov si,ax ;Put into appropriate regs
- mov di,bx
-
- mov veloopmax,cx
-
- cmp si,veloopmax ;Have we done the entire image?
- jge fxVX_invertdone
-
- add si,vevgrain ;Bump our loop counters
- add di,vevgrain
- jmp fxVX_invertloop ; and loop
-
- fxVX_invertdone:
-
- pop dx ;Get rid of stack variables
- pop dx
- pop dx
-
- @SetRet veret,fxSUCCESS ;Set the return code
- jmp fxVX_exit ; and exit
-
- fxVX_out:
-
- mov ax,vedepth ;Get the depth
- sub ax,vevgrain ; and sub the grain
- dec ax
- mov veloopmax,ax ;Store as the loop maximum
-
- mov si,vehhalf ;Initialize loop counters
- mov di,vehhalf
- inc di
-
- mov ax,veloopmax ; and get others
- push ax
- push di
- push si
-
- fxVX_vert:
-
- mov ax,vewidth ;Get the middle
- sub ax,vevgrain ;Sub the grain
- mov veloopmax,ax ;Store as the loop maximum
-
- mov si,vevhalf ;Initialize left
- mov di,vevhalf ; and right loop counters
- add di,vevgrain
-
- fxVX_vertloop:
-
- mov ax,vevseg ;vptr
- push ax
- mov ax,vevofs
- push ax
-
- mov dx,si
- cmp dx,veloopmax ;Is loop past a grain increment?
- jle fxVX_rightvx ;If not, continue
-
- mov dx,veloopmax ;Otherwise, reset
-
- fxVX_rightvx:
-
- push dx ;vx = loop
- xor ax,ax ;vy = 0
- push ax
- mov bx,vex ;x = x+loop
- add bx,dx
- push bx
- mov ax,vey ;y = y
- push ax
- add bx,vevgrain ;x2 = x+loop+grain
- push bx
- mov ax,vey2 ;y2 = y2
- push ax
- mov ax,vepage ;page = current
- push ax
-
- call pcxVirtualDisplay ;Display this part
-
- mov ax,vevseg ;vptr
- push ax
- mov ax,vevofs
- push ax
-
- cmp di,vewidth ;Is loop past a grain increment?
- jle fxVX_leftvx ;If not, continue
-
- mov di,vewidth ;Otherwise, reset
-
- fxVX_leftvx:
-
- mov ax,vewidth ;vx = width-loop
- sub ax,di
- push ax
- xor ax,ax ;vy = 0
- push ax
- mov bx,vex2 ;x = x2-loop
- inc bx
- sub bx,di
- push bx
- mov ax,vey ;y = y
- push ax
- add bx,vevgrain ;x2 = x2-loop+grain
- push bx
- mov ax,vey2 ;y2 = y2
- push ax
- mov ax,vepage ;page = current
- push ax
-
- call pcxVirtualDisplay ;Display this part
-
- pop ax ;Get previous pointers
- pop bx
- pop cx
-
- mov dx,veloopmax ; and get others
- push dx
- push di
- push si
-
- mov si,ax ;Put into appropriate regs
- mov di,bx
-
- mov veloopmax,cx
-
- fxVX_horizloop:
-
- mov ax,vevseg ;vptr
- push ax
- mov ax,vevofs
- push ax
- xor ax,ax ;vx = 0
- push ax
-
- mov dx,si
- cmp dx,veloopmax ;Is loop past a grain increment?
- jle fxVX_downvy ;If not, continue
-
- mov dx,veloopmax ;Otherwise, reset
-
- fxVX_downvy:
-
- push dx ;vy = loop
- mov ax,vex ;x = x
- push ax
- mov bx,vey ;y = y+loop
- add bx,dx
- push bx
- mov ax,vex2 ;x2 = x2
- push ax
- add bx,vevgrain ;y2 = y+loop+grain
- push bx
- mov ax,vepage ;page = current
- push ax
-
- call pcxVirtualDisplay ;Display this part
-
- mov ax,vevseg ;vptr
- push ax
- mov ax,vevofs
- push ax
- xor ax,ax ;vx = 0
- push ax
-
- cmp di,vedepth ;Is loop past a grain increment?
- jle fxVX_upvy ;If not, continue
-
- mov di,vedepth ;Otherwise, reset
-
- fxVX_upvy:
-
- mov ax,vedepth ;vy = depth-loop
- sub ax,di
- push ax
- mov ax,vex ;x = x
- push ax
- mov bx,vey2 ;y = y2-loop
- inc bx
- sub bx,di
- push bx
- mov ax,vex2 ;x2 = x2
- push ax
- add bx,vevgrain ;y2 = y2-loop+grain
- push bx
- mov ax,vepage ;page = current
- push ax
-
- call pcxVirtualDisplay ;Display this part
-
- mov ax,vedelay ;Get the delay count
- push ax
-
- call fxEffectDelay ; and delay
-
- jnc fxVX_upbump ;If no error, continue
- jmp SHORT fxVX_error
-
- fxVX_upbump:
-
- cmp di,vedepth ;Have we done the entire image?
- ; (NOTE: use DI, since SI will
- ; NEVER overrun edge ...)
- jge fxVX_horizdone
-
- add di,vevgrain ;Bump our loop counters
- add si,vevgrain
-
- fxVX_horizdone:
-
- pop ax ;Get previous pointers
- pop bx
- pop cx
-
- mov dx,veloopmax ; and get others
- push dx
- push di
- push si
-
- mov si,ax ;Put into appropriate regs
- mov di,bx
-
- mov veloopmax,cx
-
- fxVX_leftbump:
-
- cmp si,veloopmax ;Have we done the entire image?
- jge fxVX_vertdone
-
- add si,vevgrain ;Bump our loop counters
- add di,vevgrain
- jmp fxVX_vertloop ; and loop
-
- fxVX_vertdone:
-
- pop dx ;Get rid of stack variables
- pop dx
- pop dx
-
- @SetRet veret,fxSUCCESS ;Set the return code
- jmp SHORT fxVX_exit
-
- fxVX_error:
-
- pop dx ;Get rid of stack variables
- pop dx
- pop dx
-
- @SetRet veret,ax ;Set the error code
-
- fxVX_exit:
-
- @Exit veret,veparm ;Return
-
- fxVirtualExplode ENDP
-
- @EndCode
-
- END
-