More video code moved to ASM

This commit is contained in:
pagefault
2003-02-23 04:18:48 +00:00
parent c8e54760f2
commit b2c28fedb0
2 changed files with 42 additions and 63 deletions

View File

@@ -23,7 +23,7 @@ ALIGN 32
EXTSYM SurfaceX,SurfaceY EXTSYM SurfaceX,SurfaceY
EXTSYM ScreenPtr,SurfBufD EXTSYM ScreenPtr,SurfBufD
EXTSYM pitch,MMXSupport EXTSYM pitch,MMXSupport,resolutn
SECTION .text SECTION .text
@@ -69,6 +69,8 @@ NEWSYM ClearWin32
NEWSYM DrawWin256x224x16 NEWSYM DrawWin256x224x16
pushad pushad
cmp byte[MMXSupport],0
je .nommx
mov esi, [ScreenPtr] mov esi, [ScreenPtr]
mov edi, [SurfBufD] mov edi, [SurfBufD]
xor eax,eax xor eax,eax
@@ -87,7 +89,11 @@ NEWSYM DrawWin256x224x16
add edi, [pitch] add edi, [pitch]
sub edi,512 sub edi,512
add esi,64 add esi,64
%ifdef __WIN32__
cmp eax,239
%else
cmp eax,223 cmp eax,223
%endif
jne .Copying3 jne .Copying3
xor eax,eax xor eax,eax
mov ecx,128 mov ecx,128
@@ -95,6 +101,33 @@ NEWSYM DrawWin256x224x16
emms emms
popad popad
ret 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 NEWSYM DrawWin320x240x16
pushad pushad

View File

@@ -2042,6 +2042,9 @@ void clearwin()
UnlockSurface(); UnlockSurface();
} }
extern void DrawWin256x224x16();
extern void DrawWin256x224x32();
void drawscreenwin(void) void drawscreenwin(void)
{ {
DWORD i,j,color32; DWORD i,j,color32;
@@ -2094,65 +2097,8 @@ void drawscreenwin(void)
switch (BitDepth) switch (BitDepth)
{ {
case 16: case 16:
if (MMXSupport == 1) { {
_asm { DrawWin256x224x16();
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
}
} }
break; break;
case 32: case 32: