ctv.asm

来自「DGen源码最后版本」· 汇编 代码 · 共 119 行

ASM
119
字号
; CTV!

bits 32
section .text
;extern "C" int blur_bitmap_16
;  (unsigned char *dest,int len);

global _blur_bitmap_16
times ($$-$) & 3 db 0
_blur_bitmap_16
push edi ; point to screen
push edx ; temporary for unwrapping
push ecx ; count
push ebx ; last pixel

; ax = current pixel

xor ebx,ebx ; Last pixel

mov edi,[esp+20] ; edi is a pointer to the bitmap
mov ecx,[esp+24] ; ecx is the amount of pixels to blur

blur16_loop:
mov ax,word[edi]

mov dx,ax
and ax,0x07e0
and dx,0xf81f
rol eax,16
mov ax,dx
; Now we have unwrapped the green middle out of eax
mov edx,eax ; ebx=this pixel (unwrapped) before we changed it
add eax,ebx ; add last pixel to this one
mov ebx,edx ; ebx=this pixel for next time

sar eax,1

; wrap up again
mov edx,eax
ror edx,16
and dx,0x07e0
and ax,0xf81f
or  ax,dx
;finished pixel in ax

;mov word[edi],ax
;add edi,2
stosw
loop blur16_loop

pop  ebx
pop  ecx
pop  edx
pop  edi
xor eax,eax
ret


; --------------------------------------

bits 32
section .text
;extern "C" int blur_bitmap_15
;  (unsigned char *dest,int len);

global _blur_bitmap_15
times ($$-$) & 3 db 0
_blur_bitmap_15
push edi ; point to screen
push edx ; temporary for unwrapping
push ecx ; count
push ebx ; last pixel

; ax = current pixel

xor ebx,ebx ; Last pixel

mov edi,[esp+20] ; edi is a pointer to the bitmap
mov ecx,[esp+24] ; ecx is the amount of pixels to blur

blur15_loop:
mov ax,word[edi]

mov dx,ax
and ax,0x03e0
and dx,0x7c1f
rol eax,16
mov ax,dx
; Now we have unwrapped the green middle out of eax
mov edx,eax ; ebx=this pixel (unwrapped) before we changed it
add eax,ebx ; add last pixel to this one
mov ebx,edx ; ebx=this pixel for next time

sar eax,1

; wrap up again
mov edx,eax
ror edx,16
and dx,0x03e0
and ax,0x7c1f
or  ax,dx
;finished pixel in ax

;mov word[edi],ax
;add edi,2
stosw
loop blur15_loop

pop  ebx
pop  ecx
pop  edx
pop  edi
xor eax,eax
ret




⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?