r_scana.s 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // d_scana.s
  3. // x86 assembly-language turbulent texture mapping code
  4. //
  5. #include "qasm.h"
  6. #include "d_ifacea.h"
  7. #if id386
  8. .data
  9. .text
  10. //----------------------------------------------------------------------
  11. // turbulent texture mapping code
  12. //----------------------------------------------------------------------
  13. .align 4
  14. .globl C(D_DrawTurbulent8Span)
  15. C(D_DrawTurbulent8Span):
  16. pushl %ebp // preserve caller's stack frame pointer
  17. pushl %esi // preserve register variables
  18. pushl %edi
  19. pushl %ebx
  20. movl C(r_turb_s),%esi
  21. movl C(r_turb_t),%ecx
  22. movl C(r_turb_pdest),%edi
  23. movl C(r_turb_spancount),%ebx
  24. Llp:
  25. movl %ecx,%eax
  26. movl %esi,%edx
  27. sarl $16,%eax
  28. movl C(r_turb_turb),%ebp
  29. sarl $16,%edx
  30. andl $(CYCLE-1),%eax
  31. andl $(CYCLE-1),%edx
  32. movl (%ebp,%eax,4),%eax
  33. movl (%ebp,%edx,4),%edx
  34. addl %esi,%eax
  35. sarl $16,%eax
  36. addl %ecx,%edx
  37. sarl $16,%edx
  38. andl $(TURB_TEX_SIZE-1),%eax
  39. andl $(TURB_TEX_SIZE-1),%edx
  40. shll $6,%edx
  41. movl C(r_turb_pbase),%ebp
  42. addl %eax,%edx
  43. incl %edi
  44. addl C(r_turb_sstep),%esi
  45. addl C(r_turb_tstep),%ecx
  46. movb (%ebp,%edx,1),%dl
  47. decl %ebx
  48. movb %dl,-1(%edi)
  49. jnz Llp
  50. movl %edi,C(r_turb_pdest)
  51. popl %ebx // restore register variables
  52. popl %edi
  53. popl %esi
  54. popl %ebp // restore caller's stack frame pointer
  55. ret
  56. #endif // id386