Skip to content

Commit

Permalink
Add Glide version.
Browse files Browse the repository at this point in the history
  • Loading branch information
kosua20 committed Jun 6, 2021
1 parent 3b6e51f commit 0e3813a
Show file tree
Hide file tree
Showing 41 changed files with 28,908 additions and 0 deletions.
41 changes: 41 additions & 0 deletions glide/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Based on DOS/DJGPP tests makefile for Glide3
# Initial makefiles:
# Copyright (c) 2002 - Borca Daniel
# Email : [email protected]
# Web : http://www.geocities.com/dborca
#


.PHONY: all clean
.SUFFIXES: .c .o .exe

CC = i586-pc-msdosdjgpp-gcc
CFLAGS = -MMD -Wall -std=gnu99 -O2 -ffast-math -march=i386 -mtune=i586 -fomit-frame-pointer -fgnu89-inline
CFLAGS += -Iglide3/include
CFLAGS += -D__DOS__ -DSST1
CFLAGS += -D__DOS32__
CCTOOLS = /usr/bin/g++


LDFLAGS = -s -Lglide3/lib/

#LDLIBS = -lglide3i
LDLIBS = -lglide3x

build/%.o: src/%.c
$(shell mkdir -p build)
$(CC) -o $@ $(CFLAGS) -c $<

dragon.exe: build/main.o build/geometry.o build/glide_helpers.o build/keyboard.o build/scene.o
$(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS)

all: dragon.exe

tools:
$(CCTOOLS) -o image_tool resources/tools/image_tool.c
$(CCTOOLS) -o mesh_tool resources/tools/mesh_tool.cpp

clean:
@echo Cleaning...
$(shell rm dragon.exe &> /dev/null)
$(shell rm -r build/ &> /dev/null)
16 changes: 16 additions & 0 deletions glide/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Glide version

![](images/glide-1.png)

This version is targeting the Glide API, designed to control 3DFX graphic adapters (such as the Voodoo 1 and the Banshee) under DOS.

