MV_MIX1.ASM 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. .386
  2. .MODEL flat
  3. .data
  4. .code
  5. SEGMENT text USE32
  6. ALIGN 16
  7. ;================
  8. ;
  9. ; MV_Mix8BitMonoFast
  10. ;
  11. ;================
  12. ; eax - position
  13. ; edx - rate
  14. ; ecx - Volume table
  15. ; ebx - Harsh clip table
  16. ; edi - to
  17. ; esi - start
  18. MixBufferSize equ 256
  19. PROC MV_Mix8BitMonoFast_
  20. PUBLIC MV_Mix8BitMonoFast_
  21. push ebp
  22. ; mov edi,[to]
  23. ; mov esi,[start]
  24. ; mov ebp,[position]
  25. ; mov edx,[Rate]
  26. mov ebp, eax
  27. ; Rate scale ptr
  28. ; mov edx,[rate]
  29. mov eax,OFFSET apatch1+2 ; convice tasm to modify code...
  30. mov [eax],edx
  31. ; Volume table ptr
  32. ; mov ecx,[VolumeTable]
  33. mov eax,OFFSET apatch2+3 ; convice tasm to modify code...
  34. mov [eax],ecx
  35. ; Harsh Clip table ptr
  36. ; mov ebx,HarshClipTable ; get harsh clip table address
  37. add ebx,128
  38. mov eax,OFFSET apatch3+3 ; convice tasm to modify code...
  39. mov [eax],ebx
  40. mov ecx, MixBufferSize
  41. ; eax - scratch
  42. ; ebx - scratch
  43. ; edx - scratch
  44. ; ecx - count
  45. ; edi - destination
  46. ; esi - source
  47. ; ebp - frac pointer
  48. ; apatch1 - volume table
  49. ; apatch2 - volume table
  50. ; apatch3 - harsh clip table
  51. ; apatch4 - harsh clip table
  52. ; apatch5 - sample rate
  53. ; apatch6 - sample rate
  54. ALIGN 16
  55. mix8Mloop:
  56. mov eax,ebp ; begin calculating first sample
  57. apatch1:
  58. add ebp,12345678h ; advance frac pointer
  59. shr eax,16 ; finish calculation for first sample
  60. movzx eax, byte ptr [esi+eax] ; get first sample
  61. movzx edx, byte ptr [edi] ; get current sample from destination
  62. apatch2:
  63. movsx eax, byte ptr [eax+12345678h] ; volume translate first sample
  64. apatch3:
  65. mov eax, [eax + edx + 12345678h] ; harsh clip new sample
  66. mov [edi], al ; write new sample to destination
  67. inc edi ; move destination to second sample
  68. dec ecx ; decrement count
  69. jnz mix8Mloop ; loop
  70. pop ebp
  71. ret
  72. ENDP
  73. ENDS
  74. END