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

  1.   PAGE    60,132
  2.   TITLE   fxVS.ASM -- PCX Effects
  3.   SUBTTL  Copyright (c) Genus Microprogramming, Inc. 1988-89
  4.  
  5. ; fxVW.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. ; 'splitting' it on the display.                                             ;
  12. ;                                                                            ;
  13. ; Procedures: fxVirtualSplit                                                 ;
  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    fxVirtualSplit
  41.  
  42. ;**********
  43.  
  44. ;
  45. ; This is the Virtual Split 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. fxVirtualSplit      PROC FAR
  56.  
  57.           mov       ax,vedir                ;What direction?
  58.           cmp       ax,fxVERT               ;Vertical  
  59.           jne       fxVS_horiz   
  60.  
  61.           jmp       fxVS_vert 
  62.  
  63. fxVS_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,vehhalf              ;Initialize loop counters
  73.           mov       di,vehhalf
  74.           inc       di
  75.  
  76. fxVS_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       fxVS_downvy             ;If not, continue
  88.  
  89.           mov       dx,veloopmax            ;Otherwise, reset
  90.  
  91. fxVS_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       fxVS_upvy               ;If not, continue
  117.  
  118.           mov       di,vedepth              ;Otherwise, reset
  119.  
  120. fxVS_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       fxVS_upbump             ;If no error, continue
  145.           jmp       fxVS_error              
  146.  
  147. fxVS_upbump:  
  148.  
  149.           cmp       di,vedepth              ;Have we done the entire image?
  150.                                             ; (NOTE: use DI, since SI will
  151.                                             ;        NEVER overrun edge ...)
  152.           jge       fxVS_horizdone
  153.  
  154.           add       di,vegrain              ;Bump our loop counters
  155.           add       si,vegrain                                    
  156.           jmp       fxVS_horizloop          ; and loop   
  157.  
  158. fxVS_horizdone:
  159.  
  160.           @SetRet   veret,fxSUCCESS         ;Set the return code
  161.  
  162.           jmp       fxVS_exit               ; and exit
  163.  
  164. fxVS_vert:
  165.  
  166.           inc       WORD PTR vex2           ;Bump X2, to comp for later add
  167.  
  168.           mov       ax,vewidth              ;Get the middle
  169.           sub       ax,vevgrain             ;Sub the grain
  170.           mov       veloopmax,ax            ;Store as the loop maximum
  171.           
  172.           mov       si,vevhalf              ;Initialize left 
  173.           mov       di,vevhalf              ; and right loop counters
  174.           add       di,vevgrain
  175.  
  176. fxVS_vertloop:
  177.  
  178.           mov       ax,vevseg               ;vptr
  179.           push      ax
  180.           mov       ax,vevofs
  181.           push      ax
  182.  
  183.           mov       dx,si
  184.           cmp       dx,veloopmax            ;Is loop past a grain increment?
  185.           jle       fxVS_rightvx            ;If not, continue
  186.  
  187.           mov       dx,veloopmax            ;Otherwise, reset
  188.  
  189. fxVS_rightvx:
  190.  
  191.           push      dx                      ;vx   = loop
  192.           xor       ax,ax                   ;vy   = 0
  193.           push      ax
  194.           mov       bx,vex                  ;x    = x+loop
  195.           add       bx,dx
  196.           push      bx
  197.           mov       ax,vey                  ;y    = y     
  198.           push      ax
  199.           add       bx,vevgrain             ;x2   = x+loop+grain
  200.           push      bx                           
  201.           mov       ax,vey2                 ;y2   = y2
  202.           push      ax
  203.           mov       ax,vepage               ;page = current
  204.           push      ax                      
  205.  
  206.           call      pcxVirtualDisplay       ;Display this part
  207.  
  208.           mov       ax,vevseg               ;vptr
  209.           push      ax
  210.           mov       ax,vevofs
  211.           push      ax
  212.  
  213.           cmp       di,vewidth              ;Is loop past a grain increment?
  214.           jle       fxVS_leftvx             ;If not, continue
  215.  
  216.           mov       di,vewidth              ;Otherwise, reset
  217.  
  218. fxVS_leftvx:
  219.  
  220.           mov       ax,vewidth              ;vx   = width-loop
  221.           sub       ax,di
  222.           push      ax
  223.           xor       ax,ax                   ;vy   = 0
  224.           push      ax
  225.           mov       bx,vex2                 ;x    = x2-loop
  226.           sub       bx,di
  227.           push      bx
  228.           mov       ax,vey                  ;y    = y     
  229.           push      ax
  230.           add       bx,vevgrain             ;x2   = x2-loop+grain
  231.           push      bx                           
  232.           mov       ax,vey2                 ;y2   = y2
  233.           push      ax
  234.           mov       ax,vepage               ;page = current
  235.           push      ax                      
  236.  
  237.           call      pcxVirtualDisplay       ;Display this part
  238.  
  239.           mov       ax,vedelay              ;Get the delay count
  240.           push      ax
  241.  
  242.           call      fxEffectDelay           ; and delay
  243.  
  244.           jnc       fxVS_leftbump           ;If no error, continue
  245.           jmp       SHORT fxVS_error              
  246.  
  247. fxVS_leftbump:
  248.  
  249.           cmp       si,veloopmax            ;Have we done the entire image?
  250.           jge       fxVS_vertdone
  251.  
  252.           add       si,vevgrain             ;Bump our loop counters
  253.           add       di,vevgrain
  254.           jmp       fxVS_vertloop           ; and loop
  255.  
  256. fxVS_vertdone:
  257.  
  258.           @SetRet   veret,fxSUCCESS         ;Set the return code
  259.           jmp       SHORT fxVS_exit
  260.  
  261. fxVS_error:
  262.           
  263.           @SetRet   veret,ax                ;Set the error code
  264.  
  265. fxVS_exit:
  266.  
  267.           @Exit     veret,veparm            ;Return
  268.  
  269. fxVirtualSplit      ENDP
  270.  
  271.   @EndCode
  272.  
  273.           END
  274.