home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c011 / 1.ddi / SOURCE / FXVC.ASM < prev    next >
Encoding:
Assembly Source File  |  1989-06-01  |  8.9 KB  |  267 lines

  1.   PAGE    60,132
  2.   TITLE   fxVC.ASM -- PCX Effects
  3.   SUBTTL  Copyright (c) Genus Microprogramming, Inc. 1988-89
  4.  
  5. ; fxVC.ASM                                                                   ;
  6. ; Copyright (c) Genus Microprogramming, Inc. 1988-89  All Rights Reserved.   ;
  7.  
  8. ;****************************************************************************;
  9. ;                                                                            ;
  10. ; This file contains procedures for taking a pcx virtual buffer and          ;
  11. ; 'crushing' it on the display.                                              ;
  12. ;                                                                            ;
  13. ; Procedures: fxVirtualCrush                                                 ;
  14. ;                                                                            ;
  15. ;                                                                            ;
  16. ;                                                                            ;
  17. ; Microsoft ASM 5.x version.              Programmer: Chris Howard  3/15/89  ;
  18. ;                                                                            ;
  19. ;****************************************************************************;
  20.  
  21. ; Include files
  22.   INCLUDE ..\inc\pcxDefs.inc
  23.   INCLUDE ..\inc\pcxMacs.inc
  24.   INCLUDE ..\inc\pcxErrs.inc
  25.  
  26.   INCLUDE ..\inc\fxDefs.inc
  27.   INCLUDE ..\inc\fxMacs.inc
  28.   INCLUDE ..\inc\fxErrs.inc
  29.  
  30.   @SetModel
  31.  
  32.   @BegData
  33.   @EndData
  34.  
  35.   @BegCode
  36.  
  37.           EXTRN     pcxVirtualDisplay       : FAR
  38.           EXTRN     fxEffectDelay           : FAR
  39.  
  40.           PUBLIC    fxVirtualCrush
  41.  
  42. ;**********
  43.  
  44. ;
  45. ; This is the Virtual Crush effect procedure, for the fxVirtualEffect
  46. ; interface.  It is an INTERNAL routine only.
  47. ;
  48. ; On Entry:  SS:BP    points to pcxVirtualEffect frame
  49. ;            ES:DI    points to display structure
  50. ;            DS:SI    points to buffer
  51. ;
  52. ; On Exit:   retcode  contains error code, if any
  53. ;
  54.  
  55. fxVirtualCrush      PROC FAR
  56.                     
  57.           mov       ax,vedir                ;What direction?
  58.           cmp       ax,fxVERT               ;Vertical  
  59.           jne       fxVC_horiz   
  60.  
  61.           jmp       fxVC_vert 
  62.  
  63. fxVC_horiz:
  64.  
  65.           inc       WORD PTR vey2           ;Bump Y2, to comp for later add
  66.  
  67.           mov       ax,vedepth              ;Get the depth
  68.           sub       ax,vegrain              ; and sub the grain
  69.           dec       ax
  70.           mov       veloopmax,ax            ;Store as the loop maximum
  71.           
  72.           mov       si,0                    ;Initialize loop counters
  73.           mov       di,vegrain
  74.           inc       di
  75.  
  76. fxVC_horizloop:
  77.  
  78.           mov       ax,vevseg               ;vptr
  79.           push      ax
  80.           mov       ax,vevofs
  81.           push      ax
  82.           xor       ax,ax                   ;vx   = 0
  83.           push      ax
  84.  
  85.           mov       dx,si
  86.           cmp       dx,veloopmax            ;Is loop past a grain increment?
  87.           jle       fxVC_downvy             ;If not, continue
  88.  
  89.           mov       dx,veloopmax            ;Otherwise, reset
  90.  
  91. fxVC_downvy:
  92.  
  93.           push      dx                      ;vy   = loop
  94.           mov       ax,vex                  ;x    = x
  95.           push      ax
  96.           mov       bx,vey                  ;y    = y+loop
  97.           add       bx,dx
  98.           push      bx
  99.           mov       ax,vex2                 ;x2   = x2
  100.           push      ax                           
  101.           add       bx,vegrain              ;y2   = y+loop+grain
  102.           push      bx
  103.           mov       ax,vepage               ;page = current
  104.           push      ax                      
  105.  
  106.           call      pcxVirtualDisplay       ;Display this part
  107.  
  108.           mov       ax,vevseg               ;vptr
  109.           push      ax
  110.           mov       ax,vevofs
  111.           push      ax
  112.           xor       ax,ax                   ;vx   = 0
  113.           push      ax
  114.  
  115.           cmp       di,vedepth              ;Is loop past a grain increment?
  116.           jle       fxVC_upvy               ;If not, continue
  117.  
  118.           mov       di,vedepth              ;Otherwise, reset
  119.  
  120. fxVC_upvy:
  121.  
  122.           mov       ax,vedepth              ;vy   = depth-loop
  123.           sub       ax,di
  124.           push      ax                      
  125.           mov       ax,vex                  ;x    = x
  126.           push      ax
  127.           mov       bx,vey2                 ;y    = y2-loop
  128.           sub       bx,di
  129.           push      bx
  130.           mov       ax,vex2                 ;x2   = x2
  131.           push      ax
  132.           add       bx,vegrain              ;y2   = y2-loop+grain
  133.           push      bx
  134.           mov       ax,vepage               ;page = current
  135.           push      ax
  136.  
  137.           call      pcxVirtualDisplay       ;Display this part
  138.  
  139.           mov       ax,vedelay              ;Get the delay count
  140.           push      ax
  141.  
  142.           call      fxEffectDelay           ; and delay
  143.  
  144.           jnc       fxVC_horizbump          ;If no error, continue
  145.           jmp       fxVC_error              
  146.  
  147. fxVC_horizbump:
  148.  
  149.           add       di,vegrain              ;Bump our loop counters
  150.           add       si,vegrain                                    
  151.           cmp       si,vehhalf              ;Have we done the entire image?
  152.           jl        fxVC_horizloop          ;If not, loop
  153.  
  154.           @SetRet   veret,fxSUCCESS         ;Set the return code
  155.  
  156.           jmp       fxVC_exit               ; and exit
  157.  
  158. fxVC_vert:
  159.  
  160.           inc       WORD PTR vex2           ;Bump X2, to comp for later add
  161.  
  162.           mov       ax,vevhalf              ;Get the middle
  163.           sub       ax,vevgrain             ;Sub the grain
  164.           mov       veloopmax,ax            ;Store as the loop maximum
  165.           
  166.           mov       si,0                    ;Initialize left 
  167.           mov       di,vevgrain             ; and right loop counters
  168.  
  169. fxVC_vertloop:
  170.  
  171.           mov       ax,vevseg               ;vptr
  172.           push      ax
  173.           mov       ax,vevofs
  174.           push      ax
  175.  
  176.           mov       dx,si
  177.           cmp       dx,veloopmax            ;Is loop past a grain increment?
  178.           jle       fxVC_rightvx            ;If not, continue
  179.  
  180.           mov       dx,veloopmax            ;Otherwise, reset
  181.  
  182. fxVC_rightvx:
  183.  
  184.           push      dx                      ;vx   = loop
  185.           xor       ax,ax                   ;vy   = 0
  186.           push      ax
  187.           mov       bx,vex                  ;x    = x+loop
  188.           add       bx,dx
  189.           push      bx
  190.           mov       ax,vey                  ;y    = y     
  191.           push      ax
  192.           add       bx,vevgrain             ;x2   = x+loop+grain
  193.           push      bx                           
  194.           mov       ax,vey2                 ;y2   = y2
  195.           push      ax
  196.           mov       ax,vepage               ;page = current
  197.           push      ax                      
  198.  
  199.           call      pcxVirtualDisplay       ;Display this part
  200.  
  201.           mov       ax,vevseg               ;vptr
  202.           push      ax
  203.           mov       ax,vevofs
  204.           push      ax
  205.  
  206.           cmp       di,vewidth              ;Is loop past a grain increment?
  207.           jle       fxVC_leftvx             ;If not, continue
  208.  
  209.           mov       di,vewidth              ;Otherwise, reset
  210.  
  211. fxVC_leftvx:
  212.  
  213.           mov       ax,vewidth              ;vx   = width-loop
  214.           sub       ax,di
  215.           push      ax
  216.           xor       ax,ax                   ;vy   = 0
  217.           push      ax
  218.           mov       bx,vex2                 ;x    = x2-loop
  219.           sub       bx,di
  220.           push      bx
  221.           mov       ax,vey                  ;y    = y     
  222.           push      ax
  223.           add       bx,vevgrain             ;x2   = x2-loop+grain
  224.           push      bx                           
  225.           mov       ax,vey2                 ;y2   = y2
  226.           push      ax
  227.           mov       ax,vepage               ;page = current
  228.           push      ax                      
  229.  
  230.           call      pcxVirtualDisplay       ;Display this part
  231.  
  232.           mov       ax,vedelay              ;Get the delay count
  233.           push      ax
  234.  
  235.           call      fxEffectDelay           ; and delay
  236.  
  237.           jnc       fxVC_vertbump           ;If no error, continue
  238.           jmp       SHORT fxVC_error              
  239.  
  240. fxVC_vertbump:
  241.  
  242.           cmp       si,veloopmax            ;Have we done the entire image?
  243.           jge       fxVC_vertdone
  244.  
  245.           add       si,vevgrain             ;Bump our loop counters
  246.           add       di,vevgrain
  247.           jmp       fxVC_vertloop           ; and loop
  248.  
  249. fxVC_vertdone:
  250.  
  251.           @SetRet   veret,fxSUCCESS         ;Set the return code
  252.           jmp       SHORT fxVC_exit
  253.  
  254. fxVC_error:
  255.  
  256.           @SetRet   veret,ax                ;Set the error code
  257.  
  258. fxVC_exit:
  259.  
  260.           @Exit     veret,veparm            ;Return
  261.  
  262. fxVirtualCrush      ENDP
  263.  
  264.   @EndCode
  265.  
  266.           END
  267.