Initial commit of Command & Conquer Red Alert source code.

This commit is contained in:
LFeenanEA
2025-02-27 16:15:05 +00:00
parent b685cea758
commit 5e733d5dcc
2082 changed files with 797727 additions and 0 deletions

58
VQ/INCLUDE/VQM32/ALL.H Normal file
View File

@@ -0,0 +1,58 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQMALL_H
#define VQMALL_H
/****************************************************************************
*
* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* FILE
* all.h
*
* DESCRIPTION
* All VQMisc32 library definitions. (32-Bit protected mode)
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* July 5, 1995
*
****************************************************************************/
#include <vqm32\iff.h>
#include <vqm32\mono.h>
#include <vqm32\portio.h>
#include <vqm32\profile.h>
#include <vqm32\targa.h>
#include <vqm32\compress.h>
#include <vqm32\video.h>
#include <vqm32\palette.h>
#include <vqm32\vesavid.h>
#include <vqm32\vesablit.h>
#include <vqm32\graphics.h>
#include <vqm32\mixfile.h>
#include <vqm32\crc.h>
#include <vqm32\huffman.h>
#include <vqm32\mem.h>
#endif /* VQMALL_H */

View File

@@ -0,0 +1,80 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQMCAPTOKEN_H
#define VQMCAPTOKEN_H
/****************************************************************************
*
* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* FILE
* captoken.h
*
* DESCRIPTION
* Text caption script definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* July 26, 1995
*
****************************************************************************/
/* CaptionText: This structure describes a line of text to be displayed
* with the video/audio.
*
* Size - Size of caption in bytes.
* OnFrame - Frame number to display caption.
* OffFrame - Frame number to clear caption.
* Flags - Display modifiers.
* CPF - Characters to draw per frame.
* Xpos - X pixel position to display caption.
* Ypos - Y pixel position to display caption.
* BgPen - Background pen to use.
* FgPen - Foreground pen to use.
* Text - Text string to display. (WORD aligned)
*/
typedef struct _CaptionText {
unsigned short Size;
unsigned short OnFrame;
unsigned short OffFrame;
unsigned char Flags;
char CPF;
unsigned short Xpos;
unsigned short Ypos;
char BgPen;
char FgPen;
char Text[];
} CaptionText;
/* CaptionText flag definitions. */
#define CTF_JUSTIFY (3<<0) /* Justification field. */
#define CTF_ABS (0<<0) /* Use absolute X,Y positions. */
#define CTF_CENTER (1<<0) /* Justify on Center */
#define CTF_LEFT (2<<0) /* Justify on left */
#define CTF_RIGHT (3<<0) /* Justify on right */
#define CTF_FLASH (1<<4) /* Flash text. */
/* Function prototypes. */
long BuildCaptions(char *name, char *buffer);
#endif /* VQMCAPTOKEN_H */

View File

@@ -0,0 +1,59 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQMCOMP_H
#define VQMCOMP_H
/****************************************************************************
*
* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* FILE
* compress.h
*
* DESCRIPTION
* Compression definitions. (32-Bit protected mode)
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* January 26, 1995
*
****************************************************************************/
/* Prototypes */
#ifdef __cplusplus
extern "C" {
#endif
unsigned long cdecl LCW_Compress(char const *source, char *dest,
unsigned long length);
unsigned long cdecl LCW_Uncompress(char const *source, char *dest,
unsigned long length);
long AudioZap(void *source, void *dest, long size);
long cdecl AudioUnzap(void *source, void *dest, long);
#ifdef __cplusplus
}
#endif
#endif /* VQMCOMP_H */

51
VQ/INCLUDE/VQM32/CRC.H Normal file
View File

@@ -0,0 +1,51 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQMCRC_H
#define VQMCRC_H
/****************************************************************************
*
* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* FILE
* CRC.h
*
* DESCRIPTION
* CRC calculation definitions.
*
* PROGRAMMER
* Joe L. Bostic
*
* DATE
* January 26, 1995
*
****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
long cdecl Calculate_CRC(void const *buffer, long length);
#ifdef __cplusplus
}
#endif
#endif /* VQMCRC_H */

105
VQ/INCLUDE/VQM32/FONT.H Normal file
View File

@@ -0,0 +1,105 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQMFONT_H
#define VQMFONT_H
/****************************************************************************
*
* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
*
*---------------------------------------------------------------------------
*
* FILE
* font.h
*
* DESCRIPTION
* Font definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* March 9, 1995
*
****************************************************************************/
/* Font: A Westwood style font.
*
* Size - Size of font.
* CompMethod - Compression method of font. (0 = none)
* NumBlks - Number of data blocks.
* InfoBlk - Offset to font information block.
* OffsetBlk - Offset to character offset block.
* WidthBlk - Offset to character width block.
* DataBlk - Offset to character data block.
* HeightBlk - Offset to character height block.
*/
typedef struct _Font {
unsigned short Size;
unsigned char CompMethod;
unsigned char NumBlks;
unsigned short InfoBlk;
unsigned short OffsetBlk;
unsigned short WidthBlk;
unsigned short DataBlk;
unsigned short HeightBlk;
} Font;
typedef struct _FontInfo {
long huh;
unsigned char MaxHeight;
unsigned char MaxWidth;
} FontInfo;
#ifdef __cplusplus
extern "C" {
#endif
extern void const *FontPtr;
extern int FontXSpacing;
extern int FontYSpacing;
#ifdef __cplusplus
}
#endif
extern char FontWidth;
extern char FontHeight;
extern char *FontWidthBlockPtr;
/* Function prototypes. */
void *cdecl Load_Font(char const *name);
void *cdecl Set_Font(void const *font);
unsigned short cdecl String_Pixel_Width(char const *string);
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __WATCOMC__
long cdecl __saveregs Char_Pixel_Width(char chr);
#else
long cdecl Char_Pixel_Width(char chr);
#endif
#ifdef __cplusplus
}
#endif
#endif /* VQMFONT_H */

View File

