Some fixes. Make HQXx assembly work on all x86 OSs.

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@65 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
Nach 2007-11-14 11:21:04 +00:00
parent 06c0ee5eda
commit b3b3720211
6 changed files with 109 additions and 38 deletions

View File

@ -824,10 +824,11 @@ void gbSoundReset()
sound4EnvelopeATLReload = 0; sound4EnvelopeATLReload = 0;
// don't translate // don't translate
#ifndef FINAL_VERSION
if(soundDebug) { if(soundDebug) {
log("*** Sound Init ***\n"); log("*** Sound Init ***\n");
} }
#endif
gbSoundEvent(0xff10, 0x80); gbSoundEvent(0xff10, 0x80);
gbSoundEvent(0xff11, 0xbf); gbSoundEvent(0xff11, 0xbf);
gbSoundEvent(0xff12, 0xf3); gbSoundEvent(0xff12, 0xf3);
@ -854,10 +855,11 @@ void gbSoundReset()
gbSoundEvent(0xff26, 0xf1); gbSoundEvent(0xff26, 0xf1);
// don't translate // don't translate
#ifndef FINAL_VERSION
if(soundDebug) { if(soundDebug) {
log("*** Sound Init Complete ***\n"); log("*** Sound Init Complete ***\n");
} }
#endif
sound1On = 0; sound1On = 0;
sound2On = 0; sound2On = 0;
sound3On = 0; sound3On = 0;

View File

@ -18,10 +18,9 @@
;along with this program; if not, write to the Free Software ;along with this program; if not, write to the Free Software
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
GLOBAL _hq3x_16 %include "macros.mac"
EXTERN _LUT16to32 EXTSYM LUT16to32,RGBtoYUV
EXTERN _RGBtoYUV
SECTION .bss SECTION .bss
linesleft resd 1 linesleft resd 1
@ -53,7 +52,7 @@ SECTION .text
mov edx,[%1] mov edx,[%1]
cmp edx,[%2] cmp edx,[%2]
je %%fin je %%fin
mov ecx,_RGBtoYUV mov ecx,RGBtoYUV
movd mm1,[ecx+edx*4] movd mm1,[ecx+edx*4]
movq mm5,mm1 movq mm5,mm1
mov edx,[%2] mov edx,[%2]
@ -162,7 +161,7 @@ SECTION .text
%endmacro %endmacro
%macro Interp3 2 %macro Interp3 2
mov ecx, _LUT16to32 mov ecx, LUT16to32
movd mm1, [ecx+eax*4] movd mm1, [ecx+eax*4]
mov edx, %2 mov edx, %2
movd mm2, [ecx+edx*4] movd mm2, [ecx+edx*4]
@ -181,7 +180,7 @@ SECTION .text
%endmacro %endmacro
%macro Interp4 3 %macro Interp4 3
mov ecx, _LUT16to32 mov ecx, LUT16to32
movd mm1, [ecx+eax*4] movd mm1, [ecx+eax*4]
mov edx, %2 mov edx, %2
movd mm2, [ecx+edx*4] movd mm2, [ecx+edx*4]
@ -404,7 +403,7 @@ Yres equ 20
pitch equ 24 pitch equ 24
offset equ 28 offset equ 28
_hq3x_16: NEWSYM hq3x_16
push ebp push ebp
mov ebp,esp mov ebp,esp
pushad pushad
@ -480,7 +479,7 @@ _hq3x_16:
movzx edx,ax movzx edx,ax
mov [w9],edx mov [w9],edx
.flags .flags
mov ebx,_RGBtoYUV mov ebx,RGBtoYUV
mov eax,[w5] mov eax,[w5]
xor ecx,ecx xor ecx,ecx
movd mm5,[ebx+eax*4] movd mm5,[ebx+eax*4]

View File

