diff --git a/src/asm/ftol.nasm b/src/asm/ftol.nasm deleted file mode 100644 index 9f9f285c1..000000000 --- a/src/asm/ftol.nasm +++ /dev/null @@ -1,131 +0,0 @@ -; -; qftol -- fast floating point to long conversion. -; - -segment .data - -temp dd 0.0 -fpucw dd 0 - -; Precision Control Field , 2 bits / 0x0300 -; PC24 0x0000 Single precision (24 bits). -; PC53 0x0200 Double precision (53 bits). -; PC64 0x0300 Extended precision (64 bits). - -; Rounding Control Field, 2 bits / 0x0C00 -; RCN 0x0000 Rounding to nearest (even). -; RCD 0x0400 Rounding down (directed, minus). -; RCU 0x0800 Rounding up (directed plus). -; RC0 0x0C00 Rounding towards zero (chop mode). - - -; rounding towards nearest (even) -cw027F dd 0x027F ; double precision -cw037F dd 0x037F ; extended precision - -; rounding towards zero (chop mode) -cw0E7F dd 0x0E7F ; double precision -cw0F7F dd 0x0F7F ; extended precision - - -segment .text - -; -; int qftol( void ) - default control word -; - -global qftol - -qftol: - fistp dword [temp] - mov eax, [temp] - ret - - -; -; int qftol027F( void ) - DirectX FPU -; - -global qftol027F - -qftol027F: - fnstcw [fpucw] - fldcw [cw027F] - fistp dword [temp] - fldcw [fpucw] - mov eax, [temp] - ret - -; -; int qftol037F( void ) - Linux FPU -; - -global qftol037F - -qftol037F: - fnstcw [fpucw] - fldcw [cw037F] - fistp dword [temp] - fldcw [fpucw] - mov eax, [temp] - ret - - -; -; int qftol0F7F( void ) - ANSI -; - -global qftol0F7F - -qftol0F7F: - fnstcw [fpucw] - fldcw [cw0F7F] - fistp dword [temp] - fldcw [fpucw] - mov eax, [temp] - ret - -; -; int qftol0E7F( void ) -; - -global qftol0E7F - -qftol0E7F: - fnstcw [fpucw] - fldcw [cw0E7F] - fistp dword [temp] - fldcw [fpucw] - mov eax, [temp] - ret - - - -; -; long Q_ftol( float q ) -; - -global Q_ftol - -Q_ftol: - fld dword [esp+4] - fistp dword [temp] - mov eax, [temp] - ret - - -; -; long qftol0F7F( float q ) - Linux FPU -; - -global Q_ftol0F7F - -Q_ftol0F7F: - fnstcw [fpucw] - fld dword [esp+4] - fldcw [cw0F7F] - fistp dword [temp] - fldcw [fpucw] - mov eax, [temp] - ret - diff --git a/src/asm/ftola.s b/src/asm/ftola.s deleted file mode 100644 index 89f05c0ba..000000000 --- a/src/asm/ftola.s +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Wolfenstein: Enemy Territory GPL Source Code - * Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company. - * - * ET: Legacy - * Copyright (C) 2012 Jan Simek - * - * This file is part of ET: Legacy. - * - * ET: Legacy is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ET: Legacy 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 ET: Legacy. If not, see . - * - * In addition, Wolfenstein: Enemy Territory GPL Source Code is also - * subject to certain additional terms. You should have received a copy - * of these additional terms immediately following the terms and conditions - * of the GNU General Public License which accompanied the source code. - * If not, please request a copy in writing from id Software at the address below. - * - * id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - * - * @file ftola.s - * @brief fast floating point to long conversion. - */ - -// 23/09/05 Ported to gas by intel2gas, best supporting actor Tim Angus -// - -#include "qasm.h" - -#if id386 - -.data - -temp: .single 0.0 -fpucw: .long 0 - -// Precision Control Field , 2 bits / 0x0300 -// PC24 0x0000 Single precision (24 bits). -// PC53 0x0200 Double precision (53 bits). -// PC64 0x0300 Extended precision (64 bits). - -// Rounding Control Field, 2 bits / 0x0C00 -// RCN 0x0000 Rounding to nearest (even). -// RCD 0x0400 Rounding down (directed, minus). -// RCU 0x0800 Rounding up (directed plus). -// RC0 0x0C00 Rounding towards zero (chop mode). - - -// rounding towards nearest (even) -cw027F: .long 0x027F -cw037F: .long 0x037F - -// rounding towards zero (chop mode) -cw0E7F: .long 0x0E7F -cw0F7F: .long 0x0F7F - - -.text - -// -// int qftol( void ) - default control word -// - -.globl C(qftol) - -C(qftol): - fistpl temp - movl temp,%eax - ret - - -// -// int qftol027F( void ) - DirectX FPU -// - -.globl C(qftol027F) - -C(qftol027F): - fnstcw fpucw - fldcw cw027F - fistpl temp - fldcw fpucw - movl temp,%eax - ret - -// -// int qftol037F( void ) - Linux FPU -// - -.globl C(qftol037F) - -C(qftol037F): - fnstcw fpucw - fldcw cw037F - fistpl temp - fldcw fpucw - movl temp,%eax - ret - - -// -// int qftol0F7F( void ) - ANSI -// - -.globl C(qftol0F7F) - -C(qftol0F7F): - fnstcw fpucw - fldcw cw0F7F - fistpl temp - fldcw fpucw - movl temp,%eax - ret - -// -// int qftol0E7F( void ) -// - -.globl C(qftol0E7F) - -C(qftol0E7F): - fnstcw fpucw - fldcw cw0E7F - fistpl temp - fldcw fpucw - movl temp,%eax - ret - - - -// -// long Q_ftol( float q ) -// - -.globl C(Q_ftol) - -C(Q_ftol): - flds 4(%esp) - fistpl temp - movl temp,%eax - ret - - -// -// long qftol0F7F( float q ) - Linux FPU -// - -.globl C(Q_ftol0F7F) - -C(Q_ftol0F7F): - fnstcw fpucw - flds 4(%esp) - fldcw cw0F7F - fistpl temp - fldcw fpucw - movl temp,%eax - ret -#endif diff --git a/src/asm/matha.s b/src/asm/matha.s deleted file mode 100644 index 5248ecb57..000000000 --- a/src/asm/matha.s +++ /dev/null @@ -1,382 +0,0 @@ -/* - * Wolfenstein: Enemy Territory GPL Source Code - * Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company. - * - * ET: Legacy - * Copyright (C) 2012 Jan Simek - * - * This file is part of ET: Legacy. - * - * ET: Legacy is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ET: Legacy 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 ET: Legacy. If not, see . - * - * In addition, Wolfenstein: Enemy Territory GPL Source Code is also - * subject to certain additional terms. You should have received a copy - * of these additional terms immediately following the terms and conditions - * of the GNU General Public License which accompanied the source code. - * If not, please request a copy in writing from id Software at the address below. - * - * id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - * - * @file matha.s - * @brief x86 assembly-language math routines. - */ - -#include "qasm.h" - - -#if id386 - .data - - .align 4 -Ljmptab: .long Lcase0, Lcase1, Lcase2, Lcase3 - .long Lcase4, Lcase5, Lcase6, Lcase7 - - .text - -// TODO: rounding needed? -// stack parameter offset -#define val 4 - -.globl C(Invert24To16) -C(Invert24To16): - - movl val(%esp),%ecx - movl $0x100,%edx // 0x10000000000 as dividend - cmpl %edx,%ecx - jle LOutOfRange - - subl %eax,%eax - divl %ecx - - ret - -LOutOfRange: - movl $0xFFFFFFFF,%eax - ret - -#define EMINS 4+4 -#define EMAXS 4+8 -#define P 4+12 - - .align 2 -.globl C(BoxOnPlaneSide) -C(BoxOnPlaneSide): - pushl %ebx - - movl P(%esp),%edx - movl EMINS(%esp),%ecx - xorl %eax,%eax - movl EMAXS(%esp),%ebx - movb pl_signbits(%edx),%al - cmpb $8,%al - jge Lerror - flds pl_normal(%edx) // p->normal[0] - fld %st(0) // p->normal[0] | p->normal[0] - // bk000422 - warning: missing prefix `*' in absolute indirect address, maybe misassembled! - // bk001129 - fix from Andrew Henderson, was: Ljmptab(,%eax,4) - jmp *Ljmptab(,%eax,4) - - -//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2]; -//dist2= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2]; -Lcase0: - fmuls (%ebx) // p->normal[0]*emaxs[0] | p->normal[0] - flds pl_normal+4(%edx) // p->normal[1] | p->normal[0]*emaxs[0] | - // p->normal[0] - fxch %st(2) // p->normal[0] | p->normal[0]*emaxs[0] | - // p->normal[1] - fmuls (%ecx) // p->normal[0]*emins[0] | - // p->normal[0]*emaxs[0] | p->normal[1] - fxch %st(2) // p->normal[1] | p->normal[0]*emaxs[0] | - // p->normal[0]*emins[0] - fld %st(0) // p->normal[1] | p->normal[1] | - // p->normal[0]*emaxs[0] | - // p->normal[0]*emins[0] - fmuls 4(%ebx) // p->normal[1]*emaxs[1] | p->normal[1] | - // p->normal[0]*emaxs[0] | - // p->normal[0]*emins[0] - flds pl_normal+8(%edx) // p->normal[2] | p->normal[1]*emaxs[1] | - // p->normal[1] | p->normal[0]*emaxs[0] | - // p->normal[0]*emins[0] - fxch %st(2) // p->normal[1] | p->normal[1]*emaxs[1] | - // p->normal[2] | p->normal[0]*emaxs[0] | - // p->normal[0]*emins[0] - fmuls 4(%ecx) // p->normal[1]*emins[1] | - // p->normal[1]*emaxs[1] | - // p->normal[2] | p->normal[0]*emaxs[0] | - // p->normal[0]*emins[0] - fxch %st(2) // p->normal[2] | p->normal[1]*emaxs[1] | - // p->normal[1]*emins[1] | - // p->normal[0]*emaxs[0] | - // p->normal[0]*emins[0] - fld %st(0) // p->normal[2] | p->normal[2] | - // p->normal[1]*emaxs[1] | - // p->normal[1]*emins[1] | - // p->normal[0]*emaxs[0] | - // p->normal[0]*emins[0] - fmuls 8(%ebx) // p->normal[2]*emaxs[2] | - // p->normal[2] | - // p->normal[1]*emaxs[1] | - // p->normal[1]*emins[1] | - // p->normal[0]*emaxs[0] | - // p->normal[0]*emins[0] - fxch %st(5) // p->normal[0]*emins[0] | - // p->normal[2] | - // p->normal[1]*emaxs[1] | - // p->normal[1]*emins[1] | - // p->normal[0]*emaxs[0] | - // p->normal[2]*emaxs[2] - faddp %st(0),%st(3) //p->normal[2] | - // p->normal[1]*emaxs[1] | - // p->normal[1]*emins[1]+p->normal[0]*emins[0]| - // p->normal[0]*emaxs[0] | - // p->normal[2]*emaxs[2] - fmuls 8(%ecx) //p->normal[2]*emins[2] | - // p->normal[1]*emaxs[1] | - // p->normal[1]*emins[1]+p->normal[0]*emins[0]| - // p->normal[0]*emaxs[0] | - // p->normal[2]*emaxs[2] - fxch %st(1) //p->normal[1]*emaxs[1] | - // p->normal[2]*emins[2] | - // p->normal[1]*emins[1]+p->normal[0]*emins[0]| - // p->normal[0]*emaxs[0] | - // p->normal[2]*emaxs[2] - faddp %st(0),%st(3) //p->normal[2]*emins[2] | - // p->normal[1]*emins[1]+p->normal[0]*emins[0]| - // p->normal[0]*emaxs[0]+p->normal[1]*emaxs[1]| - // p->normal[2]*emaxs[2] - fxch %st(3) //p->normal[2]*emaxs[2] + - // p->normal[1]*emins[1]+p->normal[0]*emins[0]| - // p->normal[0]*emaxs[0]+p->normal[1]*emaxs[1]| - // p->normal[2]*emins[2] - faddp %st(0),%st(2) //p->normal[1]*emins[1]+p->normal[0]*emins[0]| - // dist1 | p->normal[2]*emins[2] - - jmp LSetSides - -//dist1= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2]; -//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2]; -Lcase1: - fmuls (%ecx) // emins[0] - flds pl_normal+4(%edx) - fxch %st(2) - fmuls (%ebx) // emaxs[0] - fxch %st(2) - fld %st(0) - fmuls 4(%ebx) // emaxs[1] - flds pl_normal+8(%edx) - fxch %st(2) - fmuls 4(%ecx) // emins[1] - fxch %st(2) - fld %st(0) - fmuls 8(%ebx) // emaxs[2] - fxch %st(5) - faddp %st(0),%st(3) - fmuls 8(%ecx) // emins[2] - fxch %st(1) - faddp %st(0),%st(3) - fxch %st(3) - faddp %st(0),%st(2) - - jmp LSetSides - -//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2]; -//dist2= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2]; -Lcase2: - fmuls (%ebx) // emaxs[0] - flds pl_normal+4(%edx) - fxch %st(2) - fmuls (%ecx) // emins[0] - fxch %st(2) - fld %st(0) - fmuls 4(%ecx) // emins[1] - flds pl_normal+8(%edx) - fxch %st(2) - fmuls 4(%ebx) // emaxs[1] - fxch %st(2) - fld %st(0) - fmuls 8(%ebx) // emaxs[2] - fxch %st(5) - faddp %st(0),%st(3) - fmuls 8(%ecx) // emins[2] - fxch %st(1) - faddp %st(0),%st(3) - fxch %st(3) - faddp %st(0),%st(2) - - jmp LSetSides - -//dist1= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2]; -//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2]; -Lcase3: - fmuls (%ecx) // emins[0] - flds pl_normal+4(%edx) - fxch %st(2) - fmuls (%ebx) // emaxs[0] - fxch %st(2) - fld %st(0) - fmuls 4(%ecx) // emins[1] - flds pl_normal+8(%edx) - fxch %st(2) - fmuls 4(%ebx) // emaxs[1] - fxch %st(2) - fld %st(0) - fmuls 8(%ebx) // emaxs[2] - fxch %st(5) - faddp %st(0),%st(3) - fmuls 8(%ecx) // emins[2] - fxch %st(1) - faddp %st(0),%st(3) - fxch %st(3) - faddp %st(0),%st(2) - - jmp LSetSides - -//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2]; -//dist2= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2]; -Lcase4: - fmuls (%ebx) // emaxs[0] - flds pl_normal+4(%edx) - fxch %st(2) - fmuls (%ecx) // emins[0] - fxch %st(2) - fld %st(0) - fmuls 4(%ebx) // emaxs[1] - flds pl_normal+8(%edx) - fxch %st(2) - fmuls 4(%ecx) // emins[1] - fxch %st(2) - fld %st(0) - fmuls 8(%ecx) // emins[2] - fxch %st(5) - faddp %st(0),%st(3) - fmuls 8(%ebx) // emaxs[2] - fxch %st(1) - faddp %st(0),%st(3) - fxch %st(3) - faddp %st(0),%st(2) - - jmp LSetSides - -//dist1= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2]; -//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2]; -Lcase5: - fmuls (%ecx) // emins[0] - flds pl_normal+4(%edx) - fxch %st(2) - fmuls (%ebx) // emaxs[0] - fxch %st(2) - fld %st(0) - fmuls 4(%ebx) // emaxs[1] - flds pl_normal+8(%edx) - fxch %st(2) - fmuls 4(%ecx) // emins[1] - fxch %st(2) - fld %st(0) - fmuls 8(%ecx) // emins[2] - fxch %st(5) - faddp %st(0),%st(3) - fmuls 8(%ebx) // emaxs[2] - fxch %st(1) - faddp %st(0),%st(3) - fxch %st(3) - faddp %st(0),%st(2) - - jmp LSetSides - -//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2]; -//dist2= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2]; -Lcase6: - fmuls (%ebx) // emaxs[0] - flds pl_normal+4(%edx) - fxch %st(2) - fmuls (%ecx) // emins[0] - fxch %st(2) - fld %st(0) - fmuls 4(%ecx) // emins[1] - flds pl_normal+8(%edx) - fxch %st(2) - fmuls 4(%ebx) // emaxs[1] - fxch %st(2) - fld %st(0) - fmuls 8(%ecx) // emins[2] - fxch %st(5) - faddp %st(0),%st(3) - fmuls 8(%ebx) // emaxs[2] - fxch %st(1) - faddp %st(0),%st(3) - fxch %st(3) - faddp %st(0),%st(2) - - jmp LSetSides - -//dist1= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2]; -//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2]; -Lcase7: - fmuls (%ecx) // emins[0] - flds pl_normal+4(%edx) - fxch %st(2) - fmuls (%ebx) // emaxs[0] - fxch %st(2) - fld %st(0) - fmuls 4(%ecx) // emins[1] - flds pl_normal+8(%edx) - fxch %st(2) - fmuls 4(%ebx) // emaxs[1] - fxch %st(2) - fld %st(0) - fmuls 8(%ecx) // emins[2] - fxch %st(5) - faddp %st(0),%st(3) - fmuls 8(%ebx) // emaxs[2] - fxch %st(1) - faddp %st(0),%st(3) - fxch %st(3) - faddp %st(0),%st(2) - -LSetSides: - -// sides = 0; -// if (dist1 >= p->dist) -// sides = 1; -// if (dist2 < p->dist) -// sides |= 2; - - faddp %st(0),%st(2) // dist1 | dist2 - fcomps pl_dist(%edx) - xorl %ecx,%ecx - fnstsw %ax - fcomps pl_dist(%edx) - andb $1,%ah - xorb $1,%ah - addb %ah,%cl - - fnstsw %ax - andb $1,%ah - addb %ah,%ah - addb %ah,%cl - -// return sides; - - popl %ebx - movl %ecx,%eax // return status - - ret - - -Lerror: - movl 1, %eax - ret - -#endif // id386 diff --git a/src/asm/matha.spp b/src/asm/matha.spp deleted file mode 100644 index 462bbaad3..000000000 --- a/src/asm/matha.spp +++ /dev/null @@ -1,404 +0,0 @@ -// -// math.s -// x86 assembly-language math routines. - -#define GLQUAKE 1 // don't include unneeded defs -#include "qasm.h" - - -#if id386 - - .data - - .align 4 -Ljmptab: .long Lcase0, Lcase1, Lcase2, Lcase3 - .long Lcase4, Lcase5, Lcase6, Lcase7 - - .text - -// TODO: rounding needed? -// stack parameter offset -#define val 4 - -.globl C(Invert24To16) -C(Invert24To16): - - movl val(%esp),%ecx - movl $0x100,%edx // 0x10000000000 as dividend - cmpl %edx,%ecx - jle LOutOfRange - - subl %eax,%eax - divl %ecx - - ret - -LOutOfRange: - movl $0xFFFFFFFF,%eax - ret - -#if 0 - -#define in 4 -#define out 8 - - .align 2 -.globl C(TransformVector) -C(TransformVector): - movl in(%esp),%eax - movl out(%esp),%edx - - flds (%eax) // in[0] - fmuls C(vright) // in[0]*vright[0] - flds (%eax) // in[0] | in[0]*vright[0] - fmuls C(vup) // in[0]*vup[0] | in[0]*vright[0] - flds (%eax) // in[0] | in[0]*vup[0] | in[0]*vright[0] - fmuls C(vpn) // in[0]*vpn[0] | in[0]*vup[0] | in[0]*vright[0] - - flds 4(%eax) // in[1] | ... - fmuls C(vright)+4 // in[1]*vright[1] | ... - flds 4(%eax) // in[1] | in[1]*vright[1] | ... - fmuls C(vup)+4 // in[1]*vup[1] | in[1]*vright[1] | ... - flds 4(%eax) // in[1] | in[1]*vup[1] | in[1]*vright[1] | ... - fmuls C(vpn)+4 // in[1]*vpn[1] | in[1]*vup[1] | in[1]*vright[1] | ... - fxch %st(2) // in[1]*vright[1] | in[1]*vup[1] | in[1]*vpn[1] | ... - - faddp %st(0),%st(5) // in[1]*vup[1] | in[1]*vpn[1] | ... - faddp %st(0),%st(3) // in[1]*vpn[1] | ... - faddp %st(0),%st(1) // vpn_accum | vup_accum | vright_accum - - flds 8(%eax) // in[2] | ... - fmuls C(vright)+8 // in[2]*vright[2] | ... - flds 8(%eax) // in[2] | in[2]*vright[2] | ... - fmuls C(vup)+8 // in[2]*vup[2] | in[2]*vright[2] | ... - flds 8(%eax) // in[2] | in[2]*vup[2] | in[2]*vright[2] | ... - fmuls C(vpn)+8 // in[2]*vpn[2] | in[2]*vup[2] | in[2]*vright[2] | ... - fxch %st(2) // in[2]*vright[2] | in[2]*vup[2] | in[2]*vpn[2] | ... - - faddp %st(0),%st(5) // in[2]*vup[2] | in[2]*vpn[2] | ... - faddp %st(0),%st(3) // in[2]*vpn[2] | ... - faddp %st(0),%st(1) // vpn_accum | vup_accum | vright_accum - - fstps 8(%edx) // out[2] - fstps 4(%edx) // out[1] - fstps (%edx) // out[0] - - ret - -#endif - -#define EMINS 4+4 -#define EMAXS 4+8 -#define P 4+12 - - .align 2 -.globl C(BoxOnPlaneSide) -C(BoxOnPlaneSide): - pushl %ebx - - movl P(%esp),%edx - movl EMINS(%esp),%ecx - xorl %eax,%eax - movl EMAXS(%esp),%ebx - movb pl_signbits(%edx),%al - cmpb $8,%al - jge Lerror - flds pl_normal(%edx) // p->normal[0] - fld %st(0) // p->normal[0] | p->normal[0] - // bk000422 - warning: missing prefix `*' in absolute indirect address, maybe misassembled! - // bk001129 - fix from Andrew Henderson, was: Ljmptab(,%eax,4) - jmp *Ljmptab(,%eax,4) - - -//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2]; -//dist2= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2]; -Lcase0: - fmuls (%ebx) // p->normal[0]*emaxs[0] | p->normal[0] - flds pl_normal+4(%edx) // p->normal[1] | p->normal[0]*emaxs[0] | - // p->normal[0] - fxch %st(2) // p->normal[0] | p->normal[0]*emaxs[0] | - // p->normal[1] - fmuls (%ecx) // p->normal[0]*emins[0] | - // p->normal[0]*emaxs[0] | p->normal[1] - fxch %st(2) // p->normal[1] | p->normal[0]*emaxs[0] | - // p->normal[0]*emins[0] - fld %st(0) // p->normal[1] | p->normal[1] | - // p->normal[0]*emaxs[0] | - // p->normal[0]*emins[0] - fmuls 4(%ebx) // p->normal[1]*emaxs[1] | p->normal[1] | - // p->normal[0]*emaxs[0] | - // p->normal[0]*emins[0] - flds pl_normal+8(%edx) // p->normal[2] | p->normal[1]*emaxs[1] | - // p->normal[1] | p->normal[0]*emaxs[0] | - // p->normal[0]*emins[0] - fxch %st(2) // p->normal[1] | p->normal[1]*emaxs[1] | - // p->normal[2] | p->normal[0]*emaxs[0] | - // p->normal[0]*emins[0] - fmuls 4(%ecx) // p->normal[1]*emins[1] | - // p->normal[1]*emaxs[1] | - // p->normal[2] | p->normal[0]*emaxs[0] | - // p->normal[0]*emins[0] - fxch %st(2) // p->normal[2] | p->normal[1]*emaxs[1] | - // p->normal[1]*emins[1] | - // p->normal[0]*emaxs[0] | - // p->normal[0]*emins[0] - fld %st(0) // p->normal[2] | p->normal[2] | - // p->normal[1]*emaxs[1] | - // p->normal[1]*emins[1] | - // p->normal[0]*emaxs[0] | - // p->normal[0]*emins[0] - fmuls 8(%ebx) // p->normal[2]*emaxs[2] | - // p->normal[2] | - // p->normal[1]*emaxs[1] | - // p->normal[1]*emins[1] | - // p->normal[0]*emaxs[0] | - // p->normal[0]*emins[0] - fxch %st(5) // p->normal[0]*emins[0] | - // p->normal[2] | - // p->normal[1]*emaxs[1] | - // p->normal[1]*emins[1] | - // p->normal[0]*emaxs[0] | - // p->normal[2]*emaxs[2] - faddp %st(0),%st(3) //p->normal[2] | - // p->normal[1]*emaxs[1] | - // p->normal[1]*emins[1]+p->normal[0]*emins[0]| - // p->normal[0]*emaxs[0] | - // p->normal[2]*emaxs[2] - fmuls 8(%ecx) //p->normal[2]*emins[2] | - // p->normal[1]*emaxs[1] | - // p->normal[1]*emins[1]+p->normal[0]*emins[0]| - // p->normal[0]*emaxs[0] | - // p->normal[2]*emaxs[2] - fxch %st(1) //p->normal[1]*emaxs[1] | - // p->normal[2]*emins[2] | - // p->normal[1]*emins[1]+p->normal[0]*emins[0]| - // p->normal[0]*emaxs[0] | - // p->normal[2]*emaxs[2] - faddp %st(0),%st(3) //p->normal[2]*emins[2] | - // p->normal[1]*emins[1]+p->normal[0]*emins[0]| - // p->normal[0]*emaxs[0]+p->normal[1]*emaxs[1]| - // p->normal[2]*emaxs[2] - fxch %st(3) //p->normal[2]*emaxs[2] + - // p->normal[1]*emins[1]+p->normal[0]*emins[0]| - // p->normal[0]*emaxs[0]+p->normal[1]*emaxs[1]| - // p->normal[2]*emins[2] - faddp %st(0),%st(2) //p->normal[1]*emins[1]+p->normal[0]*emins[0]| - // dist1 | p->normal[2]*emins[2] - - jmp LSetSides - -//dist1= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2]; -//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2]; -Lcase1: - fmuls (%ecx) // emins[0] - flds pl_normal+4(%edx) - fxch %st(2) - fmuls (%ebx) // emaxs[0] - fxch %st(2) - fld %st(0) - fmuls 4(%ebx) // emaxs[1] - flds pl_normal+8(%edx) - fxch %st(2) - fmuls 4(%ecx) // emins[1] - fxch %st(2) - fld %st(0) - fmuls 8(%ebx) // emaxs[2] - fxch %st(5) - faddp %st(0),%st(3) - fmuls 8(%ecx) // emins[2] - fxch %st(1) - faddp %st(0),%st(3) - fxch %st(3) - faddp %st(0),%st(2) - - jmp LSetSides - -//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2]; -//dist2= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2]; -Lcase2: - fmuls (%ebx) // emaxs[0] - flds pl_normal+4(%edx) - fxch %st(2) - fmuls (%ecx) // emins[0] - fxch %st(2) - fld %st(0) - fmuls 4(%ecx) // emins[1] - flds pl_normal+8(%edx) - fxch %st(2) - fmuls 4(%ebx) // emaxs[1] - fxch %st(2) - fld %st(0) - fmuls 8(%ebx) // emaxs[2] - fxch %st(5) - faddp %st(0),%st(3) - fmuls 8(%ecx) // emins[2] - fxch %st(1) - faddp %st(0),%st(3) - fxch %st(3) - faddp %st(0),%st(2) - - jmp LSetSides - -//dist1= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2]; -//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2]; -Lcase3: - fmuls (%ecx) // emins[0] - flds pl_normal+4(%edx) - fxch %st(2) - fmuls (%ebx) // emaxs[0] - fxch %st(2) - fld %st(0) - fmuls 4(%ecx) // emins[1] - flds pl_normal+8(%edx) - fxch %st(2) - fmuls 4(%ebx) // emaxs[1] - fxch %st(2) - fld %st(0) - fmuls 8(%ebx) // emaxs[2] - fxch %st(5) - faddp %st(0),%st(3) - fmuls 8(%ecx) // emins[2] - fxch %st(1) - faddp %st(0),%st(3) - fxch %st(3) - faddp %st(0),%st(2) - - jmp LSetSides - -//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2]; -//dist2= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2]; -Lcase4: - fmuls (%ebx) // emaxs[0] - flds pl_normal+4(%edx) - fxch %st(2) - fmuls (%ecx) // emins[0] - fxch %st(2) - fld %st(0) - fmuls 4(%ebx) // emaxs[1] - flds pl_normal+8(%edx) - fxch %st(2) - fmuls 4(%ecx) // emins[1] - fxch %st(2) - fld %st(0) - fmuls 8(%ecx) // emins[2] - fxch %st(5) - faddp %st(0),%st(3) - fmuls 8(%ebx) // emaxs[2] - fxch %st(1) - faddp %st(0),%st(3) - fxch %st(3) - faddp %st(0),%st(2) - - jmp LSetSides - -//dist1= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2]; -//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2]; -Lcase5: - fmuls (%ecx) // emins[0] - flds pl_normal+4(%edx) - fxch %st(2) - fmuls (%ebx) // emaxs[0] - fxch %st(2) - fld %st(0) - fmuls 4(%ebx) // emaxs[1] - flds pl_normal+8(%edx) - fxch %st(2) - fmuls 4(%ecx) // emins[1] - fxch %st(2) - fld %st(0) - fmuls 8(%ecx) // emins[2] - fxch %st(5) - faddp %st(0),%st(3) - fmuls 8(%ebx) // emaxs[2] - fxch %st(1) - faddp %st(0),%st(3) - fxch %st(3) - faddp %st(0),%st(2) - - jmp LSetSides - -//dist1= p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2]; -//dist2= p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2]; -Lcase6: - fmuls (%ebx) // emaxs[0] - flds pl_normal+4(%edx) - fxch %st(2) - fmuls (%ecx) // emins[0] - fxch %st(2) - fld %st(0) - fmuls 4(%ecx) // emins[1] - flds pl_normal+8(%edx) - fxch %st(2) - fmuls 4(%ebx) // emaxs[1] - fxch %st(2) - fld %st(0) - fmuls 8(%ecx) // emins[2] - fxch %st(5) - faddp %st(0),%st(3) - fmuls 8(%ebx) // emaxs[2] - fxch %st(1) - faddp %st(0),%st(3) - fxch %st(3) - faddp %st(0),%st(2) - - jmp LSetSides - -//dist1= p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2]; -//dist2= p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2]; -Lcase7: - fmuls (%ecx) // emins[0] - flds pl_normal+4(%edx) - fxch %st(2) - fmuls (%ebx) // emaxs[0] - fxch %st(2) - fld %st(0) - fmuls 4(%ecx) // emins[1] - flds pl_normal+8(%edx) - fxch %st(2) - fmuls 4(%ebx) // emaxs[1] - fxch %st(2) - fld %st(0) - fmuls 8(%ecx) // emins[2] - fxch %st(5) - faddp %st(0),%st(3) - fmuls 8(%ebx) // emaxs[2] - fxch %st(1) - faddp %st(0),%st(3) - fxch %st(3) - faddp %st(0),%st(2) - -LSetSides: - -// sides = 0; -// if (dist1 >= p->dist) -// sides = 1; -// if (dist2 < p->dist) -// sides |= 2; - - faddp %st(0),%st(2) // dist1 | dist2 - fcomps pl_dist(%edx) - xorl %ecx,%ecx - fnstsw %ax - fcomps pl_dist(%edx) - andb $1,%ah - xorb $1,%ah - addb %ah,%cl - - fnstsw %ax - andb $1,%ah - addb %ah,%ah - addb %ah,%cl - -// return sides; - - popl %ebx - movl %ecx,%eax // return status - - ret - - -Lerror: - movl 1, %eax - ret - -#endif // id386 diff --git a/src/asm/qasm.h b/src/asm/qasm.h deleted file mode 100644 index 00dbf1cc3..000000000 --- a/src/asm/qasm.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Wolfenstein: Enemy Territory GPL Source Code - * Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company. - * - * ET: Legacy - * Copyright (C) 2012 Jan Simek - * - * This file is part of ET: Legacy - http://www.etlegacy.com - * - * ET: Legacy is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ET: Legacy 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 ET: Legacy. If not, see . - * - * In addition, Wolfenstein: Enemy Territory GPL Source Code is also - * subject to certain additional terms. You should have received a copy - * of these additional terms immediately following the terms and conditions - * of the GNU General Public License which accompanied the source code. - * If not, please request a copy in writing from id Software at the address below. - * - * id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - * - * @file qasm.h - */ - -#ifndef __ASM_I386__ -#define __ASM_I386__ - -#include "../qcommon/q_platform.h" - -#ifdef __ELF__ -.section .note.GNU-stack,"",@progbits -#endif - -#ifdef __ELF__ -#define C(label) label -#else -#define C(label) _##label -#endif - -// plane_t structure -// !!! if this is changed, it must be changed in model.h too !!! -// !!! if the size of this is changed, the array lookup in SV_HullPointContents -// must be changed too !!! -#define pl_normal 0 -#define pl_dist 12 -#define pl_type 16 -#define pl_signbits 17 -#define pl_pad 18 -#define pl_size 20 - -#endif diff --git a/src/asm/snapvector.asm b/src/asm/snapvector.asm deleted file mode 100644 index 357732c08..000000000 --- a/src/asm/snapvector.asm +++ /dev/null @@ -1,75 +0,0 @@ -; -; Sys_SnapVector NASM code (Andrew Henderson) -; See win32/win_shared.c for the Win32 equivalent -; This code is provided to ensure that the -; rounding behavior (and, if necessary, the -; precision) of DLL and QVM code are identical -; e.g. for network-visible operations. -; See ftol.nasm for operations on a single float, -; as used in compiled VM and DLL code that does -; not use this system trap. -; - - -segment .data - -fpucw dd 0 -cw037F dd 0x037F ; Rounding to nearest (even). - -segment .text - -; void Sys_SnapVector( float *v ) -global Sys_SnapVector -Sys_SnapVector: - push eax - push ebp - mov ebp, esp - - fnstcw [fpucw] - mov eax, dword [ebp + 12] - fldcw [cw037F] - fld dword [eax] - fistp dword [eax] - fild dword [eax] - fstp dword [eax] - fld dword [eax + 4] - fistp dword [eax + 4] - fild dword [eax + 4] - fstp dword [eax + 4] - fld dword [eax + 8] - fistp dword [eax + 8] - fild dword [eax + 8] - fstp dword [eax + 8] - fldcw [fpucw] - - pop ebp - pop eax - ret - -; void Sys_SnapVectorCW( float *v, unsigned short int cw ) -global Sys_SnapVectorCW -Sys_SnapVector_cw: - push eax - push ebp - mov ebp, esp - - fnstcw [fpucw] - mov eax, dword [ebp + 12] - fldcw [ebp + 16] - fld dword [eax] - fistp dword [eax] - fild dword [eax] - fstp dword [eax] - fld dword [eax + 4] - fistp dword [eax + 4] - fild dword [eax + 4] - fstp dword [eax + 4] - fld dword [eax + 8] - fistp dword [eax + 8] - fild dword [eax + 8] - fstp dword [eax + 8] - fldcw [fpucw] - - pop ebp - pop eax - ret \ No newline at end of file diff --git a/src/asm/snapvectora.s b/src/asm/snapvectora.s deleted file mode 100644 index 3258db58b..000000000 --- a/src/asm/snapvectora.s +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Wolfenstein: Enemy Territory GPL Source Code - * Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company. - * - * ET: Legacy - * Copyright (C) 2012 Jan Simek - * - * This file is part of ET: Legacy. - * - * ET: Legacy is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ET: Legacy 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 ET: Legacy. If not, see . - * - * In addition, Wolfenstein: Enemy Territory GPL Source Code is also - * subject to certain additional terms. You should have received a copy - * of these additional terms immediately following the terms and conditions - * of the GNU General Public License which accompanied the source code. - * If not, please request a copy in writing from id Software at the address below. - * - * id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - * - * @file snapvectora.s - */ - - -// -// Sys_SnapVector NASM code (Andrew Henderson) -// See win32/win_shared.c for the Win32 equivalent -// This code is provided to ensure that the -// rounding behavior (and, if necessary, the -// precision) of DLL and QVM code are identical -// e.g. for network-visible operations. -// See ftol.nasm for operations on a single float, -// as used in compiled VM and DLL code that does -// not use this system trap. -// - -// 23/09/05 Ported to gas by intel2gas, best supporting actor Tim Angus -// - -#include "qasm.h" - -#if id386 -.data - -fpucw: .long 0 -cw037F: .long 0x037F - -.text - -// void Sys_SnapVector( float *v ) -.globl C(Sys_SnapVector) -C(Sys_SnapVector): - pushl %eax - pushl %ebp - movl %esp,%ebp - - fnstcw fpucw - movl 12(%ebp),%eax - fldcw cw037F - flds (%eax) - fistpl (%eax) - fildl (%eax) - fstps (%eax) - flds 4(%eax) - fistpl 4(%eax) - fildl 4(%eax) - fstps 4(%eax) - flds 8(%eax) - fistpl 8(%eax) - fildl 8(%eax) - fstps 8(%eax) - fldcw fpucw - - popl %ebp - popl %eax - ret - -// void Sys_SnapVectorCW( float *v, unsigned short int cw ) -.globl C(Sys_SnapVectorCW) -C(Sys_SnapVectorCW): - pushl %eax - pushl %ebp - movl %esp,%ebp - - fnstcw fpucw - movl 12(%ebp),%eax - fldcw 16(%ebp) - flds (%eax) - fistpl (%eax) - fildl (%eax) - fstps (%eax) - flds 4(%eax) - fistpl 4(%eax) - fildl 4(%eax) - fstps 4(%eax) - flds 8(%eax) - fistpl 8(%eax) - fildl 8(%eax) - fstps 8(%eax) - fldcw fpucw - - popl %ebp - popl %eax - ret -#endif diff --git a/src/asm/snd_mixa.s b/src/asm/snd_mixa.s deleted file mode 100644 index 6a17a208b..000000000 --- a/src/asm/snd_mixa.s +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Wolfenstein: Enemy Territory GPL Source Code - * Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company. - * - * ET: Legacy - * Copyright (C) 2012 Jan Simek - * - * This file is part of ET: Legacy. - * - * ET: Legacy is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ET: Legacy 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 ET: Legacy. If not, see . - * - * In addition, Wolfenstein: Enemy Territory GPL Source Code is also - * subject to certain additional terms. You should have received a copy - * of these additional terms immediately following the terms and conditions - * of the GNU General Public License which accompanied the source code. - * If not, please request a copy in writing from id Software at the address below. - * - * id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. - * - * @file snd_mixa.s - * @brief x86 assembly-language sound code - */ - -#include "qasm.h" - -#if id386 - - .text - -#if 0 -//---------------------------------------------------------------------- -// 8-bit sound-mixing code -//---------------------------------------------------------------------- - -#define ch 4+16 -#define sc 8+16 -#define count 12+16 - -.globl C(S_PaintChannelFrom8) -C(S_PaintChannelFrom8): - pushl %esi // preserve register variables - pushl %edi - pushl %ebx - pushl %ebp - -// int data; -// short *lscale, *rscale; -// unsigned char *sfx; -// int i; - - movl ch(%esp),%ebx - movl sc(%esp),%esi - -// if (ch->leftvol > 255) -// ch->leftvol = 255; -// if (ch->rightvol > 255) -// ch->rightvol = 255; - movl ch_leftvol(%ebx),%eax - movl ch_rightvol(%ebx),%edx - cmpl $255,%eax - jna LLeftSet - movl $255,%eax -LLeftSet: - cmpl $255,%edx - jna LRightSet - movl $255,%edx -LRightSet: - -// lscale = snd_scaletable[ch->leftvol >> 3]; -// rscale = snd_scaletable[ch->rightvol >> 3]; -// sfx = (signed char *)sc->data + ch->pos; -// ch->pos += count; - andl $0xF8,%eax - addl $20,%esi - movl (%esi),%esi - andl $0xF8,%edx - movl ch_pos(%ebx),%edi - movl count(%esp),%ecx - addl %edi,%esi - shll $7,%eax - addl %ecx,%edi - shll $7,%edx - movl %edi,ch_pos(%ebx) - addl $(C(snd_scaletable)),%eax - addl $(C(snd_scaletable)),%edx - subl %ebx,%ebx - movb -1(%esi,%ecx,1),%bl - - testl $1,%ecx - jz LMix8Loop - - movl (%eax,%ebx,4),%edi - movl (%edx,%ebx,4),%ebp - addl C(paintbuffer)+psp_left-psp_size(,%ecx,psp_size),%edi - addl C(paintbuffer)+psp_right-psp_size(,%ecx,psp_size),%ebp - movl %edi,C(paintbuffer)+psp_left-psp_size(,%ecx,psp_size) - movl %ebp,C(paintbuffer)+psp_right-psp_size(,%ecx,psp_size) - movb -2(%esi,%ecx,1),%bl - - decl %ecx - jz LDone - -// for (i=0 ; i>8; -// if (val > 0x7fff) -// snd_out[i] = 0x7fff; -// else if (val < (short)0x8000) -// snd_out[i] = (short)0x8000; -// else -// snd_out[i] = val; - movl -8(%ebx,%ecx,4),%eax - sarl $8,%eax - cmpl $0x7FFF,%eax - jg LClampHigh - cmpl $0xFFFF8000,%eax - jnl LClampDone - movl $0xFFFF8000,%eax - jmp LClampDone -LClampHigh: - movl $0x7FFF,%eax -LClampDone: - -// val = (snd_p[i+1]*snd_vol)>>8; -// if (val > 0x7fff) -// snd_out[i+1] = 0x7fff; -// else if (val < (short)0x8000) -// snd_out[i+1] = (short)0x8000; -// else -// snd_out[i+1] = val; - movl -4(%ebx,%ecx,4),%edx - sarl $8,%edx - cmpl $0x7FFF,%edx - jg LClampHigh2 - cmpl $0xFFFF8000,%edx - jnl LClampDone2 - movl $0xFFFF8000,%edx - jmp LClampDone2 -LClampHigh2: - movl $0x7FFF,%edx -LClampDone2: - shll $16,%edx - andl $0xFFFF,%eax - orl %eax,%edx - movl %edx,-4(%edi,%ecx,2) - -// } - subl $2,%ecx - jnz LWLBLoopTop - -// snd_p += snd_linear_count; - - popl %ebx - popl %edi - - ret - -#endif // id386 - diff --git a/src/asm/snd_mixa.spp b/src/asm/snd_mixa.spp deleted file mode 100644 index 1bd516c7c..000000000 --- a/src/asm/snd_mixa.spp +++ /dev/null @@ -1,197 +0,0 @@ -// -// snd_mixa.s -// x86 assembly-language sound code -// - -#include "qasm.h" - -#if id386 - - .text - -#if 0 -//---------------------------------------------------------------------- -// 8-bit sound-mixing code -//---------------------------------------------------------------------- - -#define ch 4+16 -#define sc 8+16 -#define count 12+16 - -.globl C(S_PaintChannelFrom8) -C(S_PaintChannelFrom8): - pushl %esi // preserve register variables - pushl %edi - pushl %ebx - pushl %ebp - -// int data; -// short *lscale, *rscale; -// unsigned char *sfx; -// int i; - - movl ch(%esp),%ebx - movl sc(%esp),%esi - -// if (ch->leftvol > 255) -// ch->leftvol = 255; -// if (ch->rightvol > 255) -// ch->rightvol = 255; - movl ch_leftvol(%ebx),%eax - movl ch_rightvol(%ebx),%edx - cmpl $255,%eax - jna LLeftSet - movl $255,%eax -LLeftSet: - cmpl $255,%edx - jna LRightSet - movl $255,%edx -LRightSet: - -// lscale = snd_scaletable[ch->leftvol >> 3]; -// rscale = snd_scaletable[ch->rightvol >> 3]; -// sfx = (signed char *)sc->data + ch->pos; -// ch->pos += count; - andl $0xF8,%eax - addl $20,%esi - movl (%esi),%esi - andl $0xF8,%edx - movl ch_pos(%ebx),%edi - movl count(%esp),%ecx - addl %edi,%esi - shll $7,%eax - addl %ecx,%edi - shll $7,%edx - movl %edi,ch_pos(%ebx) - addl $(C(snd_scaletable)),%eax - addl $(C(snd_scaletable)),%edx - subl %ebx,%ebx - movb -1(%esi,%ecx,1),%bl - - testl $1,%ecx - jz LMix8Loop - - movl (%eax,%ebx,4),%edi - movl (%edx,%ebx,4),%ebp - addl C(paintbuffer)+psp_left-psp_size(,%ecx,psp_size),%edi - addl C(paintbuffer)+psp_right-psp_size(,%ecx,psp_size),%ebp - movl %edi,C(paintbuffer)+psp_left-psp_size(,%ecx,psp_size) - movl %ebp,C(paintbuffer)+psp_right-psp_size(,%ecx,psp_size) - movb -2(%esi,%ecx,1),%bl - - decl %ecx - jz LDone - -// for (i=0 ; i>8; -// if (val > 0x7fff) -// snd_out[i] = 0x7fff; -// else if (val < (short)0x8000) -// snd_out[i] = (short)0x8000; -// else -// snd_out[i] = val; - movl -8(%ebx,%ecx,4),%eax - sarl $8,%eax - cmpl $0x7FFF,%eax - jg LClampHigh - cmpl $0xFFFF8000,%eax - jnl LClampDone - movl $0xFFFF8000,%eax - jmp LClampDone -LClampHigh: - movl $0x7FFF,%eax -LClampDone: - -// val = (snd_p[i+1]*snd_vol)>>8; -// if (val > 0x7fff) -// snd_out[i+1] = 0x7fff; -// else if (val < (short)0x8000) -// snd_out[i+1] = (short)0x8000; -// else -// snd_out[i+1] = val; - movl -4(%ebx,%ecx,4),%edx - sarl $8,%edx - cmpl $0x7FFF,%edx - jg LClampHigh2 - cmpl $0xFFFF8000,%edx - jnl LClampDone2 - movl $0xFFFF8000,%edx - jmp LClampDone2 -LClampHigh2: - movl $0x7FFF,%edx -LClampDone2: - shll $16,%edx - andl $0xFFFF,%eax - orl %eax,%edx - movl %edx,-4(%edi,%ecx,2) - -// } - subl $2,%ecx - jnz LWLBLoopTop - -// snd_p += snd_linear_count; - - popl %ebx - popl %edi - - ret - - -#endif // id386 -