home *** CD-ROM | disk | FTP | other *** search
/ The Party 1994: Try This At Home / disk_image.bin / source / vexsrc / sinplasa.asm < prev    next >
Assembly Source File  |  1995-03-29  |  2KB  |  97 lines

  1. comment #
  2. /*****************************************************************************
  3.                                   ATTENTION!
  4.                            this source is VOTEWARE,
  5.               you may only use it to the conditions listed below:
  6.  
  7.   -You may modify it, or use parts of it in your own source as long as
  8.     this header stays on top of all files containing this source.
  9.   -You must give proper credit to the author, Niklas Beisert / pascal.
  10.   -You may not use it in commercial productions without the written
  11.     permission of the author.
  12.   -AND MOST IMPORTANT: you have to buy an Assembly '94 CD-ROM
  13.     by Sound Solutions (if you don't have it already) and vote for VEX-InTrO
  14.     in the PC-64k-Intro-Compo! (if you have already sent your voting card,
  15.     buy another one and fill it out CORRECTLY!!!)
  16. *****************************************************************************/
  17. #
  18.  
  19.  
  20.  
  21. ; // sine plasma, calculates one line for one operator
  22.  
  23. .model large,c
  24. .386
  25. locals
  26.  
  27. .data
  28. extrn SinTab:dword
  29.  
  30. .code
  31.  
  32. public makesintab
  33. public plasmaline
  34.  
  35. blockbeg macro exp
  36. blocksize=(1 shl exp)
  37.   mov ax,num
  38.   and ax,blocksize-1
  39.   sub ax,blocksize
  40.   neg ax
  41.   mov ah,al
  42.   mov al,(@@blockend-@@block) shr exp
  43.   mul ah
  44.   add ax,offset @@block
  45.   shr num,exp
  46.   inc num
  47.   jmp ax
  48. @@block:
  49. endm
  50.  
  51. blockend macro
  52. @@blockend:
  53.   dec num
  54.   jnz @@block
  55. endm
  56.  
  57. makesintab proc uses ds si di, plsin:dword, max:word
  58.   cld
  59.   lds si,SinTab
  60.   les di,plsin
  61.   movzx ebx,byte ptr max
  62.   mov cx,2048
  63. @@l:
  64.     lodsd
  65.     add eax,65536
  66.     imul eax,ebx
  67.     shr eax,17
  68.     stosb
  69.   loop @@l
  70.   ret
  71. endp
  72.  
  73. plasmaline proc uses ds si edi, plsin:dword, buf:dword, num:word, p:dword, f:dword
  74.   mov di,word ptr p
  75.   shl edi,16
  76.   mov dx,word ptr f
  77.   shl edx,16
  78.   mov dx,1
  79.   mov bx,word ptr p+2
  80.   mov cx,word ptr f+2
  81.   lds si,plsin
  82.   les di,buf
  83.   blockbeg 5
  84.     rept blocksize
  85.       and bx,2047
  86.       mov al,ds:[bx+si]
  87.       add es:[di],al
  88.       add edi,edx
  89.       adc bx,cx
  90.     endm
  91.   blockend
  92. @@end:
  93.   ret
  94. endp
  95.  
  96. end
  97.