Compiling Quake source without MASM
Yo Yo,
I just fixed up the GLQuake source to compile without MASM. There''s only about 10 assembly functions for the GL version and the source includes C versions of them.
If anyone wants some pointers, I''ll post them.
And sorry, I don''t have time to get a kosher GPL release ready so I can''t post the source. It''s not a big deal anyway.
-the logistical one-http://members.bellatlantic.net/~olsongt
January 03, 2000 09:04 PM
i just downloaded it and ive been trying to get it to compile w/o luck.
howd you do it?
howd you do it?
The writeup was taking awhile so I did it offline. I just downloaded the quake demo (didn't have a PC when it came out) and confirmed that the executable worked. I was actually glad to see how LITTLE assembly is used in the GL version. Here you go:
COMPILING GL QUAKE WITHOUT AN ASSEMBLER
---------------------------------------
Set the active configuration to GLQuake (Relase or Debug). If you try and build it now you get linker errors since the Assembly files didn't compile. Delete all of the assembly source files from the project space. They're the source files that end it .s. You'll probably see a similar C file above them.
world.c - the c version
worlda.s - the Windows assembly version
The preprocessor define id386 determines whether or not the assembly routines can be used. Unfortunately, it's also used for some other intel specific stuff, so you can't just undefine it.
These four functions defualt to assembly:
int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, mplane_t *p) // in mathlib.c
void Snd_WriteLinearBlastStereo16 (void) // in snd_mix.c
void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count) //in snd_mix.c
int SV_HullPointContents (hull_t *hull, int num, vec3_t p) // in world.c
If you go to the .c file indicated, you can find these functions. You will see that they're wrapped by the preprocessor directive -
#if !id386
... function
#endif
The hack solution would be to just delete the #if statments, but then a compiler with MASM couldn't take advantage of this. A better solution is to change the line to:
#if !id386 // NO_ASM
and then define NO_ASM as a preprocessor directive in MSVC. That way you can just undefine it and have the assembly routines compile.
We're almost there. The file sys_win.c does things a little differently. Each OS has one of these files, sys_dos.c, sys_sun.c, etc. to handle some system specific function calls. This block is in sys_win.c:
#ifndef _M_IX86
void Sys_SetFPCW (void)
{
}
void Sys_PushFPCW_SetHigh (void)
{
}
void Sys_PopFPCW (void)
{
}
void MaskExceptions (void)
{
}
#endif
and prevents these functions from being defined. Once again, you can just take the hack approach and delete the #ifndef and #endif statements, or you can copy the whole block, paste it gain, and change the line to:
#if id386 && NO_ASM
To get it to work when you're in 386 mode and have the NO_ASM flag set. Note that this creates Null functions. I haven't got the chance yet to see what this does in the big picture. If it
causes problems I'll just write those functions from scratch.
Once you've made all the changes you should be able to compile without MASM.
Have fun,
logistix
logstx@bellatlantic.net
---------------------------------------------------------
Let me know if it makes sense.
Edited by - logistix on 1/3/00 9:25:41 PM
COMPILING GL QUAKE WITHOUT AN ASSEMBLER
---------------------------------------
Set the active configuration to GLQuake (Relase or Debug). If you try and build it now you get linker errors since the Assembly files didn't compile. Delete all of the assembly source files from the project space. They're the source files that end it .s. You'll probably see a similar C file above them.
world.c - the c version
worlda.s - the Windows assembly version
The preprocessor define id386 determines whether or not the assembly routines can be used. Unfortunately, it's also used for some other intel specific stuff, so you can't just undefine it.
These four functions defualt to assembly:
int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, mplane_t *p) // in mathlib.c
void Snd_WriteLinearBlastStereo16 (void) // in snd_mix.c
void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count) //in snd_mix.c
int SV_HullPointContents (hull_t *hull, int num, vec3_t p) // in world.c
If you go to the .c file indicated, you can find these functions. You will see that they're wrapped by the preprocessor directive -
#if !id386
... function
#endif
The hack solution would be to just delete the #if statments, but then a compiler with MASM couldn't take advantage of this. A better solution is to change the line to:
#if !id386 // NO_ASM
and then define NO_ASM as a preprocessor directive in MSVC. That way you can just undefine it and have the assembly routines compile.
We're almost there. The file sys_win.c does things a little differently. Each OS has one of these files, sys_dos.c, sys_sun.c, etc. to handle some system specific function calls. This block is in sys_win.c:
#ifndef _M_IX86
void Sys_SetFPCW (void)
{
}
void Sys_PushFPCW_SetHigh (void)
{
}
void Sys_PopFPCW (void)
{
}
void MaskExceptions (void)
{
}
#endif
and prevents these functions from being defined. Once again, you can just take the hack approach and delete the #ifndef and #endif statements, or you can copy the whole block, paste it gain, and change the line to:
#if id386 && NO_ASM
To get it to work when you're in 386 mode and have the NO_ASM flag set. Note that this creates Null functions. I haven't got the chance yet to see what this does in the big picture. If it
causes problems I'll just write those functions from scratch.
Once you've made all the changes you should be able to compile without MASM.
Have fun,
logistix
logstx@bellatlantic.net
---------------------------------------------------------
Let me know if it makes sense.
Edited by - logistix on 1/3/00 9:25:41 PM
-the logistical one-http://members.bellatlantic.net/~olsongt
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement