misc changes

This commit is contained in:
Steven Fuller 2002-09-07 00:26:23 +00:00 committed by Patryk Obara
parent e681d155d9
commit 553fa56442
9 changed files with 86 additions and 100 deletions

View file

@ -9,15 +9,12 @@ CFLAGS = -g -Wall -pipe -O2
#CFLAGS = -DNDEBUG -Wall -pipe -O6 -ffast-math -fomit-frame-pointer -march=pentiumpro -mcpu=pentiumpro
CFLAGS += -Dengine=1 -I. -Iinclude -Iwin95 -Iavp -Iavp/win95 -Iavp/support -Iavp/win95/frontend -Iavp/win95/gadgets
CFLAGS += $(shell sdl-config --cflags)
CXXFLAGS = $(CFLAGS)
CFLAGS += $(shell sdl-config --cflags)
LDLIBS = $(shell sdl-config --libs) -lGL -lopenal
# Debian SDL+NVIDIA workaround (change /usr/lib to the real location of the files)
#LDLIBS = -L/usr/X11R6/lib -lX11 -lXext /usr/lib/libGL.so.1 $(shell sdl-config --libs) -lopenal -lm
# required for gcc-3.0
# required for gcc-3
#LDLIBS += -lstdc++
AFLAGS = -g -w+macro-params -w+orphan-labels -w+number-overflow
@ -61,7 +58,7 @@ OBJ = $(ROOTOBJ) $(AVPOBJ) $(SHAPESOBJ) $(SUPPORTOBJ) $(AVPWIN95OBJ) $(FRONTENDO
all: AvP
AvP: depend $(OBJ)
AvP: $(OBJ) # depend $(OBJ)
$(CC) -o AvP $(OBJ) $(LDLIBS)
compile: $(OBJ)
@ -69,9 +66,6 @@ compile: $(OBJ)
.asm.o:
$(NASM) $(AFLAGS) -f elf -o $@ $<
tester:
echo $(OBJ)
clean:
-rm -rf depend depend.bak $(OBJ) AvP
@ -81,14 +75,14 @@ distclean: clean
# I wish I knew how to do dependencies correctly...
#depend: Makefile $(SRC)
# $(CC) $(CFLAGS) -MM $(SRC) > depend
# $(CC) $(CFLAGS) -MM $(SRC) > depend.out
#
# insert makefile dependencies here
# -include depend
depend: Makefile # $(SRC)
touch depend
makedepend -fdepend -- $(CFLAGS) -- $(SRC)
-include depend
#
#depend: Makefile # $(SRC)
# touch depend.out
# makedepend -fdepend.out -- $(CFLAGS) -- $(SRC)
#
#-include depend.out
# DO NOT DELETE THIS LINE -- make depend depends on it.

View file

@ -19,7 +19,6 @@
#include "showcmds.h"
#include "avp_userprofile.h"
#include "cdplayer.h"
#include "openal.h"
/* Patrick 5/6/97 -------------------------------------------------------------
Internal globals

View file

@ -209,7 +209,7 @@ extern ACTIVESOUNDSAMPLE ActiveSounds[];
extern SOUNDSAMPLEDATA BlankGameSound;
extern ACTIVESOUNDSAMPLE BlankActiveSound;
void UpdateSoundFrequencies(void);
#ifdef __cplusplus
}

View file

@ -75,7 +75,12 @@ typedef struct RECT
typedef RECT RECT_AVP;
#if !defined(__INTEL_COMPILER)
typedef int64_t __int64;
#else
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#endif
typedef time_t FILETIME;

View file

@ -41,16 +41,16 @@ void ADD_LL(LONGLONGCH *a, LONGLONGCH *b, LONGLONGCH *c)
mov [ebx+4],edx
}
*/
__asm__("movl 0(%%esi), %%eax \n\t"
"movl 4(%%esi), %%edx \n\t"
"addl 0(%%edi), %%eax \n\t"
"adcl 4(%%edi), %%edx \n\t"
"movl %%eax, 0(%%ebx) \n\t"
"movl %%edx, 4(%%ebx) \n\t"
:
int dummy1, dummy2;
__asm__("movl 0(%%esi), %0 \n\t"
"movl 4(%%esi), %1 \n\t"
"addl 0(%%edi), %0 \n\t"
"adcl 4(%%edi), %1 \n\t"
"movl %0, 0(%%ebx) \n\t"
"movl %1, 4(%%ebx) \n\t"
: "=&r" (dummy1), "=&r" (dummy2)
: "S" (a), "D" (b), "b" (c)
: "%eax", "%edx", "memory", "cc"
: "memory", "cc"
);
/*
@ -74,18 +74,19 @@ void ADD_LL_PP(LONGLONGCH *c, LONGLONGCH *a)
mov edi,c
mov esi,a
mov eax,[esi]
mov edx,[esi+4]
mov edx,[esi+4]
add [edi],eax
adc [edi+4],edx
}
*/
__asm__("movl 0(%%esi), %%eax \n\t"
"movl 4(%%esi), %%edx \n\t"
"addl %%eax, 0(%%edi) \n\t"
"adcl %%edx, 4(%%edi) \n\t"
:
int dummy1, dummy2;
__asm__("movl 0(%%esi), %0 \n\t"
"movl 4(%%esi), %1 \n\t"
"addl %0, 0(%%edi) \n\t"
"adcl %1, 4(%%edi) \n\t"
: "=&r" (dummy1), "=&r" (dummy2)
: "D" (c), "S" (a)
: "%eax", "%edx", "memory", "cc"
: "memory", "cc"
);
}
@ -107,15 +108,16 @@ void SUB_LL(LONGLONGCH *a, LONGLONGCH *b, LONGLONGCH *c)
mov [ebx+4],edx
}
*/
__asm__("movl 0(%%esi), %%eax \n\t"
"movl 4(%%esi), %%edx \n\t"
"subl 0(%%edi), %%eax \n\t"
"sbbl 4(%%edi), %%edx \n\t"
"movl %%eax, 0(%%ebx) \n\t"
"movl %%edx, 4(%%ebx) \n\t"
:
int dummy1, dummy2;
__asm__("movl 0(%%esi), %0 \n\t"
"movl 4(%%esi), %1 \n\t"
"subl 0(%%edi), %0 \n\t"
"sbbl 4(%%edi), %1 \n\t"
"movl %0, 0(%%ebx) \n\t"
"movl %1, 4(%%ebx) \n\t"
: "=&r" (dummy1), "=&r" (dummy2)
: "S" (a), "D" (b), "b" (c)
: "%eax", "%edx", "memory", "cc"
: "memory", "cc"
);
}
@ -134,13 +136,14 @@ void SUB_LL_MM(LONGLONGCH *c, LONGLONGCH *a)
sbb [edi+4],edx
}
*/
__asm__("movl 0(%%esi), %%eax \n\t"
"movl 4(%%esi), %%edx \n\t"
"subl %%eax, 0(%%edi) \n\t"
"sbbl %%edx, 4(%%edi) \n\t"
:
int dummy1, dummy2;
__asm__("movl 0(%%esi), %0 \n\t"
"movl 4(%%esi), %1 \n\t"
"subl %0, 0(%%edi) \n\t"
"sbbl %1, 4(%%edi) \n\t"
: "=&r" (dummy1), "=&r" (dummy2)
: "D" (c), "S" (a)
: "%eax", "%edx", "memory", "cc"
: "memory", "cc"
);
}
@ -164,12 +167,13 @@ void MUL_I_WIDE(int a, int b, LONGLONGCH *c)
mov [ebx+4],edx
}
*/
__asm__("imull %%edx \n\t"
unsigned int d1;
__asm__("imull %3 \n\t"
"movl %%eax, 0(%%ebx) \n\t"
"movl %%edx, 4(%%ebx) \n\t"
:
: "a" (a), "b" (c), "d" (b)
: "memory", "cc"
: "=a" (d1)
: "0" (a), "b" (c), "m" (b)
: "%edx", "memory", "cc"
);
}
@ -315,15 +319,17 @@ void ASR_LL(LONGLONGCH *a, int shift)
asrdn:
}
*/
__asm__("andl %%eax, %%eax \n\t"
unsigned int d1;
__asm__ volatile
("andl %0, %0 \n\t"
"jle 0 \n" /* asrdn */
"1: \n\t" /* asrlp */
"sarl $1, 4(%%esi) \n\t"
"rcrl $1, 0(%%esi) \n\t"
"decl %%eax \n\t"
"decl %0 \n\t"
"jne 1 \n"
"0: \n\t"
:
: "=&r" (d1)
: "S" (a), "a" (shift)
: "memory", "cc"
);
@ -349,11 +355,10 @@ __asm__("movl 0(%%esi), %%eax \n\t"
"cdq \n\t"
"movl %%eax, 0(%%edi) \n\t"
"movl %%edx, 4(%%edi) \n\t"
:
:
: "S" (b), "D" (a)
: "%eax", "%edx", "memory", "cc"
);
}
/*
@ -394,11 +399,11 @@ int MUL_FIXED(int a, int b)
mov retval,eax
}
*/
__asm__("imull %%edx \n\t"
__asm__("imull %2 \n\t"
"shrdl $16, %%edx, %%eax \n\t"
: "=a" (retval)
: "a" (a), "d" (b)
: "cc"
: "0" (a), "m" (b)
: "%edx", "cc"
);
return retval;
}
@ -412,6 +417,8 @@ __asm__("imull %%edx \n\t"
int DIV_FIXED(int a, int b)
{
int retval;
if (b == 0) printf("DEBUG THIS: a = %d, b = %d\n", a, b);
if (b == 0) return 0; /* TODO: debug this! (start with alien on ferarco) */
/*
@ -430,9 +437,9 @@ __asm__("cdq \n\t"
"roll $16, %%eax \n\t"
"mov %%ax, %%dx \n\t"
"xor %%ax, %%ax \n\t"
"idivl %%ebx \n\t"
"idivl %2 \n\t"
: "=a" (retval)
: "a" (a), "b" (b)
: "0" (a), "m" (b)
: "%edx", "cc"
);
return retval;
@ -476,9 +483,9 @@ int NarrowDivide(LONGLONGCH *a, int b)
*/
__asm__("movl 0(%%esi), %%eax \n\t"
"movl 4(%%esi), %%edx \n\t"
"idivl %%ebx \n\t"
"idivl %2 \n\t"
: "=a" (retval)
: "S" (a), "b" (b)
: "S" (a), "m" (b)
: "%edx", "cc"
);
return retval;
@ -504,10 +511,10 @@ int WideMulNarrowDiv(int a, int b, int c)
mov retval,eax
}
*/
__asm__("imull %%ebx \n\t"
"idivl %%ecx \n\t"
__asm__("imull %2 \n\t"
"idivl %3 \n\t"
: "=a" (retval)
: "a" (a), "b" (b), "c" (c)
: "0" (a), "m" (b), "m" (c)
: "%edx", "cc"
);
return retval;
@ -567,13 +574,10 @@ typedef struct matrixch {
*/
extern int sqrt_temp1;
extern int sqrt_temp2;
extern volatile int sqrt_temp;
int SqRoot32(int A)
{
#if 1
sqrt_temp1 = A;
/*
_asm
{
@ -585,28 +589,19 @@ int SqRoot32(int A)
}
*/
__asm__("finit \n\t"
"fildl sqrt_temp1 \n\t"
__asm__ volatile
("finit \n\t"
"fildl %0 \n\t"
"fsqrt \n\t"
"fistpl sqrt_temp2 \n\t"
"fistpl sqrt_temp \n\t"
"fwait \n\t"
:
:
: "m" (A)
: "memory", "cc"
);
return sqrt_temp2;
#else
{ /* TODO: clean this please */
double x = A;
double retvald = sqrt(x);
int retval = retvald;
return retval;
return sqrt_temp;
}
#endif
}
/*
@ -615,13 +610,14 @@ __asm__("finit \n\t"
*/
extern float fti_fptmp;
extern int fti_itmp;
extern volatile float fti_fptmp;
extern volatile int fti_itmp;
void FloatToInt()
{
#if 1
__asm__("fld fti_fptmp \n\t"
__asm__ volatile
("flds fti_fptmp \n\t"
"fistpl fti_itmp \n\t"
:
:

View file

@ -21,7 +21,6 @@
#include "dynamics.h"
#include "dynblock.h"
#include "stratdef.h"
#include "openal.h"
ACTIVESOUNDSAMPLE ActiveSounds[SOUND_MAXACTIVE];
ACTIVESOUNDSAMPLE BlankActiveSound = {SID_NOSOUND,ASP_Minimum,0,0,NULL,0,0,0,0,0, { {0,0,0},{0,0,0},0,0 }, 0, 0, { 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0 }, NULL, NULL, NULL};

View file

@ -1,6 +0,0 @@
#ifndef OPENAL_AVP_H
#define OPENAL_AVP_H
void UpdateSoundFrequencies();
#endif

View file

@ -129,7 +129,7 @@ Chunk_With_BMPs::Chunk_With_BMPs (Chunk_With_Children * parent, const char * con
bdata += 4;
for (int i=0; i<num; i++)
for (int j=0; j<num; j++)
{
int f,i,d1,d2,d3;

View file

@ -18,8 +18,7 @@
#endif
/* globals from inline.h */
int sqrt_temp1;
int sqrt_temp2;
int sqrt_temp;
float fti_fptmp;
int fti_itmp;