@@ -0,0 +1,55 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQMGRAPHICS_H
#define VQMGRAPHICS_H
/****************************************************************************
*
* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* FILE
* graphics.h
*
* DESCRIPTION
* Graphic rendering and manipulation definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* April 27, 1995
*
****************************************************************************/
/* Prototypes */
#ifdef __cplusplus
extern "C" {
#endif
void cdecl Eor_Region(long sx, long sy, long dx, long dy, long color);
void cdecl Fill_Rect(long x1, long y1, long x2, long y2, long color);
#ifdef __cplusplus
}
#endif
#endif /* VQMGRAPHICS_H */

View File

@@ -0,0 +1,99 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HUFFMAN_H
#define HUFFMAN_H
/****************************************************************************
*
* C O N F I D E N T I A L --- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* FILE
* huffman.h
*
* DESCRIPTION
* Huffman order 0 compress/decompress definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* May 19, 1995
*
****************************************************************************/
/* TreeNode: Huffman decoding tree node.
*
* count - Weight of the node in the tree.
* child0 - Child node 0
* child1 - Child node 1
*/
typedef struct _TreeNode {
unsigned long count;
unsigned short child0;
unsigned short child1;
} TreeNode;
/* HuffCode: This structure is used for storing the code for each symbol
* during encoding. A table of codes for each symbol is built
* from the Huffman tree.
*
* code - Code used to represent a symbol.
* bits - Length of code in bits.
*/
typedef struct _HuffCode {
unsigned short code;
short bits;
} HuffCode;
#define HUFF_EOS 256 /* End of stream symbol */
/* Prototypes */
#ifdef __cplusplus
extern "C" {
#endif
long cdecl HuffCompress(unsigned char *data, unsigned char *buffer,
long length, char *work);
long cdecl HuffDecompress(unsigned char *data, unsigned char *buffer,
long length, char *work);
void cdecl HuffCount(unsigned char *data, TreeNode *nodes, long length,
long zero);
void cdecl HuffScaleCounts(TreeNode *nodes);
long cdecl RLEHuffCounts(TreeNode *nodes, unsigned char *buffer);
long cdecl BuildHuffTree(TreeNode *nodes);
void cdecl ConvertToCodes(TreeNode *nodes, HuffCode *codes,
unsigned short code, short bits, short node);
long cdecl HuffEncode(unsigned char *data, unsigned char *buffer,
HuffCode *codes, long length);
#ifdef __cplusplus
}
#endif
#endif /* HUFFMAN_H */

141
VQ/INCLUDE/VQM32/IFF.H Normal file
View File

@@ -0,0 +1,141 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQMIFF_H
#define VQMIFF_H
/****************************************************************************
*
* C O N F I D E N T I A L --- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* FILE
* iff.h
*
* DESCRIPTION
* IFF (Interchange File Format) manager definitions.
* (32-Bit protected mode)
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* January 26, 1995
*
****************************************************************************/
/* FormHeader - Structure associated with IFF forms.
*
* id - IFF form id (IE: "FORM")
* size - Length of IFF in bytes
* type - Form type (IE: "ILBM")
*/
typedef struct _FormHeader {
long id;
long size;
long type;
} FormHeader;
/* Context - Structure associated with chunks.
*
* id - Chunk identifier.
* size - Size of chunk in bytes.
* scan - Bytes read/written.
*/
typedef struct _Context {
long id;
long size;
long scan;
} Context;
/* IFFHandle - Structure associated with an active IFF read\write session.
*
* fh - DOS filehandle
* flags - Internal flags used by IFF routines.
* form - IFF form information.
* scan - Bytes read/written
* cn - Context of current chunk.
*/
typedef struct _IFFHandle {
long fh;
long flags;
FormHeader form;
long scan;
Context cn;
} IFFHandle;
/* bit masks for "flags" field. */
#define IFFB_READ 0
#define IFFB_WRITE 1
#define IFFF_READ (1<<IFFB_READ)
#define IFFF_WRITE (1<<IFFB_WRITE)
/* IFF return codes. Most functions return either zero for success or
* one of these codes. The exceptions are the read/write functions which,
* return positive values for number of bytes read or written, or a negative
* error code.
*
* IFFERR_EOF - End of file.
* IFFERR_READ - Read error.
* IFFERR_WRITE - Write error.
* IFFERR_NOMEM - Unable to allocate memory.
*/
#define IFFERR_EOF -1
#define IFFERR_READ -2
#define IFFERR_WRITE -3
#define IFFERR_NOMEM -4
/* Macros to make things easier. */
#define REVERSE_LONG(id) (unsigned long)((((unsigned long)(id)>>24) \
&0x000000FFL)|(((unsigned long)(id)>>8) \
&0x0000FF00L)|(((unsigned long)(id)<<8) \
&0x00FF0000L)|(((unsigned long)(id)<<24)&0xFF000000L))
#define REVERSE_WORD(id) ((unsigned short)((((unsigned short)(id)<<8) \
&0x00FF00)|(((unsigned short)(id)>>8)&0x0FF)))
#define PADSIZE(size) (((size)+1)&(~1))
#ifndef MAKE_ID
#define MAKE_ID(a,b,c,d) ((long)((long)(d)<<24)|((long)(c)<<16)| \
((long)(b)<<8)|(long)(a))
#endif
/* Universal IFF identifiers */
#define ID_FORM MAKE_ID('F','O','R','M')
#define ID_LIST MAKE_ID('L','I','S','T')
#define ID_PROP MAKE_ID('P','R','O','P')
#define ID_NULL MAKE_ID(' ',' ',' ',' ')
/* Prototypes */
IFFHandle *OpenIFF(char *, long);
void CloseIFF(IFFHandle *);
long ReadForm(IFFHandle *, FormHeader *);
long WriteForm(IFFHandle *, FormHeader *);
long ReadChunkHeader(IFFHandle *);
long WriteChunkHeader(IFFHandle *, long, long);
long WriteChunk(IFFHandle *, long, char *, long);
long WriteChunkBytes(IFFHandle *, char *, long);
long ReadChunkBytes(IFFHandle *, char *, long);
long SkipChunkBytes(IFFHandle *, long);
long FindChunk(IFFHandle *, long);
char *IDtoStr(long, char *);
long CurrentFilePos(IFFHandle *);
#endif /* VQMIFF_H */

