Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. ; CTV!
  2.  
  3. bits 32
  4. section .text
  5. ;extern "C" int blur_bitmap_16
  6. ;  (unsigned char *dest,int len);
  7.  
  8. global blur_bitmap_16
  9. global test_ctv
  10. times ($$-$) & 3 db 0
  11. blur_bitmap_16:
  12. push edi ; point to screen
  13. push edx ; temporary for unwrapping
  14. push ecx ; count
  15. push ebx ; last pixel
  16.  
  17. ; ax = current pixel
  18.  
  19. xor ebx,ebx ; Last pixel
  20.  
  21. mov edi,[esp+20] ; edi is a pointer to the bitmap
  22. mov ecx,[esp+24] ; ecx is the amount of pixels to blur
  23.  
  24. blur16_loop:
  25. mov ax,word[edi]
  26.  
  27. mov dx,ax
  28. and ax,0x07e0
  29. and dx,0xf81f
  30. rol eax,16
  31. mov ax,dx
  32. ; Now we have unwrapped the green middle out of eax
  33. mov edx,eax ; ebx=this pixel (unwrapped) before we changed it
  34. add eax,ebx ; add last pixel to this one
  35. mov ebx,edx ; ebx=this pixel for next time
  36.  
  37. sar eax,1
  38.  
  39. ; wrap up again
  40. mov edx,eax
  41. ror edx,16
  42. and dx,0x07e0
  43. and ax,0xf81f
  44. or  ax,dx
  45. ;finished pixel in ax
  46.  
  47. ;mov word[edi],ax
  48. ;add edi,2
  49. stosw
  50. loop blur16_loop
  51.  
  52. pop  ebx
  53. pop  ecx
  54. pop  edx
  55. pop  edi
  56. xor eax,eax
  57. ret
  58.  
  59.  
  60. ; --------------------------------------
  61.  
  62. bits 32
  63. section .text
  64. ;extern "C" int blur_bitmap_15
  65. ;  (unsigned char *dest,int len);
  66.  
  67. global blur_bitmap_15
  68. times ($$-$) & 3 db 0
  69. blur_bitmap_15:
  70. push edi ; point to screen
  71. push edx ; temporary for unwrapping
  72. push ecx ; count
  73. push ebx ; last pixel
  74.  
  75. ; ax = current pixel
  76.  
  77. xor ebx,ebx ; Last pixel
  78.  
  79. mov edi,[esp+20] ; edi is a pointer to the bitmap
  80. mov ecx,[esp+24] ; ecx is the amount of pixels to blur
  81.  
  82. blur15_loop:
  83. mov ax,word[edi]
  84.  
  85. mov dx,ax
  86. and ax,0x03e0
  87. and dx,0x7c1f
  88. rol eax,16
  89. mov ax,dx
  90. ; Now we have unwrapped the green middle out of eax
  91. mov edx,eax ; ebx=this pixel (unwrapped) before we changed it
  92. add eax,ebx ; add last pixel to this one
  93. mov ebx,edx ; ebx=this pixel for next time
  94.  
  95. sar eax,1
  96.  
  97. ; wrap up again
  98. mov edx,eax
  99. ror edx,16
  100. and dx,0x03e0
  101. and ax,0x7c1f
  102. or  ax,dx
  103. ;finished pixel in ax
  104.  
  105. ;mov word[edi],ax
  106. ;add edi,2
  107. stosw
  108. loop blur15_loop
  109.  
  110. pop  ebx
  111. pop  ecx
  112. pop  edx
  113. pop  edi
  114. xor eax,eax
  115. ret
  116.  
  117. ; ----------------------------
  118.  
  119. bits 32
  120. section .text
  121. ;extern "C" int test_ctv
  122. ;  (unsigned char *dest,int len);
  123.  
  124. global _test_ctv
  125. times ($$-$) & 3 db 0
  126. test_ctv:
  127. push edi ; point to screen
  128. push edx ; temporary for unwrapping
  129. push ecx ; count
  130. push ebx ; last pixel
  131.  
  132. ; ax = current pixel
  133.  
  134. xor ebx,ebx ; Last pixel
  135.  
  136. mov edi,[esp+20] ; edi is a pointer to the bitmap
  137. mov ecx,[esp+24] ; ecx is the amount of pixels to blur
  138.  
  139. test_loop:
  140. mov ax,word[edi]
  141.  
  142. mov dx,ax
  143. rol eax,16
  144. mov ax,dx
  145. mov edx,eax ; ebx=this pixel (unwrapped) before we changed it
  146. mov ebx,edx ; ebx=this pixel for next time
  147.  
  148. sar eax,1
  149.  
  150. mov edx,eax
  151. ror edx,16
  152. ;finished pixel in ax
  153.  
  154. ;mov word[edi],ax
  155. ;add edi,2
  156. stosw
  157. loop test_loop
  158.  
  159. pop  ebx
  160. pop  ecx
  161. pop  edx
  162. pop  edi
  163. xor eax,eax
  164. ret
  165.  
  166. %ifdef NASM_STACK_NOEXEC
  167. section .note.GNU-stack noalloc noexec nowrite progbits
  168. %endif
  169.