d_scana.s 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. Copyright (C) 1996-1997 Id Software, Inc.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. //
  16. // d_scana.s
  17. // x86 assembly-language turbulent texture mapping code
  18. //
  19. #include "asm_i386.h"
  20. #include "quakeasm.h"
  21. #include "asm_draw.h"
  22. #include "d_ifacea.h"
  23. #if id386
  24. .data
  25. .text
  26. //----------------------------------------------------------------------
  27. // turbulent texture mapping code
  28. //----------------------------------------------------------------------
  29. .align 4
  30. .globl C(D_DrawTurbulent8Span)
  31. C(D_DrawTurbulent8Span):
  32. pushl %ebp // preserve caller's stack frame pointer
  33. pushl %esi // preserve register variables
  34. pushl %edi
  35. pushl %ebx
  36. movl C(r_turb_s),%esi
  37. movl C(r_turb_t),%ecx
  38. movl C(r_turb_pdest),%edi
  39. movl C(r_turb_spancount),%ebx
  40. Llp:
  41. movl %ecx,%eax
  42. movl %esi,%edx
  43. sarl $16,%eax
  44. movl C(r_turb_turb),%ebp
  45. sarl $16,%edx
  46. andl $(CYCLE-1),%eax
  47. andl $(CYCLE-1),%edx
  48. movl (%ebp,%eax,4),%eax
  49. movl (%ebp,%edx,4),%edx
  50. addl %esi,%eax
  51. sarl $16,%eax
  52. addl %ecx,%edx
  53. sarl $16,%edx
  54. andl $(TURB_TEX_SIZE-1),%eax
  55. andl $(TURB_TEX_SIZE-1),%edx
  56. shll $6,%edx
  57. movl C(r_turb_pbase),%ebp
  58. addl %eax,%edx
  59. incl %edi
  60. addl C(r_turb_sstep),%esi
  61. addl C(r_turb_tstep),%ecx
  62. movb (%ebp,%edx,1),%dl
  63. decl %ebx
  64. movb %dl,-1(%edi)
  65. jnz Llp
  66. movl %edi,C(r_turb_pdest)
  67. popl %ebx // restore register variables
  68. popl %edi
  69. popl %esi
  70. popl %ebp // restore caller's stack frame pointer
  71. ret
  72. #endif // id386