56
VQ/INCLUDE/VQM32/MEM.H Normal file
View File

@@ -0,0 +1,56 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQAMEM_H
#define VQAMEM_H
/****************************************************************************
*
* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
*
*---------------------------------------------------------------------------
*
* FILE
* mem.h
*
* DESCRIPTION
* Memory management definitions.
*
* PROGRAMMER
* Phil Gorrow
* Denzil E. Long, Jr.
*
* DATE
* July 5, 1995
*
****************************************************************************/
/* Definitions */
#define DPMI_INT 0x0031
#define DPMI_LOCK 0x0600
#define DPMI_UNLOCK 0x0601
/* Prototypes */
#ifdef __WATCOMC__
void DPMI_Lock(void const *ptr, long const size);
void DPMI_Unlock(void const *ptr, long const size);
#else
#define DPMI_Lock(a,b)
#define DPMI_Unlock(a,b)
#endif
#endif /* VQAMEM_H */

105
VQ/INCLUDE/VQM32/MIXFILE.H Normal file
View File

@@ -0,0 +1,105 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQMMIXFILE_H
#define VQMMIXFILE_H
/****************************************************************************
*
* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* FILE
* mixfile.h
*
* DESCRIPTION
* A mix file is basically a group of files concatinated together
* proceeded by a header describing where in the file each individual
* entry is located. These definitions are provided to simplify the access
* to these file entries.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* January 26, 1995
*
****************************************************************************/
/* Disable structure alignment.*/
#ifdef __WATCOMC__
#pragma pack(1);
#endif
/*---------------------------------------------------------------------------
* STRUCTURE DEFINITIONS
*-------------------------------------------------------------------------*/
/* MIXHeader: Mix file data header.
*
* Count - Number of entries contained in this mix file.
* Size - Size of Mix file.
*/
typedef struct _MIXHeader {
short Count;
long Size;
} MIXHeader;
/* MIXSubBlock: Mix file entry descriptor.
*
* CRC - Unique entry identifier.
* Offset - Offset from beginning of data segment to entry.
* Size - Size of entry.
*/
typedef struct _MIXSubBlock {
long CRC;
long Offset;
long Size;
} MIXSubBlock;
/* MIXHandle: Mix file handle.
*
* Name - Pointer to the name of the mix file this handle is for.
* Size - Size of entire mix file.
* FH - DOS file handle of opened entry.
* Count - Number of files contained in this mix.
* Entries - Array of 'Count' MIXSubBlock structure entries.
*/
typedef struct _MIXHandle {
char *Name;
long Size;
long FH;
long Count;
MIXSubBlock Entries[];
} MIXHandle;
/*---------------------------------------------------------------------------
* PROTOTYPES
*-------------------------------------------------------------------------*/
MIXHandle *OpenMix(char *name);
void CloseMix(MIXHandle *mix);
long OpenMixEntry(MIXHandle *mix, char *name);
/* Restore original alignment */
#ifdef __WATCOMC__
#pragma pack();
#endif
#endif /* VQMMIXFILE_H */

66
VQ/INCLUDE/VQM32/MONO.H Normal file
View File

@@ -0,0 +1,66 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQMMONO_H
#define VQMMONO_H
/****************************************************************************
*
* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* FILE
* mono.h
*
* DESCRIPTION
* Mono screen definitions. (32-Bit protected mode)
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* Feburary 8, 1995
*
****************************************************************************/
/* Prototypes */
#ifdef __cplusplus
extern "C" {
#endif
void cdecl Mono_Enable(void);
void cdecl Mono_Disable(void);
void cdecl Mono_Set_Cursor(long x, long y);
void cdecl Mono_Clear_Screen(void);
void cdecl Mono_Scroll(long lines);
void cdecl Mono_Put_Char(long character, long attrib);
void cdecl Mono_Draw_Rect(long x, long y, long w, long h, long attrib,
long thick);
void cdecl Mono_Text_Print(void const *text, long x, long y, long attrib);
void cdecl Mono_Print(void const *text);
short cdecl Mono_View_Page(long page);
short cdecl Mono_X(void);
short cdecl Mono_Y(void);
#ifdef __cplusplus
}
#endif
#endif /* VQMMONO_H */

View File

@@ -0,0 +1,59 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQMPALETTE_H
#define VQMPALETTE_H
/****************************************************************************
*
* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* FILE
* Palette.h (32-Bit protected mode)
*
* DESCRIPTION
* Palette definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* Febuary 3, 1995
*
****************************************************************************/
/* Prototypes */
#ifdef __cplusplus
extern "C" {
#endif
void cdecl SetPalette(unsigned char *palette,long numbytes,unsigned long slowpal);
void cdecl ReadPalette(void *palette);
void cdecl SetDAC(long color, long red, long green, long blue);
void cdecl TranslatePalette(void *pal24, void *pal15, long numbytes);
#ifdef __cplusplus
}
#endif
void SortPalette(unsigned char *pal, long numcolors);
#endif /* VQMPALETTE_H */

57
VQ/INCLUDE/VQM32/PORTIO.H Normal file
View File

@@ -0,0 +1,57 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQMPORTIO_H
#define VQMPORTIO_H
/****************************************************************************
*
* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* FILE
* Portio.h (32-Bit protected mode)
*
* DESCRIPTION
* Hardware port I/O
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* Febuary 3, 1995
*
****************************************************************************/
#ifdef __BORLANDC__
#ifdef __cplusplus
extern "C" {
#endif
short cdecl inp(unsigned short portid);
void cdecl outp(unsigned short portid, short value);
#ifdef __cplusplus
}
#endif
#endif /* __BORLANDC__ */
#endif /* VQMPORTIO_H */

View File

@@ -0,0 +1,52 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQMPROFILE_H
#define VQMPROFILE_H
/****************************************************************************
*
* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* FILE
* Profile.h (32-Bit protected mode)
*
* DESCRIPTION
* INI file profiling definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* January 26, 1995
*
****************************************************************************/
/* Prototypes */
long GetINIInt(char const *section, char const *entry,
long deflt, char *fname);
long GetINIString(char const *section, char const *entry,
char const *def, char *retbuffer, long retlen, char *fname);
long Get_Frame_Pathname(char *inifile,long anim_frame,char *ext,
char *outbuf);
#endif /* VQMPROFILE_H */

