r_scana.asm 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. .386P
  2. .model FLAT
  3. ;
  4. ; d_scana.s
  5. ; x86 assembly-language turbulent texture mapping code
  6. ;
  7. include qasm.inc
  8. include d_if.inc
  9. if id386
  10. _DATA SEGMENT
  11. _DATA ENDS
  12. _TEXT SEGMENT
  13. ;----------------------------------------------------------------------
  14. ; turbulent texture mapping code
  15. ;----------------------------------------------------------------------
  16. align 4
  17. public _D_DrawTurbulent8Span
  18. _D_DrawTurbulent8Span:
  19. push ebp ; preserve caller's stack frame pointer
  20. push esi ; preserve register variables
  21. push edi
  22. push ebx
  23. mov esi,ds:dword ptr[_r_turb_s]
  24. mov ecx,ds:dword ptr[_r_turb_t]
  25. mov edi,ds:dword ptr[_r_turb_pdest]
  26. mov ebx,ds:dword ptr[_r_turb_spancount]
  27. Llp:
  28. mov eax,ecx
  29. mov edx,esi
  30. sar eax,16
  31. mov ebp,ds:dword ptr[_r_turb_turb]
  32. sar edx,16
  33. and eax,offset CYCLE-1
  34. and edx,offset CYCLE-1
  35. mov eax,ds:dword ptr[ebp+eax*4]
  36. mov edx,ds:dword ptr[ebp+edx*4]
  37. add eax,esi
  38. sar eax,16
  39. add edx,ecx
  40. sar edx,16
  41. and eax,offset TURB_TEX_SIZE-1
  42. and edx,offset TURB_TEX_SIZE-1
  43. shl edx,6
  44. mov ebp,ds:dword ptr[_r_turb_pbase]
  45. add edx,eax
  46. inc edi
  47. add esi,ds:dword ptr[_r_turb_sstep]
  48. add ecx,ds:dword ptr[_r_turb_tstep]
  49. mov dl,ds:byte ptr[ebp+edx*1]
  50. dec ebx
  51. mov ds:byte ptr[-1+edi],dl
  52. jnz Llp
  53. mov ds:dword ptr[_r_turb_pdest],edi
  54. pop ebx ; restore register variables
  55. pop edi
  56. pop esi
  57. pop ebp ; restore caller's stack frame pointer
  58. ret
  59. _TEXT ENDS
  60. endif ;id386
  61. END