@ -18,10 +18,9 @@
;along with this program; if not, write to the Free Software ;along with this program; if not, write to the Free Software
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
GLOBAL _hq3x_32 %include "macros.mac"
EXTERN _LUT16to32 EXTSYM LUT16to32,RGBtoYUV
EXTERN _RGBtoYUV
SECTION .bss SECTION .bss
linesleft resd 1 linesleft resd 1
@ -61,7 +60,7 @@ SECTION .text
mov edx,[%1] mov edx,[%1]
cmp edx,[%2] cmp edx,[%2]
je %%fin je %%fin
mov ecx,_RGBtoYUV mov ecx,RGBtoYUV
movd mm1,[ecx+edx*4] movd mm1,[ecx+edx*4]
movq mm5,mm1 movq mm5,mm1
mov edx,[%2] mov edx,[%2]
@ -370,7 +369,7 @@ Yres equ 20
pitch equ 24 pitch equ 24
offset equ 28 offset equ 28
_hq3x_32: NEWSYM hq3x_32
push ebp push ebp
mov ebp,esp mov ebp,esp
pushad pushad
@ -446,7 +445,7 @@ _hq3x_32:
movzx edx,ax movzx edx,ax
mov [w9],edx mov [w9],edx
.flags .flags
mov ebx,_RGBtoYUV mov ebx,RGBtoYUV
mov eax,[w5] mov eax,[w5]
xor ecx,ecx xor ecx,ecx
movd mm5,[ebx+eax*4] movd mm5,[ebx+eax*4]
@ -515,7 +514,7 @@ _hq3x_32:
test ecx,ecx test ecx,ecx
jnz .testflag1 jnz .testflag1
mov ecx,[cross] mov ecx,[cross]
mov ebx,_LUT16to32 mov ebx,LUT16to32
mov eax,[ebx+eax*4] mov eax,[ebx+eax*4]
jmp [FuncTable2+ecx*4] jmp [FuncTable2+ecx*4]
.testflag1 .testflag1
@ -575,7 +574,7 @@ _hq3x_32:
jz .noflag9 jz .noflag9
or ecx,128 or ecx,128
.noflag9 .noflag9
mov ebx,_LUT16to32 mov ebx,LUT16to32
mov eax,[ebx+eax*4] mov eax,[ebx+eax*4]
mov edx,[w2] mov edx,[w2]
mov edx,[ebx+edx*4] mov edx,[ebx+edx*4]

View File

@ -18,10 +18,9 @@
;along with this program; if not, write to the Free Software ;along with this program; if not, write to the Free Software
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
GLOBAL _hq4x_16 %include "macros.mac"
EXTERN _LUT16to32 EXTSYM LUT16to32,RGBtoYUV
EXTERN _RGBtoYUV
SECTION .bss SECTION .bss
linesleft resd 1 linesleft resd 1
@ -63,12 +62,12 @@ SECTION .text
jz %%fin jz %%fin
mov edx,[%1] mov edx,[%1]
shl edx,2 shl edx,2
add edx,_RGBtoYUV add edx,RGBtoYUV
movd mm1,[edx] movd mm1,[edx]
movq mm5,mm1 movq mm5,mm1
mov edx,[%2] mov edx,[%2]
shl edx,2 shl edx,2
add edx,_RGBtoYUV add edx,RGBtoYUV
movd mm2,[edx] movd mm2,[edx]
psubusb mm1,mm2 psubusb mm1,mm2
psubusb mm2,mm5 psubusb mm2,mm5
@ -182,7 +181,7 @@ SECTION .text
%endmacro %endmacro
%macro Interp3 3 %macro Interp3 3
mov eax, _LUT16to32 mov eax, LUT16to32
mov edx, %2 mov edx, %2
movd mm1, [eax+edx*4] movd mm1, [eax+edx*4]
mov edx, %3 mov edx, %3
@ -215,7 +214,7 @@ SECTION .text
%endmacro %endmacro
%macro Interp6 4 %macro Interp6 4
mov eax, _LUT16to32 mov eax, LUT16to32
mov edx, %2 mov edx, %2
movd mm1, [eax+edx*4] movd mm1, [eax+edx*4]
mov edx, %3 mov edx, %3
@ -240,7 +239,7 @@ SECTION .text
%endmacro %endmacro
%macro Interp7 4 %macro Interp7 4
mov eax, _LUT16to32 mov eax, LUT16to32
mov edx, %2 mov edx, %2
movd mm1, [eax+edx*4] movd mm1, [eax+edx*4]
mov edx, %3 mov edx, %3
@ -264,7 +263,7 @@ SECTION .text
%endmacro %endmacro
%macro Interp8 3 %macro Interp8 3
mov eax, _LUT16to32 mov eax, LUT16to32
mov edx, %2 mov edx, %2
movd mm1, [eax+edx*4] movd mm1, [eax+edx*4]
mov edx, %3 mov edx, %3
@ -867,7 +866,7 @@ Yres equ 20
pitch equ 24 pitch equ 24
offset equ 28 offset equ 28
_hq4x_16: NEWSYM hq4x_16
push ebp push ebp
mov ebp,esp mov ebp,esp
pushad pushad
@ -943,7 +942,7 @@ _hq4x_16:
movzx edx,ax movzx edx,ax
mov [w9],edx mov [w9],edx
.flags .flags
mov ebx,_RGBtoYUV mov ebx,RGBtoYUV
mov eax,[w5] mov eax,[w5]
xor ecx,ecx xor ecx,ecx
movd mm5,[ebx+eax*4] movd mm5,[ebx+eax*4]