View File

@@ -0,0 +1,82 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQMREALMODE_H
#define VQMREALMODE_H
/****************************************************************************
*
* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* FILE
* realmode.h
*
* DESCRIPTION
* Real-mode interfacing definitions and equates. Many of the definitions
* and descriptions in this file were taken from other sources and
* compiled here for use in MISC32 library.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* Febuary 6, 1995
*
****************************************************************************/
/* REALPTR: Real-mode pointer (segment:offset16).
*
* The REALPTR data type is used in protected mode to hold real-mode
* pointers. The type is an unsigned long value, were the upper 16 bits
* are the segment number and the lower 16 bit are an offset. This type
* and the associated macros are identical to that of the PHARLAP "pltypes.h"
* definitions for easy of conversion to WATCOM/4GW.
*/
typedef unsigned long REALPTR;
#define RP_OFF(rp) ((unsigned short)(((unsigned long)(rp)) & 0xFFFF))
#define RP_SEG(rp) ((unsigned short)(((unsigned long)(rp)) >> 16))
#define RP_SET(rp, off, seg) (rp = ((unsigned long)(seg) << 16) + (off))
#define RP_INCR(rp, incr) (rp += ((unsigned long)(incr)) & 0xFFFF)
#define MK_PTR(off, seg) (void *)((((unsigned long)seg&0xFFFF)<<4)+off)
/* RMInfo: Real-mode interrupt call structure.
*
* Information that needs to be passed down to the real-mode interrupt is
* transfered using this structure. The address to this protected-mode
* structure (allocated by user) is passed into DPMI function 0x300. DOS/4GW
* will then use this information to set up the real-mode registers, switch
* to real-mode and then execute the interrupt in real-mode.
*/
typedef struct _RMInfo {
long edi;
long esi;
long ebp;
long reservedbysystem;
long ebx;
long edx;
long ecx;
long eax;
short flags;
short es,ds,fs,gs,ip,cs,sp,ss;
} RMInfo;
#endif /* VQMREALMODE_H */

View File

@@ -0,0 +1,90 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
/****************************************************************************
*
* File : soscomp.h
* Date Created : 6/1/94
* Description :
*
* Programmer(s) : Nick Skrepetos
* Last Modification : 10/1/94 - 11:37:9 AM
* Additional Notes : Modified by Denzil E. Long, Jr.
*
*****************************************************************************
* Copyright (c) 1994, HMI, Inc. All Rights Reserved *
****************************************************************************/
#ifndef _SOS_COMPRESS
#define _SOS_COMPRESS
/* compression types */
enum {
_ADPCM_TYPE_1,
};
/* define compression structure */
typedef struct _tagCOMPRESS_INFO {
char *lpSource;
char *lpDest;
unsigned long dwCompSize;
unsigned long dwUnCompSize;
short wBitSize;
short wChannels;
unsigned long dwSampleIndex;
long dwPredicted;
long dwDifference;
short wCodeBuf;
short wCode;
short wStep;
short wIndex;
unsigned long dwSampleIndex2; //added BP for channel 2
long dwPredicted2; //added BP for channel 2
long dwDifference2; //added BP for channel 2
short wCodeBuf2; //added BP for channel 2
short wCode2; //added BP for channel 2
short wStep2; //added BP for channel 2
short wIndex2; //added BP for channel 2
} _SOS_COMPRESS_INFO;
/* compressed file type header */
typedef struct _tagCOMPRESS_HEADER {
unsigned long dwType; // type of compression
unsigned long dwCompressedSize; // compressed file size
unsigned long dwUnCompressedSize; // uncompressed file size
unsigned long dwSourceBitSize; // original bit size
char szName[16]; // file type, for error checking
} _SOS_COMPRESS_HEADER;
/* Prototypes */
#ifdef __cplusplus
extern "C" {
#endif
void cdecl sosCODECInitStream(_SOS_COMPRESS_INFO *);
unsigned long cdecl sosCODECCompressData(_SOS_COMPRESS_INFO *,unsigned long);
unsigned long cdecl sosCODECDecompressData(_SOS_COMPRESS_INFO *,unsigned long);
#ifdef __cplusplus
}
#endif
#endif

130
VQ/INCLUDE/VQM32/TARGA.H Normal file
View File

@@ -0,0 +1,130 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQMTARGA_H
#define VQMTARGA_H
/****************************************************************************
*
* C O N F I D E N T I A L --- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* FILE
* Targa.h (32-Bit protected mode)
*
* DESCRIPTION
* Targa Image File definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* January 26, 1995
*
****************************************************************************/
/*---------------------------------------------------------------------------
* Targa Header definitions
*-------------------------------------------------------------------------*/
/* TGAHeader - Targa Image File header.
*
* IDLength - Size of Image ID field
* ColorMapType - Color map type.
* ImageType - Image type code.
* CMapStart - Color map origin.
* CMapLength - Color map length.
* CMapDepth - Depth of color map entries.
* XOffset - X origin of image.
* YOffset - Y origin of image.
* Width - Width of image.
* Height - Height of image.
* PixelDepth - Image pixel size
* ImageDescriptor - Image descriptor byte.
*/
typedef struct _TGAHeader {
char IDLength;
char ColorMapType;
char ImageType;
short CMapStart;
short CMapLength;
char CMapDepth;
short XOffset;
short YOffset;
short Width;
short Height;
char PixelDepth;
char ImageDescriptor;
} TGAHeader;
/* ImageType definiton */
#define TGA_NOIMAGE 0 /* No image data included in file */
#define TGA_CMAPPED 1 /* Color-mapped image data */
#define TGA_TRUECOLOR 2 /* Truecolor image data */
#define TGA_MONO 3 /* Monochrome image data */
#define TGA_CMAPPED_ENCODED 9 /* Color-mapped image data (Encoded) */
#define TGA_TRUECOLOR_ENCODED 10 /* Truecolor image data (Encoded) */
#define TGA_MONO_ENCODED 11 /* Monochrome image data (Encoded) */
/* ImageDescriptor definition */
#define TGAF_ATTRIB_BITS (0x0F<<0) /* Number of attribute bits per pixel */
#define TGAF_XORIGIN (1<<4)
#define TGAF_YORIGIN (1<<5)
/*---------------------------------------------------------------------------
* Targa Handle definitions
*-------------------------------------------------------------------------*/
/* TGAHandle - Targa Image File handle.
*
* fh - File handle returned by open().
* mode - Access mode.
* header - TGAHeader structure.
*/
typedef struct _TGAHandle {
short fh;
unsigned short mode;
TGAHeader header;
} TGAHandle;
/* Access modes. */
#define TGA_READMODE 0
#define TGA_WRITEMODE 1
#define TGA_RDWRMODE 2
/* Error codes */
#define TGAERR_OPEN -1
#define TGAERR_READ -2
#define TGAERR_WRITE -3
#define TGAERR_SYNTAX -4
#define TGAERR_NOMEM -5
#define TGAERR_NOTSUPPORTED -6
/*---------------------------------------------------------------------------
* Function prototypes
*-------------------------------------------------------------------------*/
TGAHandle *OpenTarga(char *, unsigned short);
void CloseTarga(TGAHandle *);
long LoadTarga(char *, char *, char *);
long SaveTarga(char *, TGAHeader *, char *, char *);
void XFlipTarga(TGAHeader *, char *);
void YFlipTarga(TGAHeader *, char *);
#endif /* VQMTARGA_H */

