builds without asm optimizations (USE_X86=1)

This commit is contained in:
koolsmoky
2004-12-23 20:56:25 +00:00
parent f952be1383
commit 6d9fbdee4a
7 changed files with 2089 additions and 1044 deletions

View File

@@ -0,0 +1,349 @@
# Win32 makefile for Glide2/SST1 and Texus2
# This makefile MUST be processed by GNU make!!!
#
# Copyright (c) 2004
#
# Daniel Borca
# Email : dborca@users.sourceforge.net
# Web : http://www.geocities.com/dborca
#
# Hiroshi Morii
# Email : koolsmoky@users.sourceforge.net
# Web : http://www.3dfxzone.it/koolsmoky
#
#
# Available options:
#
# Environment variables:
# FX_GLIDE_HW build for the given ASIC (sst1, sst96).
# default = sst1
# CPU optimize for the given processor.
# default = 6 (PentiumPro)
# DEBUG=1 disable optimizations and build for debug.
# default = no
# USE_X86=1 use assembler triangle specializations!
# default = no
# TEXUS2=1 embed Texus2 functions into Glide3.
# default = no
# FXOEM2X=1 build fxoem2x.dll
# default = no
#
# Targets:
# all: build everything
# glide2x: build Glide2x lib
# clean: remove object files
# realclean: remove all generated files
#
.PHONY: all glide2x clean realclean
.INTERMEDIATE: fxgasm.exe
.SUFFIXES: .c .obj .rc .res
###############################################################################
# general defines (user settable?)
###############################################################################
GLIDE_RES = glide.res
GLIDE_DLL = glide2x.dll
GLIDE_IMP = glide2x.lib
TEXUS_EXE = texus2.exe
FX_GLIDE_HW ?= sst1
FX_GLIDE_SW = ../../../swlibs
GLIDE_LIBDIR = ../../lib
TEXUS_EXEDIR = $(FX_GLIDE_SW)/bin
###############################################################################
# tools
###############################################################################
CC = cl
AS = nasm
LD = link
RC = rc
ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
UNLINK = del $(subst /,\,$(1))
else
UNLINK = $(RM) $(1)
endif
###############################################################################
# defines
###############################################################################
# platform
CDEFS = -D__WIN32__ -DDIRECTX -DFX_DLL_ENABLE -DINIT_ACCESS_DDRAW
# general
CDEFS += -DGLIDE_HARDWARE -DGLIDE_DEFAULT_GAMMA=1.3f -DGLIDE_LIB=1
# subsystem
ifeq ($(FX_GLIDE_HW),sst1)
CDEFS += -DSST1
else
ifeq ($(FX_GLIDE_HW),sst96)
CDEFS += -DSST96
CDEFS += -DSST96_FIFO
#CDEFS += -DSST96_ALT_FIFO_WRAP
#CDEFS += -DINIT96VGASWAP -DINIT_ACCESS_DIRECT
CDEFS += -DGLIDE_USE_ALT_REGMAP
endif
endif
# debug
ifdef DEBUG
CDEFS += -DGDBG_INFO_ON -DGLIDE_DEBUG -DGLIDE_SANITY_ASSERT -DGLIDE_SANITY_SIZE
endif
# other
CDEFS += -DGLIDE_PLUG -DGLIDE_SPLASH
ifeq ($(TEXUS2),1)
CDEFS += -DHAVE_TEXUS2
endif
###############################################################################
# flags
###############################################################################
# linker
LDFLAGS = -nologo -dll -opt:WIN98 -machine:IX86 -nodefaultlib
# assembler
ASFLAGS = -O6 -fwin32 -D__WIN32__ --prefix _
ASFLAGS += $(CDEFS)
# compiler
CFLAGS = -nologo -W3 -WX -D__MSC__=1
LDLIBS = user32.lib kernel32.lib
ifdef DEBUG
CFLAGS += -Od -MTd -Zi
LDFLAGS += -debugtype:both -debug
LDLIBS += LIBCMTD.lib
else
CPU ?= 6
CFLAGS += -DNDEBUG -G$(CPU) -O2 -MT
LDLIBS += LIBCMT.lib
endif
ifeq ($(FX_GLIDE_HW),sst96)
LDLIBS += gdi32.lib ddraw.lib dxguid.lib oldnames.lib
endif
CFLAGS += -I. -I../../incsrc -I../../init -I../../init/initvg -I../../init/init96
CFLAGS += -I$(FX_GLIDE_SW)/fxmisc -I$(FX_GLIDE_SW)/newpci/pcilib -I$(FX_GLIDE_SW)/fxmemmap
CFLAGS += -I$(FX_GLIDE_SW)/texus2/lib
CFLAGS += $(CDEFS)
ifneq ($(USE_X86),1)
CFLAGS += -DGLIDE_USE_C_TRISETUP
endif
###############################################################################
# objects
###############################################################################
GLIDE_OBJECTS = \
gsplash.obj \
g3df.obj \
gu.obj \
guclip.obj \
gpci.obj \
gump.obj \
diglide.obj \
disst.obj \
ditex.obj \
gbanner.obj \
gerror.obj \
gmovie.obj \
digutex.obj \
ddgump.obj \
gaa.obj \
gdraw.obj \
gglide.obj \
glfb.obj \
gsst.obj \
gtex.obj \
gtexdl.obj \
gutex.obj \
cpuid.obj
ifeq ($(USE_X86),1)
ifeq ($(FX_GLIDE_HW),sst1)
GLIDE_OBJECTS += \
xdraw.obj
else
GLIDE_OBJECTS += \
xdraw96.obj
endif
else
GLIDE_OBJECTS += \
gxdraw.obj
endif
ifeq ($(FX_GLIDE_HW),sst96)
GLIDE_OBJECTS += \
sst96.obj \
../../init/init96/init96.obj \
../../init/init96/dxdrvr.obj \
../../init/init96/initat3d.obj \
../../init/init96/initmcrx.obj
endif
GLIDE_OBJECTS += \
../../init/init.obj \
../../init/vgdrvr.obj \
../../init/vg96drvr.obj \
../../init/h3drvr.obj \
../../init/initvg/gamma.obj \
../../init/initvg/dac.obj \
../../init/initvg/video.obj \
../../init/initvg/parse.obj \
../../init/initvg/sli.obj \
../../init/initvg/util.obj \
../../init/initvg/info.obj \
../../init/initvg/print.obj \
../../init/initvg/gdebug.obj \
../../init/initvg/sst1init.obj \
$(FX_GLIDE_SW)/newpci/pcilib/sst1_pci.obj \
$(FX_GLIDE_SW)/newpci/pcilib/fxmsr.obj \
$(FX_GLIDE_SW)/newpci/pcilib/fxpci.obj \
$(FX_GLIDE_SW)/newpci/pcilib/fxw32.obj \
$(FX_GLIDE_SW)/newpci/pcilib/fxvxd.obj \
$(FX_GLIDE_SW)/newpci/pcilib/fxnt.obj \
TEXUS_SOURCES = \
$(FX_GLIDE_SW)/texus2/lib/texuslib.c \
$(FX_GLIDE_SW)/texus2/lib/clamp.c \
$(FX_GLIDE_SW)/texus2/lib/read.c \
$(FX_GLIDE_SW)/texus2/lib/resample.c \
$(FX_GLIDE_SW)/texus2/lib/mipmap.c \
$(FX_GLIDE_SW)/texus2/lib/quantize.c \
$(FX_GLIDE_SW)/texus2/lib/ncc.c \
$(FX_GLIDE_SW)/texus2/lib/nccnnet.c \
$(FX_GLIDE_SW)/texus2/lib/pal256.c \
$(FX_GLIDE_SW)/texus2/lib/pal6666.c \
$(FX_GLIDE_SW)/texus2/lib/dequant.c \
$(FX_GLIDE_SW)/texus2/lib/view.c \
$(FX_GLIDE_SW)/texus2/lib/util.c \
$(FX_GLIDE_SW)/texus2/lib/diffuse.c \
$(FX_GLIDE_SW)/texus2/lib/write.c \
$(FX_GLIDE_SW)/texus2/lib/tga.c \
$(FX_GLIDE_SW)/texus2/lib/3df.c \
$(FX_GLIDE_SW)/texus2/lib/ppm.c \
$(FX_GLIDE_SW)/texus2/lib/rgt.c \
$(FX_GLIDE_SW)/texus2/lib/txs.c \
$(FX_GLIDE_SW)/texus2/lib/codec.c \
$(FX_GLIDE_SW)/texus2/lib/eigen.c \
$(FX_GLIDE_SW)/texus2/lib/bitcoder.c
ifeq ($(TEXUS2),1)
GLIDE_OBJECTS += $(TEXUS_SOURCES:.c=.obj)
endif
###############################################################################
# rules
###############################################################################
.c.obj:
$(CC) -Fo$@ $(CFLAGS) -c $<
.rc.res:
$(RC) -Fo$@ $(CDEFS) -I$(FX_GLIDE_SW)/fxmisc $<
###############################################################################
# main
###############################################################################
all: glide3x $(TEXUS_EXEDIR)/$(TEXUS_EXE)
glide3x: $(GLIDE_LIBDIR)/$(GLIDE_DLL)
$(GLIDE_LIBDIR)/$(GLIDE_DLL): $(GLIDE_OBJECTS) $(GLIDE_RES)
$(LD) -out:$@ $(LDFLAGS) $(GLIDE_OBJECTS) $(LDLIBS) $(GLIDE_RES)
$(TEXUS_EXEDIR)/$(TEXUS_EXE): $(FX_GLIDE_SW)/texus2/cmd/cmd.c $(GLIDE_LIBDIR)/$(GLIDE_IMP)
#ifeq ($(TEXUS2),1)
# $(CC) -o $@ $(CFLAGS) $^
#else
# $(warning Texus2 not enabled... Skipping $(TEXUS_EXE))
#endif
fxoem2x: $(GLIDE_LIBDIR)/fxoem2x.dll
ifeq ($(FXOEM2X),1)
$(GLIDE_LIBDIR)/fxoem2x.dll: ../oem/oeminit.obj ../oem/oeminit.res
# $(LD) -out:$@ $(LDFLAGS) ../oem/oeminit.obj $(LDLIBS) ../oem/oeminit.res
else
$(GLIDE_LIBDIR)/fxoem2x.dll:
# $(warning FxOem2x not enabled... Skipping fxoem2x.dll)
endif
###############################################################################
# rules(2)
###############################################################################
cpuid.obj: cpudtect.asm
$(AS) -o $@ $(ASFLAGS) $<
xdraw.obj: xdraw.asm
$(AS) -o $@ $(ASFLAGS) $<
xdraw96.obj: xdraw96.asm
$(AS) -o $@ $(ASFLAGS) $<
ifeq ($(FX_GLIDE_HW),sst96)
../../init/initvg/gamma.obj: ../../init/initvg/gamma.c
$(CC) -Fo$@ $(CFLAGS) -USST96 -c $<
../../init/initvg/dac.obj: ../../init/initvg/dac.c
$(CC) -Fo$@ $(CFLAGS) -USST96 -c $<
../../init/initvg/video.obj: ../../init/initvg/video.c
$(CC) -Fo$@ $(CFLAGS) -USST96 -c $<
../../init/initvg/parse.obj: ../../init/initvg/parse.c
$(CC) -Fo$@ $(CFLAGS) -USST96 -c $<
../../init/initvg/sli.obj: ../../init/initvg/sli.c
$(CC) -Fo$@ $(CFLAGS) -USST96 -c $<
../../init/initvg/util.obj: ../../init/initvg/util.c
$(CC) -Fo$@ $(CFLAGS) -USST96 -c $<
../../init/initvg/info.obj: ../../init/initvg/info.c
$(CC) -Fo$@ $(CFLAGS) -USST96 -c $<
../../init/initvg/print.obj: ../../init/initvg/print.c
$(CC) -Fo$@ $(CFLAGS) -USST96 -c $<
../../init/initvg/gdebug.obj: ../../init/initvg/gdebug.c
$(CC) -Fo$@ $(CFLAGS) -USST96 -c $<
../../init/initvg/sst1init.obj: ../../init/initvg/sst1init.c
$(CC) -Fo$@ $(CFLAGS) -USST96 -c $<
endif
$(GLIDE_OBJECTS): fxinline.h fxgasm.h
fxinline.h: fxgasm.exe
./$< -inline > $@
fxgasm.h: fxgasm.exe
./$< -hex > $@
fxgasm.exe: fxgasm.c
$(CC) -o $@ $(CFLAGS) $<
###############################################################################
# clean, realclean
###############################################################################
clean:
-$(call UNLINK,*.obj)
-$(call UNLINK,../../init/*.obj)
-$(call UNLINK,../../init/initvg/*.obj)
-$(call UNLINK,../../init/init96/*.obj)
-$(call UNLINK,$(FX_GLIDE_SW)/newpci/pcilib/*.obj)
-$(call UNLINK,fxinline.h)
-$(call UNLINK,fxgasm.h)
-$(call UNLINK,$(FX_GLIDE_SW)/texus2/lib/*.obj)
-$(call UNLINK,$(GLIDE_RES))
realclean: clean
-$(call UNLINK,$(GLIDE_LIBDIR)/glide2x.exp)
-$(call UNLINK,$(GLIDE_LIBDIR)/$(GLIDE_DLL))
-$(call UNLINK,$(GLIDE_LIBDIR)/$(GLIDE_IMP))
-$(call UNLINK,$(TEXUS_EXEDIR)/$(TEXUS_EXE))

View File

@@ -19,16 +19,19 @@
;;
;; $Header$
;; $Log$
;; Revision 1.1.2.1 2004/03/02 07:55:29 dborca
;; Bastardised Glide3x for SST1
;;
;; Revision 1.1.1.1 1999/12/07 21:48:51 joseph
;; Initial checkin into SourceForge.
;;
;
; 2 3/04/97 9:10p Dow
; Neutered mutiplatform multiheaded monster.
;;
;;
TITLE cpudtect.asm
.586P
.model FLAT,C ; Flat memory, mangle publics with leading '_'
%include "xos.inc"
;; Data for data segment goes here
;_DATA SEGMENT DWORD USE32 PUBLIC 'DATA';
@@ -36,14 +39,14 @@ TITLE cpudtect.asm
;;; Some useful constants
; CPU Type
CPUTypeUnknown = 0ffffffffh
CPUTypePrePent = 4h
CPUTypeP5 = 5h
CPUTypeP6 = 6h
CPUTypeUnknown equ 0ffffffffh
CPUTypePrePent equ 4h
CPUTypeP5 equ 5h
CPUTypeP6 equ 6h
;;; References to external data:
_TEXT SEGMENT
segment TEXT
;;
;; _cpu_detect_asm - detect the type of CPU
;;
@@ -53,10 +56,8 @@ _TEXT SEGMENT
;;
;; returns 4 for non-pen
PUBLIC _cpu_detect_asm
_cpu_detect_asm PROC NEAR
proc _cpu_detect_asm
P6Stuff:
.586
pushad ; save all regs.
; First, determine whether CPUID instruction is available.
@@ -84,6 +85,7 @@ P6Stuff:
jnz NotIntel
xor ecx, 06c65746eh ; "ntel"
jnz NotIntel ;
;; Verifying architecture family
mov eax, 1
cpuid ; get family/model/stepping
@@ -116,45 +118,38 @@ NotIntel:
mov eax, 0ffffffffh
ret
_cpu_detect_asm ENDP
endp
;------------------------------------------------------------------------------
; this routine sets the precision to single
; which effects all adds, mults, and divs
align 4 ;
PUBLIC single_precision_asm
single_precision_asm PROC NEAR
.586
proc single_precision_asm
push eax ; make room
fnclex ; clear pending exceptions
fstcw WORD PTR [esp]
mov eax, DWORD PTR [esp]
fstcw WORD [esp]
mov eax, DWORD [esp]
and eax, 0000fcffh ; clear bits 9:8
mov DWORD PTR [esp], eax
fldcw WORD PTR [esp]
mov DWORD [esp], eax
fldcw WORD [esp]
pop eax
ret 0
single_precision_asm ENDP
ret
endp
;------------------------------------------------------------------------------
; this routine sets the precision to double
; which effects all adds, mults, and divs
align 4 ;
PUBLIC double_precision_asm
double_precision_asm PROC NEAR
.586
proc double_precision_asm
push eax ; make room
fnclex ; clear pending exceptions
fstcw WORD PTR [esp]
mov eax, DWORD PTR [esp]
fstcw WORD [esp]
mov eax, DWORD [esp]
and eax, 0000fcffh ; clear bits 9:8
or eax, 000002ffh ; set 9:8 to 10
mov DWORD PTR [esp], eax
fldcw WORD PTR [esp]
mov DWORD [esp], eax
fldcw WORD [esp]
pop eax
ret 0
double_precision_asm ENDP
_TEXT ENDS
END
ret
endp

View File

@@ -44,22 +44,22 @@
COMMENT; NEWLINE
#define OFFSET(p,o,pname) if (hex) \
printf("%s\t= %08xh\n",pname,((int)&p.o)-(int)&p); \
else printf("%s\t= %10d\n",pname,((int)&p.o)-(int)&p)
printf("%s\tequ %08xh\n",pname,((int)&p.o)-(int)&p); \
else printf("%s\tequ %10d\n",pname,((int)&p.o)-(int)&p)
#if (GLIDE_PLATFORM & GLIDE_HW_SST96)
#define HWOFFSET(p, o, pname) if (hex) \
printf("%s\t= %08xh\n",pname,(((int) &p.o)-(int)&p)>>2);\
else printf("%s\t= %10d\n",pname,(((int)&p.o)-(int)&p))
printf("%s\tequ %08xh\n",pname,(((int) &p.o)-(int)&p)>>2);\
else printf("%s\tequ %10d\n",pname,(((int)&p.o)-(int)&p))
#endif /* (GLIDE_PLATFORM & GLIDE_HW_SST96) */
#define OFFSET2(p,o,pname) if (hex) \
printf("%s\t= %08xh\n",pname,((int)&o)-(int)&p); \
else printf("%s\t= %10d\n",pname,((int)&o)-(int)&p)
printf("%s\tequ %08xh\n",pname,((int)&o)-(int)&p); \
else printf("%s\tequ %10d\n",pname,((int)&o)-(int)&p)
#define SIZEOF(p,pname) if (hex) \
printf("SIZEOF_%s\t= %08xh\n",pname,sizeof(p)); \
else printf("SIZEOF_%s\t= %10d\n",pname,sizeof(p))
printf("SIZEOF_%s\tequ %08lxh\n",pname,sizeof(p)); \
else printf("SIZEOF_%s\tequ %10ld\n",pname,sizeof(p))
#else
#define NEWLINE printf("\n");
#define COMMENT printf("#----------------------------------------------------------------------\n")
@@ -98,7 +98,7 @@ main (int argc, char **argv)
if (argc > 1) {
if (strcmp("-inline", argv[1]) == 0) {
Sstregs dummyRegs;
Sstregs dummyRegs = { 0x00UL };
printf("#ifndef __FX_INLINE_H__\n");
printf("#define __FX_INLINE_H__\n");
@@ -118,7 +118,7 @@ main (int argc, char **argv)
}
#ifndef __linux__
printf("SST_CHIP_MASK = 0%xh\n",SST_CHIP_MASK);
printf("SST_CHIP_MASK equ 0%xh\n",SST_CHIP_MASK);
#else
printf("SST_CHIP_MASK .EQU 0x%x\n", SST_CHIP_MASK);
#endif

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.1.1 1999/12/07 21:48:52 joseph
** Initial checkin into SourceForge.
**
*
* 6 3/09/97 10:31a Dow
* Added GR_DIENTRY for di glide functions
@@ -58,15 +61,6 @@ typedef struct
FxBool valid;
} CfTableEntry;
#ifdef __linux__
static void strupr(char *str) {
while (*str) {
if (islower(*str)) *str=toupper(*str);
str++;
}
}
#endif
/*---------------------------------------------------------------------------
** gu3dfGetInfo
*/
@@ -254,7 +248,13 @@ GR_DIENTRY(gu3dfGetInfo, FxBool,
/*
** determine the color format of the input image
*/
strupr( color_format );
{
char *tempStr = (char*)color_format;
while (*tempStr != '\0') {
*tempStr = toupper(*tempStr);
tempStr++;
}
}
i = 0;
format_found = FXFALSE;

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.1.1 1999/12/07 21:48:52 joseph
** Initial checkin into SourceForge.
**
*/
#define OFFICIAL 1
@@ -26,7 +29,8 @@
#include <fxver.h>
#include "rcver.h"
#include "fxbldno.h"
/*#include "fxbldno.h"*/
#define BUILD_NUMBER 0001
/////////////////////////////////////////////////////////////////////////////
//

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,161 @@
;
; compulsory header for glide3/xdraw* assembly specializations (NASM)
;
; $Header$
; $Log$
; Revision 1.1.2.2 2004/10/04 08:57:52 dborca
; supporting DOS/OpenWatcom in Assembly files
;
;
; Revision 1.1.2.1 2003/06/07 09:53:25 dborca
; initial checkin for NASM sources
;
;---------------------------------------
; platform defines
;---------------------------------------
%define XOS_DJGPP 1
%define XOS_LINUX 2
%define XOS_WIN32 4
%define XOS_WATCD 8
%define STDCALL 0
%define ELFTYPE 0
;---------------------------------------
; pick up the right OS
;---------------------------------------
%ifdef __DJGPP__
%define XOS XOS_DJGPP
%elifdef __linux__
%define XOS XOS_LINUX
%define ELFTYPE 1
%elifdef __WIN32__
%define XOS XOS_WIN32
%define STDCALL 1
%elifdef __WATCOMD__
%define XOS XOS_WATCD
%define STDCALL 1
%else
%error Unknown OS
%endif
;---------------------------------------
; general purpose macros
;---------------------------------------
%macro extrn 1-2 0
%if STDCALL && (%2 > 0)
%define %1 %1@%2
%endif
extern %1
%endmacro
%macro globl 1-2 0
%if STDCALL && (%2 > 0)
%define %1 %1@%2
%endif
global %1
%endmacro
%macro proc 1-2 0
%push proc
%if STDCALL && (%2 > 0)
%define %$ret RET %2
%else
%define %$ret RET
%endif
%if ELFTYPE
globl %1:function, %2
%else
globl %1, %2
%endif
%1:
%endmacro
%macro endp 0
%ifnctx proc
%error Mismatched `endp'/`proc'
%else
%pop
%endif
%endmacro
%macro ret 0
%ifnctx proc
RET
%else
%$ret
%endif
%endmacro
%macro invoke 1-*
%rep %0 - 1
%rotate -1
push %1
%endrep
%rotate -1
call %1
%if (STDCALL == 0) && (%0 > 1)
add esp, 4 * (%0 - 1)
%endif
%endmacro
;---------------------------------------
; Windows
;---------------------------------------
%if XOS == XOS_WIN32
%define TEXT .text align=32
%define DATA .data align=32
%define CONST .rdata align=32
%macro GET_GC 0
mov gc, [_GlideRoot + curGC]
%endmacro
%endif
;---------------------------------------
; DJGPP
;---------------------------------------
%if XOS == XOS_DJGPP
%define TEXT .text
%define DATA .data
%define CONST .rodata
%macro GET_GC 0
mov gc, [_GlideRoot + curGC]
%endmacro
%endif
;---------------------------------------
; Linux
;---------------------------------------
%if XOS == XOS_LINUX
%define TEXT .text align=32
%define DATA .data align=32
%define CONST .rodata align=32
%macro GET_GC 0
mov gc, [_GlideRoot + curGC]
%endmacro
%endif
;---------------------------------------
; WATCOM/DOS
;---------------------------------------
%if XOS == XOS_WATCD
%define TEXT _TEXT align=1 public use32 class=CODE FLAT
%define DATA _DATA align=4 public use32 class=DATA FLAT
%define CONST CONST2 align=4 public use32 class=DATA FLAT
%macro GET_GC 0
mov gc, [_GlideRoot + curGC]
%endmacro
%endif