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

  1.   PAGE    60,132
  2.   TITLE   fxVP.ASM -- PCX Effects
  3.   SUBTTL  Copyright (c) Genus Microprogramming, Inc. 1988-89
  4.  
  5. ; fxVP.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. ; 'spiraling' it on the display.                                             ;
  12. ;                                                                            ;
  13. ; Procedures: fxVirtualSpiral                                                ;
  14. ;                                                                            ;
  15. ;                                                                            ;
  16. ;                                                                            ;
  17. ; Microsoft ASM 5.x version.              Programmer: Chris Howard  5/03/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.           EXTRN     fxVirtualGrid           : FAR
  40.           EXTRN     fxVirtualBox            : FAR
  41.  
  42.           PUBLIC    fxVirtualSpiral     
  43.  
  44. ;**********
  45.  
  46. ;
  47. ; This is the Virtual Spiral effect procedure, for the fxVirtualEffect
  48. ; interface.  It is an INTERNAL routine only.
  49. ;
  50. ; On Entry:  SS:BP    points to pcxVirtualEffect frame
  51. ;            ES:DI    points to display structure
  52. ;            DS:SI    points to buffer
  53. ;
  54. ; On Exit:   retcode  contains error code, if any
  55. ;
  56.  
  57. fxVirtualSpiral     PROC FAR
  58.  
  59.           call      fxVirtualGrid           ;Break up image into a grid
  60.  
  61.           mov       ax,veimax               ;Get the grid center points
  62.           shr       ax,1
  63.           mov       vevhalf,ax
  64.  
  65.           mov       bx,vejmax               
  66.           shr       bx,1
  67.           mov       vehhalf,bx
  68.  
  69.           cmp       ax,bx                   ;Determine loop maximum
  70.           jle       fxVS_max
  71.  
  72.           mov       ax,bx
  73.  
  74. fxVS_max:
  75.  
  76.           inc       ax
  77.           mov       veloopmax,ax            ;Set the loop maximum
  78.  
  79. fxVS_dir:
  80.  
  81.           mov       ax,vedir                ;What direction?
  82.           cmp       ax,fxIN                 ;Right and up  
  83.           jne       fxVS_out        
  84.  
  85.           jmp       fxVS_in   
  86.  
  87. fxVS_out:
  88.  
  89.           mov       si,veloopmax            ;Get the loop maximum
  90.           dec       si                      ; and sub one to get starting pt
  91.  
  92.           mov       vei,si                  ;Store starting locations
  93.           mov       di,si
  94.           mov       vej,di
  95.  
  96.           mov       ax,veimax               ;Get the column max
  97.           sub       ax,veloopmax            ; sub the starting position
  98.           inc       ax                      ; and bump by one
  99.           mov       veimax,ax               ;Now store as ending location
  100.  
  101.           mov       ax,vejmax               ;Get the row max
  102.           sub       ax,veloopmax            ; sub the starting position
  103.           inc       ax                      ; and bump by one
  104.           mov       vejmax,ax               ;Now store the ending location
  105.  
  106.           mov       cx,veloopmax            ;Get the maximum count
  107.  
  108. fxVS_outtop:
  109.  
  110.           cmp       si,veimax               ;Are we at the right
  111.           je        fxVS_outright           ;If so, go down it
  112.  
  113.           inc       si                      ;Otherwise, bump to next grid
  114.           call      fxVirtualBox
  115.  
  116.           mov       ax,vedelay              ;Get the delay count
  117.           push      ax
  118.  
  119.           call      fxEffectDelay           ; and delay
  120.  
  121.           jnc       fxVS_outtop             ;If no error, continue
  122.           jmp       fxVS_error  
  123.  
  124. fxVS_outright:
  125.  
  126.           cmp       di,vejmax               ;Are we at the bottom edge?
  127.           je        fxVS_outbottom          ;If so, go along it
  128.  
  129.           inc       di                      ;Otherwise, bump to next grid
  130.           call      fxVirtualBox
  131.  
  132.           mov       ax,vedelay              ;Get the delay count
  133.           push      ax
  134.  
  135.           call      fxEffectDelay           ; and delay
  136.  
  137.           jnc       fxVS_outright           ;If no error, continue
  138.           jmp       fxVS_error  
  139.  
  140. fxVS_outbottom:
  141.  
  142.           cmp       si,vei                  ;Are we at the left edge?
  143.           je        fxVS_outleft            ;If so, go along it
  144.  
  145.           dec       si                      ;Otherwise, bump to next grid
  146.           call      fxVirtualBox
  147.  
  148.           mov       ax,vedelay              ;Get the delay count
  149.           push      ax
  150.  
  151.           call      fxEffectDelay           ; and delay
  152.  
  153.           jnc       fxVS_outbottom          ;If no error, continue
  154.           jmp       fxVS_error  
  155.  
  156. fxVS_outleft:
  157.  
  158.           call      fxVirtualBox
  159.  
  160.           cmp       di,vej                  ;Are we at the top edge?
  161.           je        fxVS_outchkloop         ;If so, check our loop
  162.  
  163.           dec       di                      ;Otherwise, bump up to next
  164.  
  165.           mov       ax,vedelay              ;Get the delay count
  166.           push      ax
  167.  
  168.           call      fxEffectDelay           ; and delay
  169.  
  170.           jnc       fxVS_outleft            ;If no error, continue
  171.           jmp       fxVS_error  
  172.  
  173. fxVS_outchkloop:
  174.  
  175.           dec       si                      ;Move the upper left corner
  176.           mov       vei,si
  177.           dec       di
  178.           mov       vej,di
  179.  
  180.           inc       WORD PTR veimax         ; and lower right corner
  181.           inc       WORD PTR vejmax
  182.  
  183.           loop      fxVS_outtop             ;Loop until all squares are done
  184.  
  185. fxVS_outdone:
  186.  
  187.           @SetRet   veret,fxSUCCESS         ;Set the return code
  188.           jmp       fxVS_exit               ; and exit
  189.  
  190. fxVS_in:                                    
  191.  
  192.           mov       si,0                    ;Initialize start to upper left
  193.           mov       vei,si                  ; corner
  194.           mov       di,0
  195.           mov       vej,di
  196.  
  197.           mov       cx,veloopmax            ;Initialize max 'boxes'
  198.  
  199. fxVS_intop:
  200.  
  201.           call      fxVirtualBox
  202.  
  203.           cmp       si,veimax               ;Are we at the right edge?
  204.           je        fxVS_inright            ;If so, go down it
  205.  
  206.           inc       si                      ;Otherwise, bump to next
  207.  
  208.           mov       ax,vedelay              ;Get the delay count
  209.           push      ax
  210.  
  211.           call      fxEffectDelay           ; and delay
  212.  
  213.           jnc       fxVS_intop              ;If no error, continue
  214.           jmp       SHORT fxVS_error  
  215.  
  216. fxVS_inright:
  217.  
  218.           cmp       di,vejmax               ;Are we at the bottom edge?
  219.           je        fxVS_inbottom           ;If so, go along it
  220.  
  221.           inc       di                      ;Otherwise, bump to next
  222.           call      fxVirtualBox
  223.  
  224.           mov       ax,vedelay              ;Get the delay count
  225.           push      ax
  226.  
  227.           call      fxEffectDelay           ; and delay
  228.  
  229.           jnc       fxVS_inright            ;If no error, continue
  230.           jmp       SHORT fxVS_error  
  231.  
  232. fxVS_inbottom:
  233.  
  234.           cmp       si,vei                  ;Are we at the left edge?
  235.           je        fxVS_inleft             ;If so, go along it
  236.  
  237.           dec       si                      ;Otherwise, bump up to next grid
  238.           call      fxVirtualBox
  239.  
  240.           mov       ax,vedelay              ;Get the delay count
  241.           push      ax
  242.  
  243.           call      fxEffectDelay           ; and delay
  244.  
  245.           jnc       fxVS_inbottom           ;If no error, continue
  246.           jmp       SHORT fxVS_error  
  247.  
  248. fxVS_inleft:
  249.  
  250.           cmp       di,vej                  ;Are we at the top?
  251.           je        fxVS_inchkloop          ;If so, check our loop
  252.  
  253.           dec       di                      ;Otherwise, bump up
  254.           call      fxVirtualBox            
  255.  
  256.           mov       ax,vedelay              ;Get the delay count
  257.           push      ax
  258.  
  259.           call      fxEffectDelay           ; and delay
  260.  
  261.           jnc       fxVS_inleft             ;If no error, continue
  262.           jmp       SHORT fxVS_error  
  263.  
  264. fxVS_inchkloop:
  265.  
  266.           inc       si                      ;Move the upper left corner in
  267.           mov       vei,si                  ; and down
  268.           inc       di
  269.           mov       vej,di
  270.  
  271.           dec       WORD PTR veimax         ;Move the lower right corner in
  272.           dec       WORD PTR vejmax         ; and up
  273.  
  274.           loop      fxVS_intop              ;Loop until all 'boxes' are done
  275.  
  276. fxVS_indone:
  277.  
  278.           @SetRet   veret,fxSUCCESS         ;Set the return code
  279.           jmp       SHORT fxVS_exit         ; and exit
  280.  
  281. fxVS_error:
  282.  
  283.           @SetRet   veret,ax                ;Set the return code
  284.  
  285. fxVS_exit:
  286.                     
  287.           @Exit     veret,veparm            ;Return
  288.  
  289. fxVirtualSpiral     ENDP
  290.  
  291.   @EndCode
  292.  
  293.           END
  294.