home *** CD-ROM | disk | FTP | other *** search
/ The Party 1994: Try This At Home / disk_image.bin / source / vexsrc / polyvtxx.asm < prev    next >
Assembly Source File  |  1995-03-29  |  3KB  |  152 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. ;// vertical xmode texture line routines
  22.  
  23. .model large,c
  24. .386
  25. locals
  26.  
  27. .data
  28.  
  29. extrn poly_width:word
  30. extrn poly_scrseg:word
  31. extrn poly_tbmp:dword
  32. extrn poly_twid:word
  33. extrn poly_col:byte
  34. extrn poly_x:word
  35. extrn poly_y:word
  36. extrn poly_len:word
  37. extrn poly_tx:dword
  38. extrn poly_ty:dword
  39. extrn poly_dtx:dword
  40. extrn poly_dty:dword
  41.  
  42. .code
  43.  
  44. public vxtextureline
  45. public vxtexturelinex
  46.  
  47. exp=4
  48.  
  49. ct dw 0
  50. jmppos dw 0
  51.  
  52. jccnum macro jcc,i
  53.   jcc @@lab&i
  54. endm
  55.  
  56. labnum macro i
  57.   @@lab&i:
  58. endm
  59.  
  60. texture macro name,xpar
  61. name proc uses esi edi ds
  62.   num=0
  63.   mov cx,poly_len
  64.   mov al,cl
  65.   and al,(1 shl exp)-1
  66.   sub al,1 shl exp
  67.   neg al
  68.   mov ah,(@@blockend-@@block) shr exp
  69.   mul ah
  70.   add ax,offset @@block
  71.   mov cs:jmppos,ax
  72.   shr cx,exp
  73.   inc cx
  74.   mov cs:ct,cx
  75.  
  76.   mov ax,poly_y
  77.   mul poly_width
  78.   add ax,poly_x
  79.   adc dx,0
  80.   mov cl,al
  81.   and cl,3
  82.   shrd ax,dx,2
  83.   add ax,poly_scrseg
  84.   mov di,ax
  85.  
  86.   mov dx,3c4h
  87.   mov ax,0102h
  88.   shl ah,cl
  89.   out dx,ax
  90.  
  91.   mov esi,poly_ty
  92.   rol esi,16
  93.   imul si,poly_twid
  94.   add si,word ptr poly_tx+2
  95.   add si,word ptr poly_tbmp
  96.  
  97.   mov ebx,poly_dty
  98.   rol ebx,16
  99.   imul bx,poly_twid
  100.   add bx,word ptr poly_dtx+2
  101.  
  102.   mov cx,word ptr poly_dtx
  103.   shl ecx,16
  104.   mov cx,poly_width
  105.   shr cx,2
  106.  
  107.   rol edi,16
  108.   mov di,word ptr poly_tx
  109.   rol edi,16
  110.  
  111.   mov dx,poly_twid
  112.  
  113.   mov ax,0a000h
  114.   mov es,ax
  115.   mov ah,poly_col
  116.  
  117.   mov ds,word ptr poly_tbmp+2
  118.  
  119.   jmp cs:jmppos
  120.  
  121. @@block:
  122.     rept 1 shl exp
  123.       mov al,ds:[si]
  124.     if xpar
  125.       test al,0ffh
  126.       jccnum jz,%num
  127.     endif
  128.       add al,ah
  129.       mov es:[di],al
  130.     labnum %num
  131.     num=num+1
  132.       add edi,ecx
  133.       adc esi,ebx
  134.       jccnum jnc,%num
  135.         add si,dx
  136.     labnum %num
  137.     num=num+1
  138.     endm
  139. @@blockend:
  140.   dec cs:ct
  141.   jnz @@block
  142.  
  143. @@done:
  144.   ret
  145. endp
  146. endm
  147.  
  148. texture vxtextureline,0
  149. texture vxtexturelinex,1
  150.  
  151. end
  152.