From b2c28fedb03272df08284afc190cb9718ce72bdf Mon Sep 17 00:00:00 2001 From: pagefault <> Date: Sun, 23 Feb 2003 04:18:48 +0000 Subject: [PATCH] More video code moved to ASM --- zsnes/src/video/sw_draw.asm | 39 ++++++++++++++++++++-- zsnes/src/win/winlink.cpp | 66 ++++--------------------------------- 2 files changed, 42 insertions(+), 63 deletions(-) diff --git a/zsnes/src/video/sw_draw.asm b/zsnes/src/video/sw_draw.asm index 04c6b751..f5cde9a4 100644 --- a/zsnes/src/video/sw_draw.asm +++ b/zsnes/src/video/sw_draw.asm @@ -23,7 +23,7 @@ ALIGN 32 EXTSYM SurfaceX,SurfaceY EXTSYM ScreenPtr,SurfBufD -EXTSYM pitch,MMXSupport +EXTSYM pitch,MMXSupport,resolutn SECTION .text @@ -69,6 +69,8 @@ NEWSYM ClearWin32 NEWSYM DrawWin256x224x16 pushad + cmp byte[MMXSupport],0 + je .nommx mov esi, [ScreenPtr] mov edi, [SurfBufD] xor eax,eax @@ -87,14 +89,45 @@ NEWSYM DrawWin256x224x16 add edi, [pitch] sub edi,512 add esi,64 +%ifdef __WIN32__ + cmp eax,239 +%else cmp eax,223 - jne .Copying3 +%endif + jne .Copying3 xor eax,eax mov ecx,128 - rep stosd + rep stosd emms popad ret +.nommx + mov ax,ds + mov es,ax + xor eax,eax + mov esi, [ScreenPtr] + mov edi, [SurfBufD] + movsx edx, word[resolutn] + sub edx,2 +.Copying: + mov ecx,128 + rep movsd + inc eax + add edi, [pitch] + sub edi,512 + sub esi,512 + add esi,576 +%ifdef __WIN32__ + cmp eax,239 +%else + cmp eax,223 +%endif + jne .Copying + xor eax,edx + mov ecx,128 + rep stosd + popad + ret NEWSYM DrawWin320x240x16 pushad diff --git a/zsnes/src/win/winlink.cpp b/zsnes/src/win/winlink.cpp index 3f343c9b..a10f92fb 100644 --- a/zsnes/src/win/winlink.cpp +++ b/zsnes/src/win/winlink.cpp @@ -2042,6 +2042,9 @@ void clearwin() UnlockSurface(); } +extern void DrawWin256x224x16(); +extern void DrawWin256x224x32(); + void drawscreenwin(void) { DWORD i,j,color32; @@ -2094,66 +2097,9 @@ void drawscreenwin(void) switch (BitDepth) { case 16: - if (MMXSupport == 1) { - _asm { - push es - mov ax,ds - mov es,ax - xor eax,eax - mov esi,ScreenPtr - mov edi,SurfBufD - movsx edx,resolutn - sub edx,2 - Copying3: - mov ecx,32 - CopyLoop: - movq mm0,[esi] - movq mm1,[esi+8] - movq [edi],mm0 - movq [edi+8],mm1 - add esi,16 - add edi,16 - dec ecx - jnz CopyLoop - inc eax - add edi,pitch - sub edi,512 - sub esi,512 - add esi,576 - cmp eax,edx - jne Copying3 - xor eax,eax - mov ecx,128 - rep stosd - pop es - emms - } - } else { - _asm { - push es - mov ax,ds - mov es,ax - xor eax,eax - mov esi,ScreenPtr - mov edi,SurfBufD - movsx edx,resolutn - sub edx,2 - Copying: - mov ecx,128 - rep movsd - inc eax - add edi,pitch - sub edi,512 - sub esi,512 - add esi,576 - cmp eax,239 - jne Copying - xor eax,edx - mov ecx,128 - rep stosd - pop es - } - } + { + DrawWin256x224x16(); + } break; case 32: _asm {