56
VQ/INCLUDE/VQM32/TEXT.H Normal file
View File

@@ -0,0 +1,56 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQMTEXT_H
#define VQMTEXT_H
/****************************************************************************
*
* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* FILE
* text.h
*
* DESCRIPTION
* Text printing definitions. (32-Bit protected mode)
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* March 13, 1995
*
****************************************************************************/
/* Prototypes */
#ifdef __cplusplus
extern "C" {
#endif
long cdecl Text_Print(char *string, long x, long y, long fcol, long bcol);
void cdecl Draw_Char(long character, long x, long y);
void cdecl Set_Font_Palette_Range(void *palette, long start, long end);
#ifdef __cplusplus
}
#endif
#endif /* VQMTEXT_H */

View File

@@ -0,0 +1,71 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQMVESABLIT_H
#define VQMVESABLIT_H
/****************************************************************************
*
* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* FILE
* VESABlit.h (32-Bit protected mode)
*
* DESCRIPTION
* VESA bitblit routines.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* Febuary 3, 1995
*
****************************************************************************/
#include <vqm32\video.h>
/*---------------------------------------------------------------------------
* FUNCTION PROTOTYPES
*-------------------------------------------------------------------------*/
void VESA_Blit_640x480(DisplayInfo *disp,unsigned char *buf,long x1,
long y1,long width,long height);
#ifdef __cplusplus
extern "C" {
#endif
void cdecl Blit_VESA640x480(DisplayInfo *disp,unsigned char *buf,long x1,
long y1,long width,long height);
void cdecl Buf_320x200_To_VESA_320x200(unsigned char *buffer, long grain);
void cdecl Buf_320x200_To_VESA_640x400(unsigned char *buffer, long grain);
void cdecl Buf_320x200_To_VESA_32K(unsigned char *buffer,
unsigned char *palette, long grain);
void cdecl Copy_Row(char *, char *, long);
void cdecl Copy_Word_Row(char *source, char *dest, char *palette,
long numbytes);
#ifdef __cplusplus
}
#endif
#endif /* VQMVESABLIT_H */

182
VQ/INCLUDE/VQM32/VESAVID.H Normal file
View File