The [DJGPP toolchain](https://github.com/andrewwutw/build-djgpp) is used to compile C to the DOS target. The Glide 'driver' is also compiled using the same toolchain from the sources [released online](http://glide.sourceforge.net) and adjusted for compilation with DJGPP by SuperIlu ([repository](https://github.com/SuperIlu/glide)). The version included in the repository is targeting the Voodoo 1 specifically. Documentation for the Glide API can be found on [3dfxarchive.com](https://3dfxarchive.com/reference.htm). For testing, the Voodoo Graphics was emulated using [DOSBox-X](https://dosbox-x.com).

![](images/glide-2.png)

Vertex transformation and shading is performed on the CPU. Clipping is also performed manually, generating triangle strip lists that are then sent to the graphics adapter. Textures are limited to a 256px resolution, and stored in the RGB565 format ; mipmaps are not used for now. Inputs are handled using a custom interrupt.

![](images/glide-3.png)



Binary file added glide/dragon.exe
Binary file not shown.
71 changes: 71 additions & 0 deletions glide/glide3/dxe.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#include <sys/dxe.h>

extern_asm(___dj_stderr);
extern_asm(___dj_stdout);
extern_asm(___djgpp_base_address);
extern_asm(___djgpp_nearptr_disable);
extern_asm(___djgpp_nearptr_enable);
extern_asm(___dpmi_free_physical_address_mapping);
extern_asm(___dpmi_physical_address_mapping);
extern_asm(__crt0_startup_flags);
extern_asm(_atof);
extern_asm(_atoi);
extern_asm(_exit);
extern_asm(_fclose);
extern_asm(_fflush);
extern_asm(_fgetc);
extern_asm(_fgets);
extern_asm(_fopen);
extern_asm(_fprintf);
extern_asm(_fread);
extern_asm(_getc);
extern_asm(_getenv);
extern_asm(_malloc);
extern_asm(_memcpy);
extern_asm(_pow);
extern_asm(_printf);
extern_asm(_puts);
extern_asm(_sprintf);
extern_asm(_sscanf);
extern_asm(_strcat);
extern_asm(_strcmp);
extern_asm(_strcpy);
extern_asm(_strlen);
extern_asm(_strtok);
extern_asm(_vfprintf);

DXE_EXPORT_TABLE_AUTO (___dxe_eta___glide3x)
DXE_EXPORT_ASM (___dj_stderr)
DXE_EXPORT_ASM (___dj_stdout)
DXE_EXPORT_ASM (___djgpp_base_address)
DXE_EXPORT_ASM (___djgpp_nearptr_disable)
DXE_EXPORT_ASM (___djgpp_nearptr_enable)
DXE_EXPORT_ASM (___dpmi_free_physical_address_mapping)
DXE_EXPORT_ASM (___dpmi_physical_address_mapping)
DXE_EXPORT_ASM (__crt0_startup_flags)
DXE_EXPORT_ASM (_atof)
DXE_EXPORT_ASM (_atoi)
DXE_EXPORT_ASM (_exit)
DXE_EXPORT_ASM (_fclose)
DXE_EXPORT_ASM (_fflush)
DXE_EXPORT_ASM (_fgetc)
DXE_EXPORT_ASM (_fgets)
DXE_EXPORT_ASM (_fopen)
DXE_EXPORT_ASM (_fprintf)
DXE_EXPORT_ASM (_fread)
DXE_EXPORT_ASM (_getc)
DXE_EXPORT_ASM (_getenv)
DXE_EXPORT_ASM (_malloc)
DXE_EXPORT_ASM (_memcpy)
DXE_EXPORT_ASM (_pow)
DXE_EXPORT_ASM (_printf)
DXE_EXPORT_ASM (_puts)
DXE_EXPORT_ASM (_sprintf)
DXE_EXPORT_ASM (_sscanf)
DXE_EXPORT_ASM (_strcat)
DXE_EXPORT_ASM (_strcmp)
DXE_EXPORT_ASM (_strcpy)
DXE_EXPORT_ASM (_strlen)
DXE_EXPORT_ASM (_strtok)
DXE_EXPORT_ASM (_vfprintf)
DXE_EXPORT_END
127 changes: 127 additions & 0 deletions glide/glide3/include/3dfx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/*
** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC([email protected]).
** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
**
** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
** THE UNITED STATES.
**
** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
*/
#ifndef __3DFX_H__
#define __3DFX_H__

/*
** basic data types
*/
typedef unsigned char FxU8;
typedef signed char FxI8;
typedef unsigned short FxU16;
typedef signed short FxI16;
#if defined(__DOS__) || defined(__MSDOS__) || defined(_WIN32) || defined(macintosh)
typedef signed long FxI32;
typedef unsigned long FxU32;
#else
typedef signed int FxI32;
typedef unsigned int FxU32;
#endif
typedef unsigned long AnyPtr;
typedef int FxBool;
typedef float FxFloat;
typedef double FxDouble;

/*
** color types
*/
typedef unsigned long FxColor_t;
typedef struct { float r, g, b, a; } FxColor4;

/*
** fundamental types
*/
#define FXTRUE 1
#define FXFALSE 0

/*
** helper macros
*/
#define FXUNUSED( a ) ((void)(a))
#define FXBIT( i ) ( 1 << (i) )

/*
** export macros
*/

#if defined(__MSC__) || defined(_MSC_VER)
# if defined (MSVC16)
# define FX_ENTRY
# define FX_CALL
# else
# define FX_ENTRY extern
# define FX_CALL __stdcall
# endif
#elif defined(__WATCOMC__)
# define FX_ENTRY extern
# define FX_CALL __stdcall
#elif defined (__IBMC__) || defined (__IBMCPP__)
/* IBM Visual Age C/C++: */
# define FX_ENTRY extern
# define FX_CALL __stdcall
#elif defined(__DJGPP__)
# define FX_ENTRY extern
# define FX_CALL
#elif defined(__MINGW32__)
# define FX_ENTRY extern
# define FX_CALL __stdcall
#elif defined(__unix__)
# define FX_ENTRY extern
# define FX_CALL
#elif defined(__MWERKS__)
# if macintosh
# define FX_ENTRY extern
# define FX_CALL
# else /* !macintosh */
# error "Unknown MetroWerks target platform"
# endif /* !macintosh */
#else
# warning define FX_ENTRY & FX_CALL for your compiler
# define FX_ENTRY extern
# define FX_CALL
#endif

/*
** x86 compiler specific stuff
*/
#if defined(__BORLANDC_)
# define REALMODE

# define REGW( a, b ) ((a).x.b)
# define REGB( a, b ) ((a).h.b)
# define INT86( a, b, c ) int86(a,b,c)
# define INT86X( a, b, c, d ) int86x(a,b,c,d)

# define RM_SEG( a ) FP_SEG( a )
# define RM_OFF( a ) FP_OFF( a )
#elif defined(__WATCOMC__)
# undef FP_SEG
# undef FP_OFF

# define REGW( a, b ) ((a).w.b)
# define REGB( a, b ) ((a).h.b)
# define INT86( a, b, c ) int386(a,b,c)
# define INT86X( a, b, c, d ) int386x(a,b,c,d)

# define RM_SEG( a ) ( ( ( ( FxU32 ) (a) ) & 0x000F0000 ) >> 4 )
# define RM_OFF( a ) ( ( FxU16 ) (a) )
#endif

#endif /* !__3DFX_H__ */
Loading

0 comments on commit 0e3813a

Please sign in to comment.