View File

@ -18,10 +18,9 @@
;along with this program; if not, write to the Free Software ;along with this program; if not, write to the Free Software
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
GLOBAL _hq4x_32 %include "macros.mac"
EXTERN _LUT16to32 EXTSYM LUT16to32,RGBtoYUV
EXTERN _RGBtoYUV
SECTION .bss SECTION .bss
linesleft resd 1 linesleft resd 1
@ -71,12 +70,12 @@ SECTION .text
jz %%fin jz %%fin
mov edx,[%1] mov edx,[%1]
shl edx,2 shl edx,2
add edx,_RGBtoYUV add edx,RGBtoYUV
movd mm1,[edx] movd mm1,[edx]
movq mm5,mm1 movq mm5,mm1
mov edx,[%2] mov edx,[%2]
shl edx,2 shl edx,2
add edx,_RGBtoYUV add edx,RGBtoYUV
movd mm2,[edx] movd mm2,[edx]
psubusb mm1,mm2 psubusb mm1,mm2
psubusb mm2,mm5 psubusb mm2,mm5
@ -798,7 +797,7 @@ Yres equ 20
pitch equ 24 pitch equ 24
offset equ 28 offset equ 28
_hq4x_32: NEWSYM hq4x_32
push ebp push ebp
mov ebp,esp mov ebp,esp
pushad pushad
@ -874,7 +873,7 @@ _hq4x_32:
movzx edx,ax movzx edx,ax
mov [w9],edx mov [w9],edx
.flags .flags
mov ebx,_RGBtoYUV mov ebx,RGBtoYUV
mov eax,[w5] mov eax,[w5]
xor ecx,ecx xor ecx,ecx
movd mm5,[ebx+eax*4] movd mm5,[ebx+eax*4]
@ -942,7 +941,7 @@ _hq4x_32:
.noflag8 .noflag8
cmp dword[cross],0 cmp dword[cross],0
jnz .testflag1 jnz .testflag1
mov ebx,_LUT16to32 mov ebx,LUT16to32
mov eax,[ebx+eax*4] mov eax,[ebx+eax*4]
mov ebx,[ebp+pitch] mov ebx,[ebp+pitch]
AUXADDRESS AUXADDRESS
@ -1020,7 +1019,7 @@ _hq4x_32:
jz .noflag9 jz .noflag9
or ecx,128 or ecx,128
.noflag9 .noflag9
mov ebx,_LUT16to32 mov ebx,LUT16to32
mov eax,[ebx+eax*4] mov eax,[ebx+eax*4]
mov edx,[w2] mov edx,[w2]
mov edx,[ebx+edx*4] mov edx,[ebx+edx*4]

73
src/macros.mac Executable file
View File

@ -0,0 +1,73 @@
;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach )
;
;http://www.zsnes.com
;http://sourceforge.net/projects/zsnes
;https://zsnes.bountysource.com
;
;This program is free software; you can redistribute it and/or
;modify it under the terms of the GNU General Public License
;version 2 as published by the Free Software Foundation.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License
;along with this program; if not, write to the Free Software
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%ifdef __AMD64__
bits 64
%else
bits 32
%endif
%ifdef MACHO
section .text align=16
section .data align=4
section .bss align=4
%endif
%ifdef ELF
%imacro newsym 1
GLOBAL %1
%1:
%endmacro
%imacro newsym 2+
GLOBAL %1
%1: %2
%endmacro
%define EXTSYM EXTERN
section .note.GNU-stack noalloc noexec nowrite progbits
%else
%imacro newsym 1
GLOBAL _%1
_%1:
%1:
%endmacro
%imacro newsym 2+
GLOBAL _%1
_%1:
%1: %2
%endmacro
%imacro EXTSYM 1-*
%rep %0
EXTERN _%1
%define %1 _%1
%rotate 1
%endrep
%endmacro
%endif
%macro ALIGN32 0
times ($$-$) & 1Fh nop ; Long word alignment
%endmacro
%macro ALIGN16 0
times ($$-$) & 1Fh nop ; Long word alignment
%endmacro