@@ -0,0 +1,182 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQMVESAVID_H
#define VQMVESAVID_H
/****************************************************************************
*
* C O N F I D E N T I A L --- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* FILE
* VESAVid.h (32-Bit protected mode)
*
* DESCRIPTION
* VESA video manager definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* Febuary 3, 1995
*
****************************************************************************/
#ifndef __WATCOMC__
#include <pharlap.h>
#else
#include "realmode.h"
#endif
/*---------------------------------------------------------------------------
* VESA Video Modes
*-------------------------------------------------------------------------*/
#define VESA_640X400_256 0x100
#define VESA_640X480_256 0x101
#define VESA_800X600_16 0x102
#define VESA_800X600_256 0x103
#define VESA_1024X768_16 0x104
#define VESA_1024X768_256 0x105
#define VESA_1280X400_16 0x106
#define VESA_1280X400_256 0x107
#define VESA_TEXT_80X60 0x108
#define VESA_TEXT_132X25 0x109
#define VESA_TEXT_132X60 0x10C
#define VESA_320X200_32K_1 0x10D
#define VESA_320X200_32K_2 0x10E
#define VESA_640X480_32K 0x110
#define VESA_640X480_65K 0x111
#define VESA_640X480_16M 0x112
#define VESA_800X600_32K 0x113
#define VESA_800X600_65K 0x114
#define VESA_1024X768_32K 0x116
#define VESA_1024X768_65K 0x117
#define VESA_MIN VESA_640X400_256
#define VESA_MAX VESA_1024X768_65K
/*---------------------------------------------------------------------------
* Structure definitions
*-------------------------------------------------------------------------*/
/* VESAInfo - General information about this VESA implementation.
* (Filled in by VESA BIOS Function 0)
*
* Signature - Will always be 'VESA'
* Version - Version #
* OEMString - OEM ID string
* Capabilities - Not defined by VESA yet
* AvailModes - List of available modes; terminated with -1 (0xffff)
* TotalMemory - ???
* Reserved - Pads structure to 256 bytes total
*/
typedef struct _VESAInfo {
char Signature[4];
unsigned short Version;
REALPTR OEMString;
unsigned long Capabilities;
REALPTR AvailModes;
unsigned short TotalMemory;
unsigned char Reserved[236];
} VESAInfo;
/* VESAModeInfo - Information about this VESA mode.
* (Filled in by VESA BIOS Function 1)
*
* Attributes - bit 0: 1 = mode is supported
* bit 1: 1 = optional info available
* bit 2: 1 = std BIOS output functions valid in this mode
* bit 3: 0 = monochrome, 1 = color
* bit 4: 0 = text mode, 1 = graphics
* WinA_Attributes - bit 0 = window exists, bit 1=readable, bit 2= writable
* WinB_Attributes - bit 0 = window exists, bit 1=readable, bit 2= writable
* WinGranularity - smallest address boundary window can be placed upon;
* size is in KB (ie 64, 32, 4)
* WinSize - size of windows in KB (ie 64, 32)
* WinA_Segment - location of Window A in CPU space (usually 0xa000)
* WinB_Segment - location of Window B in CPU space (usually 0xb000)
* WinFunc - address of window-setting function (This is provided
* as an alternative to Int 10 for speed.)
* BytesPerScanline - # bytes per scan line
*
* Optional info (available if bit 1 of Attributes is set):
*
* XRes - X-resolution
* YRes - Y-resolution
* XCharSize - Horizontal size of char cell
* YCharSize - Vertical size of char cell
* NumPlanes - # of memory planes (???)
* BitsPerPixel - # bites per pixel
* NumBanks - # of banks (ie planes)
* MemoryModel - 00h = Text mode
* 01h = CGA mode
* 02h = Hercules
* 03h = 4 plane planar mode
* 04h = packed pixel mode (1 byte/pixel)
* 05h = non-chain 4, 256-color mode
* 06-0Fh =
* 10-FFh = OEM-specific
* BankSize - Bank size in KB
*/
typedef struct _VESAModeInfo {
unsigned short Attributes;
unsigned char WinA_Attributes;
unsigned char WinB_Attributes;
unsigned short WinGranularity;
unsigned short WinSize;
unsigned short WinA_Segment;
unsigned short WinB_Segment;
REALPTR WinFunc;
unsigned short BytesPerScanline;
unsigned short XRes;
unsigned short YRes;
unsigned char XCharSize;
unsigned char YCharSize;
unsigned char NumPlanes;
unsigned char BitsPerPixel;
unsigned char NumBanks;
unsigned char MemoryModel;
unsigned char BankSize;
unsigned char NumInputPages;
unsigned char Reserved;
unsigned char RedMaskSize;
unsigned char RedFieldPosition;
unsigned char GreenMaskSize;
unsigned char GreenFieldPosition;
unsigned char BlueMaskSize;
unsigned char BlueFieldPosition;
unsigned char RsvdMaskSize;
unsigned char RsvdFieldPosition;
unsigned char DirectColorModeInfo;
unsigned char pad[216];
} VESAModeInfo;
/*---------------------------------------------------------------------------
* Function prototypes
*-------------------------------------------------------------------------*/
long InitVESA(void);
void UninitVESA(void);
VESAModeInfo *SetVESAMode(long mode);
VESAModeInfo *ReadVESAModeInfo(long mode);
void SetVESAWindow(long grain_num);
#endif /* VQMVESAVID_H */

203
VQ/INCLUDE/VQM32/VESAVID.I Normal file
View File

@@ -0,0 +1,203 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program 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.
;
; This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
;
;****************************************************************************
;*
;* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
;*
;*----------------------------------------------------------------------------
;*
;* FILE
;* vesavid.i
;*
;* DESCRIPTION
;* VESA video manager definitions. (32-Bit protected mode)
;*
;* PROGRAMMER
;* Denzil E. Long, Jr.
;*
;* DATE
;* January 26, 1995
;*
;****************************************************************************
;----------------------------------------------------------------------------
; VESA video modes
;----------------------------------------------------------------------------
VESA_640X400_256 EQU 0x100
VESA_640X480_256 EQU 0x101
VESA_800X600_16 EQU 0x102
VESA_800X600_256 EQU 0x103
VESA_1024X768_16 EQU 0x104
VESA_1024X768_256 EQU 0x105
VESA_1280X400_16 EQU 0x106
VESA_1280X400_256 EQU 0x107
VESA_TEXT_80X60 EQU 0x108
VESA_TEXT_132X25 EQU 0x109
VESA_TEXT_132X60 EQU 0x10C
VESA_320X200_32K_1 EQU 0x10D
VESA_320X200_32K_2 EQU 0x10E
VESA_640X480_32K EQU 0x110
VESA_640X480_65K EQU 0x111
VESA_640X480_16M EQU 0x112
VESA_800X600_32K EQU 0x113
VESA_800X600_65K EQU 0x114
VESA_1024X768_32K EQU 0x116
VESA_1024X768_65K EQU 0x117
VESA_MIN EQU VESA_640X400_256
VESA_MAX EQU VESA_1024X768_65K
;----------------------------------------------------------------------------
; Structure definitions
;----------------------------------------------------------------------------
; VESAInfo - General information about this VESA implementation.
; (Filled in by VESA BIOS Function 0)
;
; Signature - Will always be 'VESA'
; Ver - Version #
; OEMString - OEM ID string
; Capabilities - Not defined by VESA yet
; AvailModes - List of available modes; terminated with -1 (0xffff)
; TotalMemory - ???
; Reserved - Pads structure to 256 bytes total
STRUC VESAInfo
Signature DD ?
Ver DW ?
OEMString DD ?
Capabilities DD ?
AvailModes DD ?
TotalMemory DW ?
Reserved DB 236 DUP (?)
ENDS VESAInfo
; VESAModeInfo - Information about this VESA mode.
; (Filled in by VESA BIOS Function 1)
;
; Attributes - bit 0: 1 = mode is supported
; bit 1: 1 = optional info available
; bit 2: 1 = std BIOS output functions valid in this mode
; bit 3: 0 = monochrome, 1 = color
; bit 4: 0 = text mode, 1 = graphics
; WinA_Attributes - bit 0 = window exists, bit 1=readable, bit 2= writable
; WinB_Attributes - bit 0 = window exists, bit 1=readable, bit 2= writable
; WinGranularity - smallest address boundary window can be placed upon;
; size is in KB (ie 64, 32, 4)
; WinSize - size of windows in KB (ie 64, 32)
; WinA_Segment - location of Window A in CPU space (usually 0xa000)
; WinB_Segment - location of Window B in CPU space (usually 0xb000)
; WinFunc - address of window-setting function (This is provided
; as an alternative to Int 10 for speed.)
; BytesPerScanline - # bytes per scan line
;
; Optional info (available if bit 1 of Attributes is set):
;
; XRes - X-resolution
; YRes - Y-resolution
; XCharSize - Horizontal size of char cell
; YCharSize - Vertical size of char cell
; NumPlanes - # of memory planes (???)
; BitsPerPixel - # bites per pixel
; NumBanks - # of banks (ie planes)
; MemoryModel - 00h = Text mode
; 01h = CGA mode
; 02h = Hercules
; 03h = 4 plane planar mode
; 04h = packed pixel mode (1 byte/pixel)
; 05h = non-chain 4, 256-color mode
; 06-0Fh =
; 10-FFh = OEM-specific
; BankSize - Bank size in KB
STRUC VESAModeInfo
Attributes DW ?
WinA_Attributes DB ?
WinB_Attributes DB ?
WinGranularity DW ?
WinSize DW ?
WinA_Segment DW ?
WinB_Segment DW ?
WinFunc DD ?
BytesPerScanline DW ?
XRes DW ?
YRes DW ?
XCharSize DB ?
YCharSize DB ?
NumPlanes DB ?
BitsPerPixel DB ?
NumBanks DB ?
MemoryModel DB ?
BankSize DB ?
NumInputPages DB ?
Reserved DB ?
RedMaskSize DB ?
RedFieldPosition DB ?
GreenMaskSize DB ?
GreenFieldPosition DB ?
BlueMaskSize DB ?
BlueFieldPosition DB ?
RsvdMaskSize DB ?
RsvdFieldPosition DB ?
DirectColorModeInfo DB ?
pad DB 216 DUP (?)
ENDS VESAModeInfo
;----------------------------------------------------------------------------
; Function definitions
;----------------------------------------------------------------------------
GLOBAL C InitVESA:PROC
GLOBAL C UninitVESA:PROC
GLOBAL C SetVESAMode:PROC
GLOBAL C ReadVESAModeInfo:PROC
GLOBAL C SetVESAWindow:PROC
;----------------------------------------------------------------------------
;
; NAME
; SET_WINDOW - Sets window A to the specified bank.
;
; SYNOPSIS
; SET_WINDOW GrainNum
;
; FUNCTION
; This routine uses the C Set_Window function rather than going through
; the BIOS, for two reasons: (1) Speed, and (2) On the Cirrus Logic 54xx
; VESA cards, BIOS calls make noise while playing digital audio.
;
; INPUTS
; GrainNum - Granularity number.
;
; RESULT
; NONE
;
;----------------------------------------------------------------------------
MACRO SET_WINDOW grain_num
push esi
push edi
push es
call SetVESAWindow C,grain_num
pop es
pop edi
pop esi
ENDM

