Fixed MMX interpolation bug with scanlines

This commit is contained in:
pagefault
2003-03-16 22:02:12 +00:00
parent c700560655
commit fc373239e9

View File

@@ -40,6 +40,7 @@ NEWSYM copy640x480x16bwin
cmp byte[curblank],40h
jne .startcopy
ret
ALIGN4
.startcopy
push es
mov ax,ds
@@ -57,35 +58,36 @@ NEWSYM copy640x480x16bwin
cmp byte[MMXSupport],1
jne .nommx
cmp byte[En2xSaI],0
jne near Process2xSaIwin
jne Process2xSaIwin
.nommx
cmp byte[antienab],1
je near interpolate640x480x16bwin
je interpolate640x480x16bwin
.nointerp
mov dl,[resolutn]
sub dl,2
cmp byte[scanlines],1
je near .scanlines
je .scanlines
cmp byte[scanlines],3
je near .halfscanlines
je .halfscanlines
cmp byte[scanlines],2
je near .quartscanlines
je .quartscanlines
mov ebx,hirestiledat+1
cmp byte[newengen],0
je .loopa
mov ebx,SpecialLine+1
ALIGN4
.loopa
mov ecx,256
cmp byte[ebx],1
je near .yeshires
je .yeshires
cmp byte[GUIOn],1
je .ignorehr
cmp byte[ebx],1
ja near .yeshiresng
ja .yeshiresng
.ignorehr
cmp byte[MMXSupport],1
je near .mmx
je .mmx
.a
mov ax,[esi]
shl eax,16
@@ -112,15 +114,17 @@ NEWSYM copy640x480x16bwin
add edi,[AddEndBytes]
inc ebx
dec dl
jnz near .loopa
jnz .loopa
pop es
xor byte[res512switch],1
cmp byte[MMXSupport],1
je .mmx2
ret
ALIGN4
.mmx2
emms
ret
ALIGN4
.yeshires
mov byte[ebx],0
test byte[res512switch],1
@@ -138,6 +142,7 @@ NEWSYM copy640x480x16bwin
pop ebx
add edi,[NumBytesPerLine]
jmp .return
ALIGN4
.rightside
push ebx
mov ebx,[NumBytesPerLine]
@@ -152,6 +157,7 @@ NEWSYM copy640x480x16bwin
pop ebx
add edi,[NumBytesPerLine]
jmp .return
ALIGN4
.mmx
mov eax,[spritetablea]
mov ecx,64
@@ -188,10 +194,12 @@ NEWSYM copy640x480x16bwin
dec ecx
jnz .mmxr2
jmp .return
ALIGN4
.yeshiresng
call HighResProc
jmp .return
ALIGN4
.bng
mov eax,[esi+75036*4-2]
mov ax,[esi]
@@ -213,6 +221,7 @@ NEWSYM copy640x480x16bwin
jnz .bngb
jmp .return
ALIGN4
.scanlines
mov ebx,hirestiledat+1
cmp byte[GUIOn],1
@@ -220,6 +229,7 @@ NEWSYM copy640x480x16bwin
cmp byte[newengen],0
je .loopab
mov ebx,SpecialLine+1
ALIGN4
.loopab
mov ecx,256
cmp byte[ebx],1
@@ -228,9 +238,10 @@ NEWSYM copy640x480x16bwin
jbe .ignorehrb
call HighResProc
jmp .returnb
ALIGN4
.ignorehrb
cmp byte[MMXSupport],1
je near .mmxsl
je .mmxsl
.ab
mov ax,[esi]
shl eax,16
@@ -244,6 +255,7 @@ NEWSYM copy640x480x16bwin
add esi,64
add edi,[AddEndBytes]
mov ecx,256
ALIGN4
.fslloop
mov dword[edi],0
add edi,4
@@ -256,8 +268,9 @@ NEWSYM copy640x480x16bwin
pop es
xor byte[res512switch],1
cmp byte[MMXSupport],1
je near .mmx2
je .mmx2
ret
ALIGN4
.yeshiresb
mov byte[ebx],0
test byte[res512switch],1
@@ -270,6 +283,7 @@ NEWSYM copy640x480x16bwin
dec ecx
jnz .bb
jmp .returnb
ALIGN4
.rightsideb
.cb
mov ax,[esi]
@@ -279,6 +293,7 @@ NEWSYM copy640x480x16bwin
dec ecx
jnz .cb
jmp .returnb
ALIGN4
.mmxsl
mov ecx,64
.mmxrsl
@@ -295,6 +310,7 @@ NEWSYM copy640x480x16bwin
jnz .mmxrsl
jmp .returnb
ALIGN4
.halfscanlines
mov ebx,hirestiledat+1
cmp byte[GUIOn],1
@@ -302,14 +318,16 @@ NEWSYM copy640x480x16bwin
cmp byte[newengen],0
je .loopabh
mov ebx,SpecialLine+1
ALIGN4
.loopabh
cmp byte[ebx],1
jbe .ignorehrbh
call HighResProc
jmp .returnbh
ALIGN4
.ignorehrbh
cmp byte[MMXSupport],1
je near .mmxslh
je .mmxslh
mov ecx,256
.abh
mov ax,[esi]
@@ -339,11 +357,12 @@ NEWSYM copy640x480x16bwin
add edi,[AddEndBytes]
inc ebx
dec dl
jnz near .loopabh
jnz .loopabh
pop es
cmp byte[MMXSupport],1
je near .mmx2
je .mmx2
ret
ALIGN4
.mmxslh
mov eax,[spritetablea]
mov ecx,64
@@ -390,6 +409,7 @@ NEWSYM copy640x480x16bwin
jnz .mmxr2h
jmp .returnbh
ALIGN4
.quartscanlines
mov [lineleft],dl
mov ebx,hirestiledat+1
@@ -398,14 +418,16 @@ NEWSYM copy640x480x16bwin
cmp byte[newengen],0
je .loopabh2
mov ebx,SpecialLine+1
ALIGN4
.loopabh2
cmp byte[ebx],1
jbe .ignorehrbh2
call HighResProc
jmp .returnbh2
ALIGN4
.ignorehrbh2
cmp byte[MMXSupport],1
je near .mmxslh2
je .mmxslh2
mov ecx,256
.abh2
mov ax,[esi]
@@ -439,11 +461,12 @@ NEWSYM copy640x480x16bwin
add edi,[AddEndBytes]
inc ebx
dec byte[lineleft]
jnz near .loopabh2
jnz .loopabh2
pop es
cmp byte[MMXSupport],1
je near .mmx2
je .mmx2
ret
ALIGN4
.mmxslh2
mov eax,[spritetablea]
mov ecx,64
@@ -490,12 +513,13 @@ NEWSYM copy640x480x16bwin
jnz .mmxr2h2
jmp .returnbh2
ALIGN4
HighResProc:
mov ecx,256
cmp byte[ebx],3
je near .hiresmode7
je .hiresmode7
cmp byte[ebx],7
je near .hiresmode7
je .hiresmode7
test byte[ebx],4
jz .nofield
cmp byte[scanlines],0
@@ -505,7 +529,7 @@ HighResProc:
add edi,[NumBytesPerLine]
.nofield
test byte[ebx],3
jnz near .hires
jnz .hires
.a
mov ax,[esi]
shl eax,16
@@ -522,6 +546,7 @@ HighResProc:
add edi,[NumBytesPerLine]
.nofielde
ret
ALIGN4
.hiresmode7
cmp byte[MMXSupport],1
je .yeshiresngmmxmode7
@@ -549,6 +574,7 @@ HighResProc:
jnz .a2b
sub esi,75036*4
ret
ALIGN4
.yeshiresngmmxmode7
mov ecx,64
.mmxr
@@ -581,9 +607,10 @@ HighResProc:
jnz .mmxrb
sub esi,75036*4
ret
ALIGN4
.hires
cmp byte[MMXSupport],1
je near .yeshiresngmmx
je .yeshiresngmmx
.bng
mov eax,[esi+75036*4-2]
mov ax,[esi]
@@ -601,13 +628,14 @@ HighResProc:
add edi,[NumBytesPerLine]
.lowerfield
ret
ALIGN4
.nofieldb
cmp byte[scanlines],1
je near .scanlines
je .scanlines
cmp byte[scanlines],3
je near .halfscanlines
je .halfscanlines
cmp byte[scanlines],2
je near .quartscanlines
je .quartscanlines
add edi,[AddEndBytes]
sub esi,256*2
mov ecx,256
@@ -620,8 +648,10 @@ HighResProc:
dec ecx
jnz .bngb
ret
ALIGN4
.scanlines
ret
ALIGN4
.yeshiresngmmx
mov eax,[spritetablea]
mov ecx,64
@@ -650,19 +680,20 @@ HighResProc:
add edi,[NumBytesPerLine]
.lowerfieldb
ret
ALIGN4
.nofieldc
cmp byte[scanlines],1
je near .scanlines
je .scanlines
cmp byte[scanlines],3
je near .halfscanlinesmmx
je .halfscanlinesmmx
cmp byte[scanlines],2
je near .quartscanlinesmmx
je .quartscanlinesmmx
test byte[ebx+1],3
jz .noaa
cmp byte[En2xSaI],0
jne near .antialias
jne .antialias
cmp byte[antienab],0
jne near .antialias
jne .antialias
.noaa
add edi,[AddEndBytes]
mov eax,[spritetablea]
@@ -682,6 +713,7 @@ HighResProc:
dec ecx
jnz .mmxr2
ret
ALIGN4
.antialias
add edi,[AddEndBytes]
mov eax,[spritetablea]
@@ -715,6 +747,7 @@ HighResProc:
dec ecx
jnz .mmxr2aa
ret
ALIGN4
.halfscanlines
add edi,[AddEndBytes]
sub esi,256*2
@@ -731,6 +764,7 @@ HighResProc:
dec ecx
jnz .abhs
ret
ALIGN4
.quartscanlines
add edi,[AddEndBytes]
sub esi,256*2
@@ -750,6 +784,7 @@ HighResProc:
dec ecx
jnz .abhs2
ret
ALIGN4
.halfscanlinesmmx
mov eax,[spritetablea]
mov ecx,32
@@ -778,6 +813,7 @@ HighResProc:
dec ecx
jnz .mmxr2h
ret
ALIGN4
.quartscanlinesmmx
mov eax,[spritetablea]
mov ecx,64
@@ -807,6 +843,7 @@ HighResProc:
jnz .mmxr2h2
ret
ALIGN4
Process2xSaIwin:
mov ebx,hirestiledat+1
cmp byte[GUIOn],1
@@ -814,6 +851,7 @@ Process2xSaIwin:
cmp byte[newengen],0
je .loopabi
mov ebx,SpecialLine+1
ALIGN4
.loopabi
mov [InterPtr],ebx
@@ -845,6 +883,7 @@ Process2xSaIwin:
jnz .nextb
pop ebx
jmp .returninterp
ALIGN4
.ignorehr
;srcPtr equ 8
@@ -874,9 +913,11 @@ Process2xSaIwin:
je .super2xSaI
call _2xSaILineW
jmp .normal
ALIGN4
.supereagle
call _2xSaISuperEagleLineW
jmp .normal
ALIGN4
.super2xSaI
call _2xSaISuper2xSaILineW
.normal
@@ -888,9 +929,10 @@ Process2xSaIwin:
add ebx,576
inc dword[InterPtr]
dec dword[lineleft]
jnz near .next
jnz .next
mov ecx,256
sub edi,[NumBytesPerLine]
ALIGN4
.loop
mov dword[es:edi],0
add edi,4
@@ -899,17 +941,19 @@ Process2xSaIwin:
pop es
emms
ret
ALIGN4
.returninterp
add esi,64
inc dword[InterPtr]
add edi,[AddEndBytes]
add ebx,576
dec byte[lineleft]
jnz near .next
jnz .next
emms
pop es
ret
ALIGN4
MMXInterpolwin:
mov ebx,hirestiledat+1
cmp byte[GUIOn],1
@@ -917,17 +961,18 @@ MMXInterpolwin:
cmp byte[newengen],0
je .loopab
mov ebx,SpecialLine+1
ALIGN4
.loopab
mov dl,[resolutn]
sub dl,3
movq mm2,[HalfTransC]
cmp byte[scanlines],1
je near .scanlines
je .scanlines
cmp byte[scanlines],2
je near .scanlinesquart
je .scanlinesquart
cmp byte[scanlines],3
je near .scanlineshalf
je .scanlineshalf
inc ebx
mov [lineleft],dl
; do scanlines
@@ -970,6 +1015,7 @@ MMXInterpolwin:
call HighResProc
movq mm2,[HalfTransC]
jmp .returninterp
ALIGN4
.ignorehr
mov eax,[esi+510]
mov ecx,64
@@ -1022,7 +1068,7 @@ MMXInterpolwin:
add edi,16
add edx,16
dec ecx
jnz near .a3
jnz .a3
add edi,[AddEndBytes]
mov edx,[spritetablea]
add edx,512
@@ -1041,11 +1087,12 @@ MMXInterpolwin:
add edi,[AddEndBytes]
inc ebx
dec byte[lineleft]
jnz near .a5
jnz .a5
emms
pop es
ret
ALIGN4
.scanlines
inc dl
mov [lineleft],dl
@@ -1059,6 +1106,7 @@ MMXInterpolwin:
call HighResProc
movq mm2,[HalfTrans]
jmp .returninterps
ALIGN4
.ignorehrs
.a
movq mm0,[esi]
@@ -1079,12 +1127,13 @@ MMXInterpolwin:
add edi,16
dec ecx
jnz .a
mov eax,[esi+510]
mov [esi+512],eax
; mov eax,[esi+510]
; mov [esi+512],eax
.returninterps
add esi,64
add edi,[AddEndBytes]
mov ecx,256
ALIGN4
.fslloop
mov dword[edi],0
add edi,4
@@ -1094,11 +1143,12 @@ MMXInterpolwin:
inc ebx
mov ecx,64
dec byte[lineleft]
jnz near .asl
jnz .asl
emms
pop es
ret
ALIGN4
.scanlineshalf
inc dl
mov [lineleft],dl
@@ -1109,6 +1159,7 @@ MMXInterpolwin:
call HighResProc
movq mm2,[HalfTrans]
jmp .returninterphs
ALIGN4
.ignorehrhs
mov eax,[esi+510]
mov ecx,64
@@ -1158,11 +1209,12 @@ MMXInterpolwin:
add esi,64
inc ebx
dec byte[lineleft]
jnz near .ahb
jnz .ahb
emms
pop es
ret
ALIGN4
.scanlinesquart
inc dl
mov [lineleft],dl
@@ -1173,6 +1225,7 @@ MMXInterpolwin:
call HighResProc
movq mm2,[HalfTransC]
jmp .returninterpqs
ALIGN4
.ignorehrqs
mov eax,[esi+510]
mov ecx,64
@@ -1208,6 +1261,8 @@ MMXInterpolwin:
add edi,[AddEndBytes]
sub edx,16*64
mov ecx,64
movq mm3,mm2
.ahc2
movq mm0,[edx]
movq mm1,[edx+8]
@@ -1234,14 +1289,15 @@ MMXInterpolwin:
add edi,[AddEndBytes]
inc ebx
dec byte[lineleft]
jnz near .ahb2
jnz .ahb2
emms
pop es
ret
ALIGN4
NEWSYM interpolate640x480x16bwin
cmp byte[MMXSupport],1
je near MMXInterpolwin
je MMXInterpolwin
mov ebx,hirestiledat+1
cmp byte[GUIOn],1
@@ -1249,17 +1305,18 @@ NEWSYM interpolate640x480x16bwin
cmp byte[newengen],0
je .loopabi
mov ebx,SpecialLine+1
ALIGN4
.loopabi
mov [InterPtr],ebx
mov dl,[resolutn]
sub dl,3
cmp byte[scanlines],1
je near .scanlines
je .scanlines
cmp byte[scanlines],2
je near .scanlinesquart
je .scanlinesquart
cmp byte[scanlines],3
je near .scanlineshalf
je .scanlineshalf
inc dword[InterPtr]
mov [lineleft],dl
; do first line
@@ -1283,12 +1340,14 @@ NEWSYM interpolate640x480x16bwin
add esi,66
add edi,[AddEndBytes]
add edi,4
ALIGN4
.loopb
mov ebx,[InterPtr]
cmp byte[ebx],1
jbe .ignorehr
call HighResProc
jmp .returninterp
ALIGN4
.ignorehr
mov ecx,255
mov edx,[spritetablea]
@@ -1329,18 +1388,20 @@ NEWSYM interpolate640x480x16bwin
add edi,[AddEndBytes]
add edi,4
dec byte[lineleft]
jnz near .loopb
jnz .loopb
pop es
ret
ALIGN4
.returninterp
add esi,64
inc dword[InterPtr]
add edi,[AddEndBytes]
dec byte[lineleft]
jnz near .loopb
jnz .loopb
pop es
ret
ALIGN4
.scanlines
xor eax,eax
mov ebx,hirestiledat+1
@@ -1349,6 +1410,7 @@ NEWSYM interpolate640x480x16bwin
cmp byte[newengen],0
je .loopabis
mov ebx,SpecialLine+1
ALIGN4
.loopabis
.loopab
mov ecx,255
@@ -1356,6 +1418,7 @@ NEWSYM interpolate640x480x16bwin
jbe .ignorehrs
call HighResProc
jmp .returninterps
ALIGN4
.ignorehrs
cmp byte[ebx],1
je .yeshiresb
@@ -1380,6 +1443,7 @@ NEWSYM interpolate640x480x16bwin
add edi,4
add edi,[AddEndBytes]
mov ecx,256
ALIGN4
.fslloop
mov dword[edi],0
add edi,4
@@ -1392,6 +1456,7 @@ NEWSYM interpolate640x480x16bwin
pop es
xor byte[res512switch],1
ret
ALIGN4
.yeshiresb
mov byte[ebx],0
test byte[res512switch],1
@@ -1404,6 +1469,7 @@ NEWSYM interpolate640x480x16bwin
dec ecx
jnz .bb
jmp .returnb
ALIGN4
.rightsideb
.cb
mov ax,[esi]
@@ -1413,11 +1479,13 @@ NEWSYM interpolate640x480x16bwin
dec ecx
jnz .cb
jmp .returnb
ALIGN4
.returninterps
add esi,64
inc dword[InterPtr]
add edi,[AddEndBytes]
mov ecx,256
ALIGN4
.fslloop2
mov dword[edi],0
add edi,4
@@ -1425,19 +1493,22 @@ NEWSYM interpolate640x480x16bwin
jnz .fslloop2
add edi,[AddEndBytes]
dec byte[lineleft]
jnz near .loopab
jnz .loopab
pop es
ret
ALIGN4
.scanlineshalf
xor eax,eax
mov [lineleft],dl
ALIGN4
.loopab2
mov ebx,[InterPtr]
cmp byte[ebx],1
jbe .ignorehrhs
call HighResProc
jmp .returninterphs
ALIGN4
.ignorehrhs
mov ecx,255
mov edx,[spritetablea]
@@ -1476,27 +1547,31 @@ NEWSYM interpolate640x480x16bwin
add edi,4
add edi,[AddEndBytes]
dec byte[lineleft]
jnz near .loopab2
jnz .loopab2
pop es
ret
ALIGN4
.returninterphs
add esi,64
inc dword[InterPtr]
add edi,[AddEndBytes]
dec byte[lineleft]
jnz near .loopab2
jnz .loopab2
pop es
ret
ALIGN4
.scanlinesquart
xor eax,eax
mov [lineleft],dl
ALIGN4
.loopab3
mov ebx,[InterPtr]
cmp byte[ebx],1
jbe .ignorehrqs
call HighResProc
jmp .returninterpqs
ALIGN4
.ignorehrqs
mov ecx,255
mov edx,[spritetablea]
@@ -1539,15 +1614,16 @@ NEWSYM interpolate640x480x16bwin
add edi,4
add edi,[AddEndBytes]
dec byte[lineleft]
jnz near .loopab3
jnz .loopab3
pop es
ret
ALIGN4
.returninterpqs
add esi,64
inc dword[InterPtr]
add edi,[AddEndBytes]
dec byte[lineleft]
jnz near .loopab3
jnz .loopab3
pop es
ret