217
VQ/INCLUDE/VQM32/VGA.I Normal file
View File

@@ -0,0 +1,217 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program 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.
;
; This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
;
;****************************************************************************
;*
;* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
;*
;*---------------------------------------------------------------------------
;*
;* FILE
;* vga.i
;*
;* DESCRIPTION
;* VGA hardware definitions. (32-Bit protected mode)
;*
;* PROGRAMMER
;* Denzil E. Long, Jr.
;*
;* DATE
;* January 26, 1995
;*
;****************************************************************************
;----------------------------------------------------------------------------
; VGA Registers
;----------------------------------------------------------------------------
R_SEQUENCER EQU 03C4h ;Sequencer Controller Index reg
SEQ_RESET EQU 00h ;Reset
SEQ_MAP_MASK EQU 02h ;Index in Sequencer of Map Mask reg
SEQ_MEMORY_MODE EQU 04h ;Memory Mode
R_GRAPHICS_CONTROLLER EQU 03CEh ;Graphics Controller Index reg
GC_READ_MAP EQU 04h ;Index in GController of Read Map reg
GC_MODE EQU 05h ;Read/Write Modes
GC_MISC EQU 06h ;Read/Write Modes
GC_BITMASK EQU 08h ;Index in GController of BitMask reg
R_CRT_CONTROLLER EQU 03D4h ;CRT Controller Index reg
CRT_VERT_TOTAL EQU 06h ;Vertical total
CRT_OVERFLOW EQU 07h ;Overflow
CRT_MAX_SCANLINE EQU 09h ;Max scan line
CRT_STARTADDR_HIGH EQU 0Ch ;Bitmap start address high byte
CRT_STARTADDR_LOW EQU 0Dh ;Bitmap start address low byte
CRT_VERTRET_START EQU 010h ;Vertical retrace pulse start
CRT_VERTRET_END EQU 011h ;Vertical retrace pulse end
CRT_VERTDISP_END EQU 012h ;Vertical display end
CRT_UNDERLINE EQU 014h ;Underline location
CRT_START_VB EQU 015h ;Start vertical blank
CRT_END_VB EQU 016h ;End vertical blank
CRT_MODE_CONTROL EQU 017h ;Mode control
R_MISC_OUTPUT EQU 03C2h ;Miscellaneous Output reg
;----------------------------------------------------------------------------
; Palette Registers
;----------------------------------------------------------------------------
PEL_READ_ADDR EQU 03C7h
PEL_WRITE_ADDR EQU 03C8h
PEL_DATA EQU 03C9h
;----------------------------------------------------------------------------
; XMode planes, for the Map Mask register
;----------------------------------------------------------------------------
XPLANE_1 EQU 1
XPLANE_2 EQU 2
XPLANE_3 EQU 4
XPLANE_4 EQU 8
;----------------------------------------------------------------------------
;
; NAME
; SET_PLANE - Set an XMode plane.
;
; SYNOPSIS
; SET_PLANE plane
;
; INPUTS
; plane - Number of Xmode plane to set.
;
; USES
; eax, edx
;
;----------------------------------------------------------------------------
MACRO SET_PLANE plane
mov edx,R_SEQUENCER
mov eax,SEQ_MAP_MASK
out dx,al
inc edx
mov eax,plane
out dx,al
ENDM
;----------------------------------------------------------------------------
;
; NAME
; SET_BITMASK - Set the BitMask register.
;
; SYNOPSIS
; SET_BITMASK mask
;
; INPUTS
; mask - Bitmask to use.
;
; USES
; eax, edx
;
;----------------------------------------------------------------------------
MACRO SET_BITMASK mask
mov edx,R_GRAPHICS_CONTROLLER
mov eax,GC_BITMASK
out dx,al
inc edx
mov eax,mask
out dx,al
ENDM
;----------------------------------------------------------------------------
;
; NAME
; SET_WRITEMODE - Set the VGA writemode.
;
; SYNOPSIS
; SET_WRITEMODE mode
;
; INPUTS
; mode - Write mode.
;
; USES
; eax, edx
;
;----------------------------------------------------------------------------
MACRO SET_WRITEMODE mode
mov edx,R_GRAPHICS_CONTROLLER
mov eax,GC_MODE
out dx,al
inc edx
in al,dx ;Read the register
and al,0FCh ;Turn off 2 lower bits
or al,mode ;Set write mode
out dx,al
ENDM
;----------------------------------------------------------------------------
;
; NAME
; OUTPORT - Output data to a VGA register.
;
; SYNOPSIS
; OUTPORT port,register,data
;
; INPUTS
; port - Port address.
; register - Register to write to.
; data - Data to write.
;
; USES
; eax, edx
;
;----------------------------------------------------------------------------
MACRO OUTPORT port,register,data
mov edx,port
mov al,register
out dx,al
inc edx
mov al,data
out dx,al
ENDM
;----------------------------------------------------------------------------
;
; NAME
; INPORT - Input data from a VGA register.
;
; SYNOPSIS
; data = INPORT port,register
;
; INPUTS
; port - Port address.
; register - Register to read from.
;
; RESULT
; data - Value read from port in AL.
;
; USES
; eax, edx
;
;----------------------------------------------------------------------------
MACRO INPORT port,register
mov edx,port
mov al,register
out dx,al
inc edx
in al,dx
ENDM

115
VQ/INCLUDE/VQM32/VIDEO.H Normal file
View File

@@ -0,0 +1,115 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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.
**
** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQMVIDEO_H
#define VQMVIDEO_H
/****************************************************************************
*
* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* FILE
* Video.h (32-Bit protected mode)
*
* DESCRIPTION
* Video manager definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* Febuary 3, 1995
*
****************************************************************************/
#include <vqm32\vesavid.h>
/*---------------------------------------------------------------------------
* VGA video modes
*-------------------------------------------------------------------------*/
#define TEXT 0x02
#define MCGA 0x13
#define XMODE_320X200 0x50
#define XMODE_320X240 0x51
#define XMODE_320X400 0x52
#define XMODE_320X480 0x53
#define XMODE_360X400 0x54
#define XMODE_360X480 0x55
#define XMODE_MIN 0x50
#define XMODE_MAX 0x55
/*---------------------------------------------------------------------------
* Structure definitions
*-------------------------------------------------------------------------*/
/* DisplayInfo - Information about the current display.
*
* Mode - Mode identification.
* XRes - X resolution of mode.
* YRes - Y resolution of mode.
* VBIbit - Polarity of vertical blank bit.
* Extended - Pointer to mode specific data structure.
*/
typedef struct _DisplayInfo {
long Mode;
long XRes;
long YRes;
long VBIbit;
void *Extended;
} DisplayInfo;
/*---------------------------------------------------------------------------
* Function prototypes
*-------------------------------------------------------------------------*/
DisplayInfo *SetVideoMode(long mode);
DisplayInfo *GetDisplayInfo(void);
long TestVBIBit(void);
long GetVBIBit(void);
void SetupXPaging(void);
void FlipXPage(void);
unsigned char *GetXHidPage(void);
unsigned char *GetXSeenPage(void);
void DisplayXPage(long page);
#ifdef __cplusplus
extern "C" {
#endif
void cdecl WaitNoVB(short vbibit);
void cdecl WaitVB(short vbibit);
void cdecl ClearVRAM(void);
long cdecl SetXMode(long mode);
void cdecl ClearXMode(void);
void cdecl ShowXPage(unsigned long StartOffset);
void cdecl Xmode_BufferCopy_320x200(void *buff, void *screen);
void cdecl Xmode_Blit(void *buffer, void *screen, long imgwidth, long imgheight);
void cdecl MCGA_BufferCopy(unsigned char *buffer, unsigned char *dummy);
void cdecl MCGA_Blit(unsigned char *buffer, unsigned char *screen,
long imgwidth, long imgheight);
#ifdef __cplusplus
}
#endif
#endif /* VQMVIDEO_H */

80
VQ/INCLUDE/VQM32/VIDEO.I Normal file
View File

@@ -0,0 +1,80 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program 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.
;
; This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
;
;****************************************************************************
;*
;* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
;*
;*----------------------------------------------------------------------------
;*
;* FILE
;* video.i
;*
;* DESCRIPTION
;* Video manager definitions. (32-Bit protected mode)
;*
;* PROGRAMMER
;* Denzil E. Long, Jr.
;*
;* DATE
;* January 26, 1995
;*
;****************************************************************************
INCLUDE "vesavid.i"
;----------------------------------------------------------------------------
; Video Modes
;----------------------------------------------------------------------------
TEXT EQU 002h
MCGA EQU 013h
XMODE_320X200 EQU 050h
XMODE_320X240 EQU 051h
XMODE_320X400 EQU 052h
XMODE_320X480 EQU 053h
XMODE_360X400 EQU 054h
XMODE_360X480 EQU 055h
;----------------------------------------------------------------------------
; Structure definitions
;----------------------------------------------------------------------------
; DisplayInfo - Information about the current display.
;
; Mode - Mode identification
; XRes - X resolution
; YRes - Y resolution
; VBIbit - Polarity of vertical blank bit.
; Extended - Pointer to mode specified data structure.
STRUC DisplayInfo
Mode DD ?
XRes DD ?
YRes DD ?
VBIbit DD ?
Extended DD ?
ENDS DisplayInfo
;----------------------------------------------------------------------------
; Function definitions
;----------------------------------------------------------------------------
GLOBAL C GetDisplayInfo:NEAR
GLOBAL C GetVBIBit:NEAR