Initial commit of Command & Conquer Red Alert source code.
This commit is contained in:
72
WWFLAT32/VIDEO/INITDLAY.CPP
Normal file
72
WWFLAT32/VIDEO/INITDLAY.CPP
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
** 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 A S S O C I A T E S **
|
||||
***************************************************************************
|
||||
* *
|
||||
* Project Name : LIBRARY *
|
||||
* *
|
||||
* File Name : INITDLAY.C *
|
||||
* *
|
||||
* Programmer : Barry Green *
|
||||
* *
|
||||
* Last Update : August 3, 1994 [SKB] *
|
||||
* *
|
||||
*-------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* Init_Delay -- I am not sure *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#include "wwstd.h"
|
||||
#include "timer.h"
|
||||
#include "video.h"
|
||||
|
||||
BOOL VertBlank;
|
||||
|
||||
/***************************************************************************
|
||||
* INIT_DELAY -- I am not sure *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 08/03/1994 SKB : Created. *
|
||||
*=========================================================================*/
|
||||
VOID Init_Delay(VOID)
|
||||
{
|
||||
WORD nz, nnz;
|
||||
|
||||
nz = nnz = 0;
|
||||
|
||||
CountDown.Set(15, TRUE); // set to 1/4 second and start it
|
||||
|
||||
do {
|
||||
if (Get_Vert_Blank())
|
||||
nnz++;
|
||||
else
|
||||
nz++;
|
||||
} while (CountDown.Time());
|
||||
|
||||
VertBlank = (nnz > nz);
|
||||
}
|
204
WWFLAT32/VIDEO/MAKEFILE
Normal file
204
WWFLAT32/VIDEO/MAKEFILE
Normal file
@@ -0,0 +1,204 @@
|
||||
#
|
||||
# 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 **
|
||||
#***************************************************************************
|
||||
#* *
|
||||
#* Project Name : Westwood Library .LIB makefile *
|
||||
#* *
|
||||
#* File Name : MAKEFILE *
|
||||
#* *
|
||||
#* Programmer : Julio R. Jerez *
|
||||
#* *
|
||||
#* Start Date : Jan 27, 1995 *
|
||||
#* *
|
||||
#* *
|
||||
#*-------------------------------------------------------------------------*
|
||||
#* *
|
||||
#* Required environment variables: *
|
||||
#* WWFLAT = your root WWFLAT path *
|
||||
#* WWVCS = root directory for wwlib version control archive *
|
||||
#* WATCOM = your Watcom installation path *
|
||||
#* *
|
||||
#* Required changes to makefile: *
|
||||
#* PROJ_NAME = name of the library you're building *
|
||||
#* OBJECTS = list of objects in your library *
|
||||
#* *
|
||||
#* Optional changes to makefile: *
|
||||
#* PROJ_DIR = full pathname of your working directory *
|
||||
#* .path.xxx = full pathname where various file types live *
|
||||
#* *
|
||||
#***************************************************************************
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Verify user's environment
|
||||
#---------------------------------------------------------------------------
|
||||
!ifndef %WWFLAT
|
||||
!error WWFLAT Environment var not configured.
|
||||
!endif
|
||||
|
||||
|
||||
!ifndef %WWVCS
|
||||
!error WWVCS Environment var not configured.
|
||||
!endif
|
||||
|
||||
!ifndef %WATCOM
|
||||
!error WATCOM Environment var not configured.
|
||||
!endif
|
||||
|
||||
|
||||
#===========================================================================
|
||||
# User-defined section: the user should tailor this section for each project
|
||||
#===========================================================================
|
||||
|
||||
PROJ_NAME = video
|
||||
PROJ_DIR = $(%WWFLAT)\$(PROJ_NAME)
|
||||
LIB_DIR = $(%WWFLAT)\lib
|
||||
|
||||
!include $(%WWFLAT)\project.cfg
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project-dependent variables
|
||||
#---------------------------------------------------------------------------
|
||||
OBJECTS = &
|
||||
video.obj &
|
||||
vesainfo.obj &
|
||||
initdlay.obj &
|
||||
vertblnk.obj &
|
||||
vesahook.obj
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Path macros: one path for each file type.
|
||||
# These paths are used to tell make where to find/put each file type.
|
||||
#---------------------------------------------------------------------------
|
||||
.asm: $(PROJ_DIR)
|
||||
.c: $(PROJ_DIR)
|
||||
.cpp: $(PROJ_DIR)
|
||||
.h: $(PROJ_DIR)
|
||||
.obj: $(PROJ_DIR)
|
||||
.lib: $(%WWLIB)\lib
|
||||
.exe: $(PROJ_DIR)
|
||||
|
||||
#===========================================================================
|
||||
# Pre-defined section: there should be little need to modify this section.
|
||||
#===========================================================================
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Tools/commands
|
||||
#---------------------------------------------------------------------------
|
||||
C_CMD = wcc386
|
||||
CPP_CMD = wpp386
|
||||
LIB_CMD = wlib
|
||||
LINK_CMD = wlink
|
||||
ASM_CMD = tasm32
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Include & library paths
|
||||
# If LIB & INCLUDE are already defined, they are used in addition to the
|
||||
# WWLIB32 lib & include; otherwise, they're constructed from
|
||||
# BCDIR & TNTDIR
|
||||
#---------------------------------------------------------------------------
|
||||
LIBPATH = $(%WWFLAT)\LIB;$(%WATCOM)\LIB
|
||||
INCLUDEPATH = $(%WWFLAT)\INCLUDE;$(%WATCOM)\H
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Implicit rules
|
||||
# Compiler:
|
||||
# ($< = full dependent with path)
|
||||
# Assembler:
|
||||
# output obj's are constructed from .obj: & the $& macro
|
||||
# ($< = full dependent with path)
|
||||
# tasm's cfg file is not invoked as a response file.
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
.c.obj: $(%WWFLAT)\project.cfg .AUTODEPEND
|
||||
$(C_CMD) $(CC_CFG) $<
|
||||
|
||||
.cpp.obj: $(%WWFLAT)\project.cfg .AUTODEPEND
|
||||
$(CPP_CMD) $(CC_CFG) $<
|
||||
|
||||
.asm.obj: $(%WWFLAT)\project.cfg
|
||||
$(ASM_CMD) $(ASM_CFG) $<
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Default target: configuration files & library (in that order)
|
||||
#---------------------------------------------------------------------------
|
||||
all: $(LIB_DIR)\$(PROJ_NAME).lib .SYMBOLIC
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Build the library
|
||||
# The original library is deleted by the librarian
|
||||
# Lib objects & -+ commands are constructed by substituting within the
|
||||
# $^@ macro (which expands to all target dependents, separated with
|
||||
# spaces)
|
||||
# Tlib's cfg file is not invoked as a response file.
|
||||
# All headers & source files are copied into WWFLAT\SRCDEBUG, for debugging
|
||||
#---------------------------------------------------------------------------
|
||||
$(LIB_DIR)\$(PROJ_NAME).lib: $(OBJECTS) objects.lbc
|
||||
copy *.h $(%WWFLAT)\include
|
||||
copy *.inc $(%WWFLAT)\include
|
||||
copy *.cpp $(%WWFLAT)\srcdebug
|
||||
copy *.asm $(%WWFLAT)\srcdebug
|
||||
$(LIB_CMD) $(LIB_CFG) $^@ @objects.lbc
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Objects now have a link file which is NOT generated everytime. Instead
|
||||
# it just has its own dependacy rule.
|
||||
#---------------------------------------------------------------------------
|
||||
objects.lbc : $(OBJECTS)
|
||||
%create $^@
|
||||
for %index in ($(OBJECTS)) do %append $^@ +%index
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# The keyboard object files is also dependant on an IBN file which is
|
||||
# generated from KEYIREAL.ASM
|
||||
#---------------------------------------------------------------------------
|
||||
vesareal.ibn: vesareal.obj
|
||||
%create $^*.rsp
|
||||
%append $^*.rsp $^&.obj
|
||||
%append $^*.rsp $^&.exe
|
||||
%append $^*.rsp $^&.map
|
||||
tlink @$^*.rsp
|
||||
tdstrip vesareal.exe
|
||||
ebn vesareal.exe
|
||||
|
||||
vesareal.obj: vesareal.asm
|
||||
tasm /zn /la /ml /m2 vesareal.asm
|
||||
|
||||
vesahook.obj: vesareal.ibn vesahook.asm
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Create the test directory and make it.
|
||||
#---------------------------------------------------------------------------
|
||||
test:
|
||||
mkdir test
|
||||
cd test
|
||||
copy $(%WWVCS)\$(PROJ_NAME)\test\vcs.cfg
|
||||
update
|
||||
wmake
|
||||
cd ..
|
||||
|
||||
#**************************** End of makefile ******************************
|
||||
|
139
WWFLAT32/VIDEO/VERTBLNK.ASM
Normal file
139
WWFLAT32/VIDEO/VERTBLNK.ASM
Normal file
@@ -0,0 +1,139 @@
|
||||
;
|
||||
; 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/>.
|
||||
;
|
||||
|
||||
; $Header: g:/library/wwlib32/video/rcs/vertblnk.asm 1.1 1994/04/18 09:34:51 jeff_wilson Exp $
|
||||
;***************************************************************************
|
||||
;** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
|
||||
;***************************************************************************
|
||||
;* *
|
||||
;* Project Name : Library routine *
|
||||
;* *
|
||||
;* File Name : VERTBLNK.ASM *
|
||||
;* *
|
||||
;* Programmer : Christopher Yates *
|
||||
;* *
|
||||
;* Last Update : 20 August, 1990 [CY] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* *
|
||||
; WORD Get_Vert_Blank(VOID); *
|
||||
; VOID Wait_Vert_Blank(VOID); *
|
||||
; WORD get_vga_state (VOID) ;
|
||||
; VOID set_vga_mode (WORD) ;
|
||||
;* *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
LOCALS ??
|
||||
|
||||
GLOBAL Get_Vert_Blank : NEAR
|
||||
GLOBAL Wait_Vert_Blank : NEAR
|
||||
GLOBAL get_vga_state : NEAR
|
||||
GLOBAL set_vga_mode : NEAR
|
||||
|
||||
|
||||
CODESEG
|
||||
|
||||
; ----------------------------------------------------------------
|
||||
;
|
||||
; Here are prototypes for the routines defined within this module:
|
||||
;
|
||||
; WORD Get_Vert_Blank(VOID);
|
||||
; VOID Wait_Vert_Blank(VOID);
|
||||
; WORD get_vga_state (VOID) ;
|
||||
; VOID set_vga_mode (WORD) ;
|
||||
|
||||
;
|
||||
; ----------------------------------------------------------------
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
||||
PROC Get_Vert_Blank C near
|
||||
USES edx
|
||||
|
||||
mov dx,03DAH ; CRTC status register
|
||||
in al,dx
|
||||
and al,008H ; look at bit 3 vertical sync
|
||||
xor ah,ah ; zero ah
|
||||
ret
|
||||
|
||||
ENDP Get_Vert_Blank
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
PROC Wait_Vert_Blank C near
|
||||
USES eax,ebx,edx
|
||||
ARG blank:DWORD
|
||||
|
||||
mov ebx,[blank] ; get vertical blank 0 or 1 for on
|
||||
|
||||
mov edx,03DAH ; CRTC status register
|
||||
|
||||
and bl,01b
|
||||
shl bl,3
|
||||
|
||||
??in_vbi:
|
||||
in al,dx ; read CRTC status
|
||||
and al,008h ; only vertical sync bit
|
||||
xor al,bl
|
||||
je ??in_vbi ; in vertical sync
|
||||
|
||||
??out_vbi:
|
||||
in al,dx ; read CRTC status
|
||||
and al,008h ; only vertical sync bit
|
||||
xor al,bl
|
||||
jne ??out_vbi ; not in vertical sync
|
||||
|
||||
ret
|
||||
|
||||
ENDP Wait_Vert_Blank
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
||||
; WORD get_vga_state (VOID) ;
|
||||
|
||||
PROC get_vga_state C near
|
||||
USES ebx
|
||||
mov eax,0f00h
|
||||
int 10h
|
||||
and eax, 0ffh
|
||||
ret
|
||||
ENDP get_vga_state
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
||||
; VOID set_vga_mode (WORD) ;
|
||||
|
||||
PROC set_vga_mode C near
|
||||
ARG mode:dword
|
||||
mov eax , [mode]
|
||||
and eax , 0ffh
|
||||
int 10h
|
||||
ret
|
||||
ENDP set_vga_mode
|
||||
|
||||
|
||||
|
||||
END
|
||||
|
||||
|
207
WWFLAT32/VIDEO/VESAHOOK.ASM
Normal file
207
WWFLAT32/VIDEO/VESAHOOK.ASM
Normal file
@@ -0,0 +1,207 @@
|
||||
;
|
||||
; 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 **
|
||||
;***************************************************************************
|
||||
;* *
|
||||
;* Project Name : Vesa Hookup *
|
||||
;* *
|
||||
;* *
|
||||
;* Programmer : Julio R. Jerez *
|
||||
;* *
|
||||
;* Start Date : Jan 31, 1995 *
|
||||
;* *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
|
||||
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
INCLUDE "svgaprim.inc"
|
||||
|
||||
|
||||
DPMI_INTR equ 031h
|
||||
|
||||
|
||||
LOCALS ??
|
||||
|
||||
;//////////////////////////////////////////////////////////////////////////////////////
|
||||
;/////////////////////////////////// Prototypes //////////////////////////////////////
|
||||
|
||||
GLOBAL RMVesaVector : DWORD
|
||||
GLOBAL RMVesaRegs : DWORD
|
||||
GLOBAL RMVesaVectorSel : DWORD
|
||||
GLOBAL Vesa_Hook : NEAR
|
||||
GLOBAL Remove_Vesa : NEAR
|
||||
GLOBAL VesaFunc : dword
|
||||
|
||||
;//////////////////////////////////////////////////////////////////////////////////////
|
||||
;//////////////////////////////////////// Data ////////////////////////////////////////
|
||||
DATASEG
|
||||
|
||||
; The current time we will just include the real mode stuff
|
||||
; into the protected mode code and then copy it down. The C side of
|
||||
; this will handle this method or reading it off of disk in the real
|
||||
; method.
|
||||
|
||||
LABEL RealDataStart BYTE
|
||||
include "VesaReal.ibn"
|
||||
LABEL RealDataEnd BYTE
|
||||
|
||||
RMVesaVectorSel DD 0
|
||||
|
||||
;//////////////////////////////////////////////////////////////////////////////////////
|
||||
;//////////////////////////////////////// Code ////////////////////////////////////////
|
||||
|
||||
CODESEG
|
||||
|
||||
PROC Vesa_Hook C Near
|
||||
USES ebx,ecx,edx,ecx,edi,esi
|
||||
ARG vesa_ptr:DWORD
|
||||
|
||||
; Are they attempting to set timer again?
|
||||
cmp [RMVesaVectorSel],0
|
||||
jnz ??exit
|
||||
|
||||
; now allocate real mode memory and copy the rm binary down to it.
|
||||
mov eax,0100h ; set function number
|
||||
lea ebx , [RealDataEnd]
|
||||
sub ebx , offset RealDataStart
|
||||
push ebx
|
||||
|
||||
add ebx , 15 + 040h
|
||||
shr ebx,4 ; convert to pages.
|
||||
int DPMI_INTR ; do call.
|
||||
pop ecx
|
||||
jc ??error ; check for error.
|
||||
|
||||
; set up source and destination pointers for the copy.
|
||||
shl edx , 16
|
||||
mov [ RMVesaVectorSel ] , edx
|
||||
shl eax,4 ; convert segment to offset.
|
||||
|
||||
mov edi , ecx
|
||||
xor esi , esi
|
||||
|
||||
; push ecx
|
||||
; push eax
|
||||
; mov ecx , eax
|
||||
; shld ebx,ecx,16
|
||||
; mov eax,0600h ; function number.
|
||||
; int DPMI_INTR ; do call.
|
||||
; pop eax
|
||||
; pop ecx
|
||||
; jc ??error ; eax = 8 if mem err, eax = 9 if invalid mem region.
|
||||
|
||||
lea esi , [ RealDataStart]
|
||||
lea edi , [ eax + 040h ] ; put it into esi for copy.
|
||||
rep movsb ; write RM bin to RM memory.
|
||||
|
||||
mov edx,[vesa_ptr] ; Setup vesa funtion
|
||||
mov [ eax + 40h - 4 ] , edx
|
||||
|
||||
|
||||
; Chain the Real Vesa funcion interrupt to any avilable
|
||||
; Interrupt vector so We make sure that the Real Mode
|
||||
; Keyboard Interrupt service get called at debuging time
|
||||
; of the library.
|
||||
|
||||
mov [ RMVesaRegs ] , eax
|
||||
shl eax , 12
|
||||
lea edi , [ eax + 040h ] ; ofsset of VesaFunc
|
||||
mov bl , 060h
|
||||
mov bh , 6
|
||||
mov eax , 200h
|
||||
??find:
|
||||
int DPMI_INTR
|
||||
jc ??error
|
||||
or cx,dx
|
||||
jz ??found
|
||||
inc bl
|
||||
dec bh
|
||||
jnz ??find
|
||||
jmp ??error
|
||||
??found:
|
||||
mov eax , 0201h
|
||||
mov edx , edi
|
||||
shld ecx , edx , 16
|
||||
and ebx , 0ffh
|
||||
mov [ RMVesaVector ] , ebx
|
||||
int DPMI_INTR
|
||||
jc ??error
|
||||
|
||||
??exit:
|
||||
xor eax,eax ; signal an error.
|
||||
ret
|
||||
??error:
|
||||
mov eax , -1
|
||||
ret
|
||||
ENDP
|
||||
|
||||
|
||||
|
||||
PROC Remove_Vesa C Near
|
||||
USES ebx,ecx,edx,ecx,edi,esi
|
||||
ARG vesa_ptr:DWORD
|
||||
|
||||
|
||||
; Are they attempting to set timer again?
|
||||
mov [VesaFunc],0
|
||||
cmp [RMVesaVectorSel],0
|
||||
jz ??exit
|
||||
|
||||
mov ebx , [ RMVesaVector ]
|
||||
test ebx , ebx
|
||||
jz ??exit
|
||||
mov eax , 0201h
|
||||
xor edx , edx
|
||||
xor ecx , ecx
|
||||
int DPMI_INTR
|
||||
mov [ RMVesaVector ] , 0
|
||||
jc ??exit
|
||||
|
||||
; mov eax , 0601h
|
||||
; mov ecx , [ RMVesaRegs ]
|
||||
; shld ebx , ecx , 16
|
||||
; lea edi , [RealDataEnd]
|
||||
; sub edi , offset RealDataStart
|
||||
; add edi , 15 + 040h
|
||||
; xor esi , esi
|
||||
; int DPMI_INTR
|
||||
; jc ??exit
|
||||
|
||||
mov eax,0101h ; set function number
|
||||
mov edx ,[RMVesaVectorSel]
|
||||
test edx , edx
|
||||
jz ??exit
|
||||
shr edx , 16
|
||||
int DPMI_INTR ; do call.
|
||||
mov [RMVesaVectorSel],0
|
||||
??exit:
|
||||
ret
|
||||
ENDP
|
||||
|
||||
|
||||
END
|
||||
|
||||
|
||||
|
213
WWFLAT32/VIDEO/VESAINFO.CPP
Normal file
213
WWFLAT32/VIDEO/VESAINFO.CPP
Normal file
@@ -0,0 +1,213 @@
|
||||
/*
|
||||
** 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 A S S O C I A T E S **
|
||||
***************************************************************************
|
||||
* *
|
||||
* Project Name : LIBRARY *
|
||||
* *
|
||||
* File Name : VIDEO.C *
|
||||
* *
|
||||
* Programmer : David Dettmer *
|
||||
* *
|
||||
* Last Update : January 12, 1995 [PWG] *
|
||||
* *
|
||||
*-------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* Find_Video_Mode -- Converts a dos video mode to a WWLIB video mode *
|
||||
* Get_Video_Mode -- Returns the current video mode. *
|
||||
* Set_Video_Mode -- Sets the requested video mode *
|
||||
* Set_Lores_Function_Pointers -- Sets up the lowres function pointers *
|
||||
* Set_HiRes_Function_Pointers -- Sets the HiRes function pointers *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#include <dos.h>
|
||||
#include "iostream.h"
|
||||
#include "video.h"
|
||||
#include "descmgmt.h"
|
||||
#include "mcgaprim.h"
|
||||
#include "gbuffer.h"
|
||||
#include "vbuffer.h"
|
||||
#include "wwmem.h"
|
||||
|
||||
#include "playcd.h"
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* VESA_INFO -- Debug routine which displays vesa info to stdout *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/22/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
void Vesa_Info(int vesa_mode)
|
||||
{
|
||||
UINT paras;
|
||||
USHORT longest ;
|
||||
union REGS regs;
|
||||
struct SREGS sregs;
|
||||
SEGSEL VInfoSel ;
|
||||
VesaInfoType * VInfo ;
|
||||
SEGSEL ModeInfoSel ;
|
||||
VesaModeInfoType * ModeInfo ;
|
||||
unsigned temp ;
|
||||
short * ptr ;
|
||||
char buff [ 256 ] ;
|
||||
short mode_table [][4] = { { 0x100 , 640 , 400 , 256 },
|
||||
{ 0x101 , 640 , 480 , 256 },
|
||||
{ 0x103 , 800 , 600 , 256 },
|
||||
} ;
|
||||
|
||||
cout << "\n\nWWESTWOOD STUDIOS. Vesa Driver attributes.\n" ;
|
||||
|
||||
// verifie that this is a standard VESA MODE
|
||||
if ( (vesa_mode < VESA_640X400_256) || ( vesa_mode > VESA_TEXT_132X60 )) {
|
||||
cout << "this is not a standard VESA mode\n" ;
|
||||
return ;
|
||||
}
|
||||
|
||||
// Compute size of VesaInfo structure in paragraphs
|
||||
paras = ( sizeof(VesaInfoType) + 15 ) >> 4 ;
|
||||
|
||||
// Alloc real-mode memory for VESA structure.
|
||||
if ( DPMI_real_alloc ( paras , & VInfoSel , & longest ) ) return ;
|
||||
VInfo = ( VesaInfoType * ) ( VInfoSel . seg << 4 ) ;
|
||||
|
||||
// Compute size of VesaModeInfo structure in paragraphs
|
||||
paras = ( sizeof(VesaModeInfoType) + 15 ) >> 4 ;
|
||||
|
||||
//Alloc real-mode memory for VesaModeInfoType structure.
|
||||
if ( DPMI_real_alloc ( paras , & ModeInfoSel , & longest ) )
|
||||
{
|
||||
DPMI_real_free ( VInfoSel ) ;
|
||||
return ;
|
||||
}
|
||||
ModeInfo = ( VesaModeInfoType * ) ( ModeInfoSel . seg << 4 ) ;
|
||||
|
||||
// Get Read Vesa Driver Vesa
|
||||
regs . x . eax = 0x4f00 ;
|
||||
regs . x . edi = 0 ;
|
||||
sregs . es = VInfoSel . seg ;
|
||||
DPMI_real_intr ( 0x10 , & regs , & sregs );
|
||||
|
||||
regs . x . eax &= 0xffff ;
|
||||
if ( regs . x . eax != 0x004F) {
|
||||
cout << "\nNot Vesa Driver Present\n" ;
|
||||
DPMI_real_free ( ModeInfoSel ) ;
|
||||
DPMI_real_free ( VInfoSel ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
temp = ( unsigned ) VInfo->AvailModes ;
|
||||
ptr = ( short * ) ( ( ( temp & 0xffff0000 ) >> 12 ) + ( temp & 0xffff ) ) ;
|
||||
cout << "Available Video Modes\n" ;
|
||||
for ( ; * ptr != -1 ; ptr ++ )
|
||||
for ( temp = 0 ; temp < 3 ; temp ++ )
|
||||
if ( * ptr == mode_table [ temp ] [ 0 ] ) {
|
||||
sprintf ( buff , "%d\t%d x %d x %d\n" ,
|
||||
mode_table [ temp ] [ 0 ],
|
||||
mode_table [ temp ] [ 1 ],
|
||||
mode_table [ temp ] [ 2 ],
|
||||
mode_table [ temp ] [ 3 ] ) ;
|
||||
cout << buff ;
|
||||
}
|
||||
|
||||
// Get Info for this particular graphic mode
|
||||
regs . x . eax = 0x4F01;
|
||||
regs . x . ecx = vesa_mode;
|
||||
regs . x . edi = 0 ;
|
||||
sregs . es = ModeInfoSel . seg ;
|
||||
DPMI_real_intr ( 0x10 , & regs , & sregs );
|
||||
regs . x . eax &= 0xffff ;
|
||||
if ( regs . x . eax != 0x004F) {
|
||||
cout << "\nGraphic mode " << vesa_mode << " is not supported by this video card\n" ;
|
||||
DPMI_real_free ( ModeInfoSel ) ;
|
||||
DPMI_real_free ( VInfoSel ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
cout << "\nMode attributes\n" ;
|
||||
temp = ( unsigned ) ModeInfo->Attributes ;
|
||||
if ( temp & 0x01 ) cout << "\tMode supported in hardware\n" ;
|
||||
else cout << "\tMode is not supported in hardware\n" ;
|
||||
if ( temp & 0x20 ) cout << "\tMode is not VGA Windowed memory compatible\n" ;
|
||||
else cout << "\tMode is VGA Windowed memory compatible\n" ;
|
||||
|
||||
cout << "Window A attributes\n" ;
|
||||
temp = ( unsigned ) ModeInfo->WinA_Attributes; ;
|
||||
if ( temp & 0x02 ) cout << "\tWindow A is Readable\n" ;
|
||||
else cout << "\tWindow A is not Readable\n" ;
|
||||
if ( temp & 0x04 ) cout << "\tWindow A is Writeable\n" ;
|
||||
else cout << "\tWindow A is not Writeable\n" ;
|
||||
sprintf ( buff , "%P\n" , ModeInfo->WinA_Segment ) ;
|
||||
cout << "\tWindow A segment address 0x" << buff + 4 ;
|
||||
|
||||
|
||||
|
||||
cout << "Window B attributes\n" ;
|
||||
temp = ( unsigned ) ModeInfo->WinB_Attributes; ;
|
||||
if ( temp & 0x02 ) cout << "\tWindow B is Readable\n" ;
|
||||
else cout << "\tWindow B is not Readable\n" ;
|
||||
if ( temp & 0x04 ) cout << "\tWindow B is Writeable\n" ;
|
||||
else cout << "\tWindow B is not Writeable\n" ;
|
||||
sprintf ( buff , "%P\n" , ModeInfo->WinB_Segment ) ;
|
||||
cout << "\tWindow B segment address 0x" << buff + 4 ;
|
||||
|
||||
cout << "Window shared attributes\n" ;
|
||||
cout << "\tWindow Granularity (KB) :" << ModeInfo->WinGranularity << "\n" ;
|
||||
cout << "\tWindow Size (KB) : " << ModeInfo->WinSize << "\n";
|
||||
cout << "\tNumber of Banks : " << (long)ModeInfo->NumBanks << "\n";
|
||||
cout << "\tBytes per ScanLine : " << (long)ModeInfo->BytesPerScanline << "\n";
|
||||
cout << "\tXResolution : " << (long)ModeInfo->XRes << "\n";
|
||||
cout << "\tYResolution : " << (long)ModeInfo->YRes << "\n";
|
||||
cout << "\tX Char Size : " << (long)ModeInfo->XCharSize << "\n";
|
||||
cout << "\tY Char Size : " << (long)ModeInfo->YCharSize << "\n";
|
||||
cout << "\tMemory Model : " << (long)ModeInfo->MemoryModel << "\n";
|
||||
cout << "\tNumber of planes : " << (long)ModeInfo->NumPlanes << "\n" ;
|
||||
cout << "\tBits per pixels : " << (long)ModeInfo->BitsPerPixel << "\n" ;
|
||||
|
||||
|
||||
/*
|
||||
cout << "Bttributes: " << (long)ModeInfo.Bttributes << "\n"
|
||||
<< "Win B Bttributes: " << (long)ModeInfo.WinB_Bttributes << "\n"
|
||||
<< "Win B Bttributes: " << (long)ModeInfo.WinB_Bttributes << "\n"
|
||||
<< "Win Granularity " << (long)ModeInfo.WinGranularity << "\n"
|
||||
<< "Win Size: " << (long)ModeInfo.WinSize << "\n"
|
||||
<< "Win B Segment: " << hex << (unsigned short)ModeInfo.WinB_Segment << "\n"
|
||||
<< "Win B Segment: " << (unsigned short)ModeInfo.WinB_Segment << "\n"
|
||||
<< "Bytes per scan line: " << dec << (unsigned short)ModeInfo.BytesPerScanline << "\n"
|
||||
<< "X resolution: " << (long)ModeInfo.XRes << "\n"
|
||||
<< "Y resolution: " << (long)ModeInfo.YRes << "\n"
|
||||
<< "X Char Size: " << (long)ModeInfo.XCharSize << "\n"
|
||||
<< "Y Char Size: " << (long)ModeInfo.YCharSize << "\n"
|
||||
<< "Number of planes: " << (long)ModeInfo.NumPlanes << "\n"
|
||||
<< "Bits per pixels: " << (long)ModeInfo.BitsPerPixel << "\n"
|
||||
<< "Number of Banks: " << (long)ModeInfo.NumBanks << "\n"
|
||||
<< "Memory Model: " << (long)ModeInfo.MemoryModel << "\n"
|
||||
<< "Bank Size: " << (long)ModeInfo.BankSize << "\n";
|
||||
*/
|
||||
DPMI_real_free ( ModeInfoSel ) ;
|
||||
DPMI_real_free ( VInfoSel ) ;
|
||||
}
|
55
WWFLAT32/VIDEO/VESAREAL.ASM
Normal file
55
WWFLAT32/VIDEO/VESAREAL.ASM
Normal 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/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** 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 **
|
||||
;***************************************************************************
|
||||
;* *
|
||||
;* Project Name : Timer interrupt for RM *
|
||||
;* *
|
||||
;* File Name : TIMEREAL.ASM *
|
||||
;* *
|
||||
;* Programmer : Julio R. Jerez *
|
||||
;* *
|
||||
;* Start Date : jan 31 , 1995 *
|
||||
;* *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
IDEAL
|
||||
MODEL TINY
|
||||
P386N
|
||||
|
||||
|
||||
|
||||
LOCALS ??
|
||||
|
||||
CODESEG
|
||||
;///////////////////////////////////// Code ////////////////////////////////////////
|
||||
|
||||
label Vesa_Funcion_Call
|
||||
start:
|
||||
call [dword ptr cs: 40h - 4]
|
||||
iret
|
||||
|
||||
|
||||
|
||||
END
|
||||
|
1
WWFLAT32/VIDEO/VESAREAL.IBN
Normal file
1
WWFLAT32/VIDEO/VESAREAL.IBN
Normal file
@@ -0,0 +1 @@
|
||||
DB 02Eh,0FFh,01Eh,03Ch,000h,0CFh
|
651
WWFLAT32/VIDEO/VIDEO.CPP
Normal file
651
WWFLAT32/VIDEO/VIDEO.CPP
Normal file
@@ -0,0 +1,651 @@
|
||||
/*
|
||||
** 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 A S S O C I A T E S **
|
||||
***************************************************************************
|
||||
* *
|
||||
* Project Name : LIBRARY *
|
||||
* *
|
||||
* File Name : VIDEO.C *
|
||||
* *
|
||||
* Programmer : David Dettmer *
|
||||
* *
|
||||
* Last Update : June 29, 1995 [PWG] *
|
||||
* *
|
||||
*-------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* Find_Video_Mode -- Converts a dos video mode to a WWLIB video mode *
|
||||
* Get_Video_Mode -- Returns the current video mode. *
|
||||
* Set_Video_Mode -- Sets the requested video mode *
|
||||
* Set_Lores_Function_Pointers -- Sets up the lowres function pointers *
|
||||
* Set_HiRes_Function_Pointers -- Sets the HiRes function pointers *
|
||||
* Set_Original_Video_Mode -- sets mode to restore system to on exit *
|
||||
* Get_Original_Video_Mode -- Gets the original video mode value *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#include <dos.h>
|
||||
#include "iostream.h"
|
||||
#include "video.h"
|
||||
#include "descmgmt.h"
|
||||
#include "mcgaprim.h"
|
||||
#include "gbuffer.h"
|
||||
#include "vbuffer.h"
|
||||
#include "wwmem.h"
|
||||
|
||||
#include "playcd.h"
|
||||
|
||||
extern "C" int MInstalled ;
|
||||
extern "C" void Hide_Mouse(void);
|
||||
extern "C" void Show_Mouse(void);
|
||||
|
||||
extern "C" void Reset_Mouse (void) ;
|
||||
extern "C" int Vesa_Hook ( REALPTR function ) ;
|
||||
extern "C" void Remove_Vesa (void) ;
|
||||
extern "C" SEGSEL RMVesaVectorSel ;
|
||||
extern "C" REALPTR VesaFunc;
|
||||
|
||||
/*=========================================================================*/
|
||||
/* Define the global variables that we require. */
|
||||
/*=========================================================================*/
|
||||
long BankTable[MAX_BANK_ENTRIES];
|
||||
int GraphicMode = UNINITIALIZED_MODE;
|
||||
long XRes = 0;
|
||||
long YRes = 0;
|
||||
REALPTR VesaFunc;
|
||||
unsigned long RMVesaVector ;
|
||||
unsigned long RMVesaRegs ;
|
||||
|
||||
/*=========================================================================*
|
||||
* Private Varirables *
|
||||
* *
|
||||
* VInfo - Protected mode copy of VInfo structure. *
|
||||
* ModeInfo - Protected mode copy of ModeInfo structure. *
|
||||
* rpModeInfo - Real ptr to ModeInfo structure in conventional memory. *
|
||||
* rpVInfo - Real ptr to VInfo structure in conventional memory. *
|
||||
* _regs - Registers used for calling software interrupts. *
|
||||
*=========================================================================*/
|
||||
PRIVATE void * rpModeInfo = NULL;
|
||||
PRIVATE SEGSEL rpModeInfoSel ;
|
||||
PRIVATE void * rpVInfo = NULL;
|
||||
PRIVATE SEGSEL rpVInfoSel ;
|
||||
|
||||
PRIVATE long _OriginalVideoMode = UNINITIALIZED_MODE;
|
||||
PRIVATE VesaInfoType VInfo;
|
||||
PRIVATE VesaModeInfoType ModeInfo;
|
||||
|
||||
|
||||
/*=========================================================================*/
|
||||
/* The following PRIVATE functions are in this file: */
|
||||
/*=========================================================================*/
|
||||
|
||||
PRIVATE long Install_Vesa(void);
|
||||
PRIVATE long Vesa_Get_Mode_Info(long mode);
|
||||
PRIVATE long Vesa_Set_Mode(long mode);
|
||||
PRIVATE void Init_Bank_Table(void);
|
||||
PRIVATE VOID Set_LoRes_Function_Pointers(VOID);
|
||||
PRIVATE VOID Set_HiRes_Function_Pointers(VOID);
|
||||
|
||||
extern "C" long Vesa_XRes(void);
|
||||
extern "C" long Vesa_YRes(void);
|
||||
|
||||
extern "C" char CurrentPalette [ 256 * 3 ] ;
|
||||
extern "C" char PaletteTable [ 1024 ] ;
|
||||
|
||||
/*= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
|
||||
|
||||
/***************************************************************************
|
||||
* GET_VIDEO_MODE -- Returns the current video mode. *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: returns the graphic mode as a WWLIB library define *
|
||||
* *
|
||||
* WARNINGS: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/25/1994 : Created. *
|
||||
*=========================================================================*/
|
||||
int Get_Video_Mode(void)
|
||||
{
|
||||
union REGS regs;
|
||||
|
||||
if( GraphicMode == UNINITIALIZED_MODE )
|
||||
{
|
||||
regs . x . eax = 0xf00 ; // get graphic mode
|
||||
int386 ( 0x10 , & regs , & regs ) ;
|
||||
return ( regs . w . ax & 0xff ) ;
|
||||
}
|
||||
return(GraphicMode); // return the graphic mode
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Install_Vesa -- Initializes the vesa driver if it exists *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: return -1 if error/VESA not supported. *
|
||||
* *
|
||||
* WARNINGS: This function will not work unless a vesa compatable driver *
|
||||
* is installed in either hardware or software. *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/21/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
PRIVATE long Install_Vesa(void)
|
||||
{
|
||||
UINT paras;
|
||||
USHORT longest ;
|
||||
union REGS regs;
|
||||
struct SREGS sregs;
|
||||
|
||||
/* Calculate size of VesaInfo structure in paragraphs */
|
||||
paras = ( sizeof(VesaInfoType) + 15 ) >> 4 ;
|
||||
|
||||
/* Allocate real-mode memory for VESA structure. */
|
||||
if ( DPMI_real_alloc ( paras , & rpVInfoSel , & longest ) ) return - 1 ;
|
||||
rpVInfo = ( void * ) ( rpVInfoSel . seg << 4 ) ;
|
||||
|
||||
/* Calculate size of VesaModeInfo structure in paragraphs */
|
||||
paras = ( sizeof(VesaModeInfoType) + 15 ) >> 4 ;
|
||||
|
||||
/* Allocate real-mode memory for VESA structure. */
|
||||
if ( DPMI_real_alloc ( paras , & rpModeInfoSel , & longest ) )
|
||||
{
|
||||
Remove_Vesa();
|
||||
return (-1);
|
||||
}
|
||||
rpModeInfo = ( void * ) ( rpModeInfoSel . seg << 4 ) ;
|
||||
|
||||
/* Clear the input buffer */
|
||||
memset ( rpVInfo , 0 , sizeof ( VesaInfoType) ) ;
|
||||
|
||||
|
||||
/* Read Vesa information */
|
||||
regs . x . eax = 0x4f00 ;
|
||||
regs . x . edi = 0 ;
|
||||
sregs . es = rpVInfoSel . seg ;
|
||||
DPMI_real_intr ( 0x10 , & regs , & sregs );
|
||||
|
||||
regs . x . eax &= 0xffff ;
|
||||
if ( regs . x . eax != 0x004F) return (-1);
|
||||
Mem_Copy ( rpVInfo , & VInfo , sizeof(VesaInfoType)) ;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* VESA_GET_MODE_INFO -- Gets info about specified video mode *
|
||||
* *
|
||||
* INPUT: long - the mode we are requesting info about *
|
||||
* *
|
||||
* OUTPUT: long - 0 if sucessful, -1 if failure *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/21/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
PRIVATE long Vesa_Get_Mode_Info(long mode)
|
||||
{
|
||||
union REGS regs;
|
||||
struct SREGS sregs;
|
||||
|
||||
if (rpModeInfo )
|
||||
{
|
||||
/* Clear the input buffer */
|
||||
memset ( rpModeInfo, 0, sizeof(VesaModeInfoType));
|
||||
|
||||
/* Set up function call */
|
||||
regs . x . eax = 0x4F01;
|
||||
regs . x . ecx = mode;
|
||||
regs . x . edi = 0 ;
|
||||
sregs . es = rpModeInfoSel . seg ;
|
||||
DPMI_real_intr ( 0x10 , & regs , & sregs );
|
||||
|
||||
regs . x . eax &= 0xffff ;
|
||||
if ( regs . x . eax == 0x004F)
|
||||
{
|
||||
Mem_Copy ( rpModeInfo , &ModeInfo , sizeof(VesaModeInfoType));
|
||||
|
||||
// this part is only temporary until Phil get the documentation
|
||||
// for DPMI funtion 0x301 simulate real call
|
||||
// in the mean time we will be making call to the vesa driver
|
||||
// thru a real interrupt
|
||||
if ( Vesa_Hook ( ModeInfo . WinFunc ) ) return ( -1 ) ;
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* VESA_SET_MODE -- Sets the specified Vesa mode *
|
||||
* *
|
||||
* INPUT: long - the mode we wish to set *
|
||||
* *
|
||||
* OUTPUT: long - 0 if all is ok, -1 if we cannot set this mode *
|
||||
* *
|
||||
* WARNINGS: You must call Install_Vesa before calling Vesa_Set_Mode *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/21/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
PRIVATE long Vesa_Set_Mode(long mode)
|
||||
{
|
||||
union REGS regs;
|
||||
struct SREGS sregs;
|
||||
|
||||
/* Get mode info */
|
||||
if ( Vesa_Get_Mode_Info(mode) ) return (-1) ;
|
||||
|
||||
if ((ModeInfo.Attributes & 0x01) == 0) return (-1);
|
||||
|
||||
/* Set vesa VIDEO MODE */
|
||||
regs . x . eax = 0x4F02; //
|
||||
regs . x . ebx = mode;
|
||||
int386 ( 0x10 , & regs , & regs ) ;
|
||||
// delay ( 1000 ) ;
|
||||
|
||||
if ( VInfo . Capabilities & 1 )
|
||||
{
|
||||
/* Set DAC to 6 bit per color register */
|
||||
regs . x . eax = 0x4F08;
|
||||
regs . h . bl = 0;
|
||||
regs . h . bh = 6 ;
|
||||
int386 ( 0x10 , & regs , & regs ) ;
|
||||
// delay ( 1000 ) ;
|
||||
}
|
||||
|
||||
regs . x . eax &= 0xffff ;
|
||||
if ( regs . x . eax != 0x004F) return (-1);
|
||||
|
||||
Init_Bank_Table();
|
||||
return (0);
|
||||
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* VESA_XRES -- Returns horizontal resolution of vesa mode *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: long - the horizontal resolution of vesa mode *
|
||||
* *
|
||||
* WARNINGS: You must call Install_Vesa and Vesa_Set_Mode before calling *
|
||||
* Vesa_XRes(). *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/21/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
long Vesa_XRes(void)
|
||||
{
|
||||
return ((long)ModeInfo.XRes);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* VESA_YRES -- Returns vertical resolution of a vesa mode *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: long - the horizontal resolution of vesa mode *
|
||||
* *
|
||||
* WARNINGS: You must call Install_Vesa and Vesa_Set_Mode before calling *
|
||||
* Vesa_XRes(). *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/21/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
long Vesa_YRes(void)
|
||||
{
|
||||
return ((long)ModeInfo.YRes);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* INIT_BANK_TABLE -- Initializes the values in the bank table *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 12/02/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
PRIVATE void Init_Bank_Table(void)
|
||||
{
|
||||
long size,bankval;
|
||||
int num_banks,lp;
|
||||
union REGS regs;
|
||||
struct SREGS sregs;
|
||||
|
||||
|
||||
size = Vesa_XRes() * Vesa_YRes(); // get video mode size
|
||||
num_banks = size / 65536; // get number of banks
|
||||
|
||||
if (size % 65536) // adjust number of banks if
|
||||
num_banks++; // they dont break evenly
|
||||
|
||||
bankval = 64 / ModeInfo.WinGranularity;
|
||||
VesaFunc = ModeInfo.WinFunc;
|
||||
|
||||
for (lp = 0; lp < num_banks; lp++)
|
||||
BankTable[lp] = lp * bankval;
|
||||
|
||||
|
||||
regs . x . eax = 0x4F05; // Reset Vesa to Point to Bank 0
|
||||
regs . x . ebx = 0x0000;
|
||||
regs . x . edx = 0x0000;
|
||||
int386 ( 0x10 , & regs , & regs ) ;
|
||||
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* SET_MODE -- Used to set a graphic mode *
|
||||
* *
|
||||
* INPUT: int - the mode that we are setting *
|
||||
* *
|
||||
* OUTPUT: int - FALSE if failure, TRUE otherwise *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/21/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
int Set_Video_Mode(int mode)
|
||||
{
|
||||
union REGS inregs,outregs;
|
||||
static first_time = 0 ;
|
||||
int oldmode ;
|
||||
|
||||
/*======================================================================*/
|
||||
/* If this is the first time we have set the mode we need to store */
|
||||
/* of the original mode. */
|
||||
/*======================================================================*/
|
||||
if ( ! first_time ) {
|
||||
first_time = 1 ;
|
||||
Set_Original_Video_Mode(Get_Video_Mode());
|
||||
}
|
||||
|
||||
/*======================================================================*/
|
||||
/* If the mode we are trying to set is mode zero than we are actually */
|
||||
/* trying to restore the system to its original video mode. */
|
||||
/*======================================================================*/
|
||||
if (mode == RESET_MODE)
|
||||
mode = Get_Original_Video_Mode(); // set mode properly
|
||||
|
||||
if (mode == GraphicMode) // if mode already correct
|
||||
return(TRUE); // get out of here
|
||||
|
||||
oldmode = GraphicMode ;
|
||||
GraphicMode = mode ;
|
||||
|
||||
/**********************************************************************/
|
||||
/* make sure the mouse is term off before any change */
|
||||
/*********************************************************************/
|
||||
if ( MInstalled == TRUE ) Hide_Mouse () ;
|
||||
|
||||
|
||||
/* clear color palette */
|
||||
memset ( CurrentPalette , 255 , sizeof ( CurrentPalette ) ) ;
|
||||
memset ( PaletteTable , 0 , sizeof ( PaletteTable ) ) ;
|
||||
|
||||
/*======================================================================*/
|
||||
/* If we are currently in a vesa mode, free it up so that we can do it */
|
||||
/* again. */
|
||||
/*======================================================================*/
|
||||
if ((oldmode >= VESA_MIN) && (oldmode <= VESA_MAX))
|
||||
Remove_Vesa();
|
||||
|
||||
|
||||
/*======================================================================*/
|
||||
/* If we are requesting a vesa mode, than use the vesa calls to handle */
|
||||
/* it. */
|
||||
/*======================================================================*/
|
||||
if ( GraphicMode >= VESA_MIN && GraphicMode <= VESA_MAX)
|
||||
{
|
||||
inregs . x . eax = MCGA_MODE;
|
||||
int386 ( 0x10 , &inregs , &outregs);
|
||||
// delay ( 1000 ) ;
|
||||
|
||||
if ( Install_Vesa () != 0 ) {
|
||||
Set_Video_Mode(oldmode);
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
if (Vesa_Set_Mode(GraphicMode) != 0)
|
||||
{
|
||||
Set_Video_Mode(oldmode);
|
||||
return(FALSE);
|
||||
}
|
||||
XRes = Vesa_XRes();
|
||||
YRes = Vesa_YRes();
|
||||
Set_HiRes_Function_Pointers();
|
||||
}
|
||||
else
|
||||
{
|
||||
/*===================================================================*/
|
||||
/* If not a vesa mode, then handle that as well. */
|
||||
/*===================================================================*/
|
||||
inregs . x . eax = GraphicMode ;
|
||||
int386( 0x10, &inregs, &outregs);
|
||||
// delay ( 1000 ) ;
|
||||
|
||||
if ( GraphicMode == MCGA_MODE ) {
|
||||
XRes = 320;
|
||||
YRes = 200;
|
||||
Set_LoRes_Function_Pointers();
|
||||
}
|
||||
}
|
||||
if ( MInstalled == TRUE ) {
|
||||
Reset_Mouse () ;
|
||||
Show_Mouse () ;
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
/***************************************************************************
|
||||
* VESA_INFO -- Debug routine which displays vesa info to stdout *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* WARNINGS: Must call Install_Vesa before attempting to get the vesa *
|
||||
* info. *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/22/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
void Vesa_Info(void)
|
||||
{
|
||||
cout << "Attributes: " << (long)ModeInfo.Attributes << "\n"
|
||||
<< "Win A Attributes: " << (long)ModeInfo.WinA_Attributes << "\n"
|
||||
<< "Win B Attributes: " << (long)ModeInfo.WinB_Attributes << "\n"
|
||||
<< "Win Granularity " << (long)ModeInfo.WinGranularity << "\n"
|
||||
<< "Win Size: " << (long)ModeInfo.WinSize << "\n"
|
||||
<< "Win A Segment: " << hex << (unsigned short)ModeInfo.WinA_Segment << "\n"
|
||||
<< "Win B Segment: " << (unsigned short)ModeInfo.WinB_Segment << "\n"
|
||||
<< "Bytes per scan line: " << dec << (unsigned short)ModeInfo.BytesPerScanline << "\n"
|
||||
<< "X resolution: " << (long)ModeInfo.XRes << "\n"
|
||||
<< "Y resolution: " << (long)ModeInfo.YRes << "\n"
|
||||
<< "X Char Size: " << (long)ModeInfo.XCharSize << "\n"
|
||||
<< "Y Char Size: " << (long)ModeInfo.YCharSize << "\n"
|
||||
<< "Number of planes: " << (long)ModeInfo.NumPlanes << "\n"
|
||||
<< "Bits per pixels: " << (long)ModeInfo.BitsPerPixel << "\n"
|
||||
<< "Number of Banks: " << (long)ModeInfo.NumBanks << "\n"
|
||||
<< "Memory Model: " << (long)ModeInfo.MemoryModel << "\n"
|
||||
<< "Bank Size: " << (long)ModeInfo.BankSize << "\n";
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* VESA_SET_WINDOW -- Sets given vesa window to given grain *
|
||||
* *
|
||||
* INPUT: int window - 0 for window A, 1 for window B *
|
||||
* int grain - the granularity point for window *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 12/05/1994 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
void Vesa_Set_Window(long grain_num)
|
||||
{
|
||||
union REGS regs;
|
||||
struct SREGS sregs;
|
||||
|
||||
regs . x . eax = 0x4f05 ;
|
||||
regs . x . ebx = 0 ;
|
||||
regs . x . edx = grain_num;
|
||||
// DPMI_real_call ( ModeInfo.WinFunc , & regs , & sregs ) ;
|
||||
DPMI_real_intr ( VesaFunc , & regs , & sregs ) ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* SET_LORES_FUNCTION_POINTERS -- Sets up the lowres function pointers *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/12/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
PRIVATE VOID Set_LoRes_Function_Pointers(VOID)
|
||||
{
|
||||
VVPC_Clear_Func = MCGA_Clear;
|
||||
VVPC_To_Buffer_Func = MCGA_To_Buffer;
|
||||
VVPC_Put_Pixel_Func = MCGA_Put_Pixel;
|
||||
VVPC_Get_Pixel_Func = MCGA_Get_Pixel;
|
||||
GVPC_Blit_to_VVPC_Func = Linear_Blit_To_Linear;
|
||||
VVPC_Blit_to_GVPC_Func = Linear_Blit_To_Linear;
|
||||
VVPC_Blit_to_VVPC_Func = Linear_Blit_To_Linear;
|
||||
VVPC_Buffer_To_Page = MCGA_Buffer_To_Page;
|
||||
GVPC_Scale_To_VVPC = Linear_Scale_To_Linear;
|
||||
VVPC_Scale_To_GVPC = Linear_Scale_To_Linear;
|
||||
VVPC_Scale_To_VVPC = Linear_Scale_To_Linear;
|
||||
VVPC_Print_Func = MCGA_Print;
|
||||
}
|
||||
/***************************************************************************
|
||||
* SET_HIRES_FUNCTION_POINTERS -- Sets the HiRes function pointers *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 01/12/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
PRIVATE VOID Set_HiRes_Function_Pointers(VOID)
|
||||
{
|
||||
VVPC_Clear_Func = Vesa_Clear;
|
||||
VVPC_To_Buffer_Func = Vesa_To_Buffer;
|
||||
VVPC_Put_Pixel_Func = Vesa_Put_Pixel;
|
||||
VVPC_Get_Pixel_Func = Vesa_Get_Pixel;
|
||||
GVPC_Blit_to_VVPC_Func = Linear_Blit_To_Vesa;
|
||||
VVPC_Blit_to_GVPC_Func = Vesa_Blit_To_Linear;
|
||||
VVPC_Blit_to_VVPC_Func = Vesa_Blit_To_Vesa;
|
||||
VVPC_Buffer_To_Page = Vesa_Buffer_To_Page;
|
||||
GVPC_Scale_To_VVPC = Linear_Scale_To_Vesa;
|
||||
VVPC_Scale_To_GVPC = Vesa_Scale_To_Linear;
|
||||
VVPC_Scale_To_VVPC = Vesa_Scale_To_Vesa;
|
||||
VVPC_Print_Func = Vesa_Print;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Update_Video_Mode -- used to reprogram the current graphic mode afte *
|
||||
* a task swicthing from windows *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 03/18/94 JRJ : Created. *
|
||||
*=========================================================================*/
|
||||
void Update_Video_Mode (void)
|
||||
{
|
||||
union REGS inregs,outregs;
|
||||
|
||||
/* clear color palette */
|
||||
memset ( CurrentPalette , 255 , sizeof ( CurrentPalette ) ) ;
|
||||
memset ( PaletteTable , 0 , sizeof ( PaletteTable ) ) ;
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/* make sure the mouse is term off before any change */
|
||||
/*********************************************************************/
|
||||
if ( MInstalled == TRUE )
|
||||
Hide_Mouse () ;
|
||||
|
||||
/*======================================================================*/
|
||||
/* If we are requesting a vesa mode, than use the vesa calls to handle */
|
||||
/* it. */
|
||||
/*======================================================================*/
|
||||
if ( GraphicMode >= VESA_MIN && GraphicMode <= VESA_MAX) {
|
||||
inregs . x . eax = MCGA_MODE;
|
||||
int386 ( 0x10 , &inregs , &outregs);
|
||||
Vesa_Set_Mode(GraphicMode);
|
||||
}
|
||||
else {
|
||||
/*===================================================================*/
|
||||
/* If not a vesa mode, then handle that as well. */
|
||||
/*===================================================================*/
|
||||
inregs . x . eax = GraphicMode ;
|
||||
int386( 0x10, &inregs, &outregs);
|
||||
}
|
||||
if ( MInstalled == TRUE ) {
|
||||
Reset_Mouse () ;
|
||||
Show_Mouse () ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* SET_ORIGINAL_VIDEO_MODE -- sets mode to restore system to on exit *
|
||||
* *
|
||||
* INPUT: int video mode number *
|
||||
* *
|
||||
* OUTPUT: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/29/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
void Set_Original_Video_Mode(int mode)
|
||||
{
|
||||
_OriginalVideoMode = mode;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* GET_ORIGINAL_VIDEO_MODE -- Gets the original video mode value *
|
||||
* *
|
||||
* INPUT: none *
|
||||
* *
|
||||
* OUTPUT: int the video mode set when we entered *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 06/29/1995 PWG : Created. *
|
||||
*=========================================================================*/
|
||||
|
||||
int Get_Original_Video_Mode(void)
|
||||
{
|
||||
return(_OriginalVideoMode);
|
||||
}
|
213
WWFLAT32/VIDEO/VIDEO.H
Normal file
213
WWFLAT32/VIDEO/VIDEO.H
Normal file
@@ -0,0 +1,213 @@
|
||||
/*
|
||||
** 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 **
|
||||
***************************************************************************
|
||||
* *
|
||||
* Project Name : 32 bit library *
|
||||
* *
|
||||
* File Name : VIDEO.H *
|
||||
* *
|
||||
* Programmer : Scott K. Bowen *
|
||||
* *
|
||||
* Start Date : August 3, 1994 *
|
||||
* *
|
||||
* Last Update : August 3, 1994 [SKB] *
|
||||
* *
|
||||
*-------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifndef VIDEO_H
|
||||
#define VIDEO_H
|
||||
|
||||
#ifndef WWSTD_H
|
||||
#include "wwstd.h"
|
||||
#endif
|
||||
|
||||
/*=========================================================================*/
|
||||
/* The machine can be in one of the following graphic modes. The global */
|
||||
/* GraphicMode is set to one of these values. */
|
||||
/*=========================================================================*/
|
||||
#define CGA_MODE 4 // DOS 320x200 4 color mode
|
||||
#define TGA_MODE 9 // TANDY 320x200 16 color mode
|
||||
#define EGA_MODE 13 // DOS 320x200 16 color mode
|
||||
#define MCGA_MODE 0x13 // DOS 320x200 256 color mode
|
||||
#define VGA_MODE 0x13 // DOS 320x200 256 color mode
|
||||
#define EEGA_MODE 14 // DOS 640x400 16 color mode
|
||||
#define ETGA_MODE 9 // TANDY 640x400 16 color mode
|
||||
#define HGA_MODE 7 // DOS 768x400 2 color mode
|
||||
#define TXT_MODE 3 // DOS plain old color text mode
|
||||
#define VESA_640X400_256 0x100 // VESA 640x400 256 color mode
|
||||
#define VESA_640X480_256 0x101 // VESA 640x480 256 color mode
|
||||
#define VESA_800X600_256 0x103 // VESA 800x600 256 color mode
|
||||
#define VESA_1024X768_256 0x105 // VESA 1024x768 256 color mode
|
||||
#define VESA_1280X400_256 0x107 // VESA 1280x400 256 color mode
|
||||
#define VESA_TEXT_80X60 0x108 // VESA 80x60 text mode
|
||||
#define VESA_TEXT_132X25 0x109 // VESA 132x25 text mode
|
||||
#define VESA_TEXT_132X60 0x10C // VESA 132x60 text mode
|
||||
#define RESET_MODE -1
|
||||
#define UNINITIALIZED_MODE -1
|
||||
#define VESA_MIN VESA_640X400_256
|
||||
#define VESA_MAX VESA_TEXT_132X60
|
||||
|
||||
/*=========================================================================*/
|
||||
/* Define the maximum number of bank entries */
|
||||
/*=========================================================================*/
|
||||
#define MAX_BANK_ENTRIES ((1280L*1024L)/65536L)
|
||||
|
||||
|
||||
/*=========================================================================*
|
||||
* VesaInfoType - General info 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 {
|
||||
char Signature[4];
|
||||
short Version;
|
||||
REALPTR OEMString;
|
||||
long Capabilities;
|
||||
REALPTR AvailModes;
|
||||
short TotalMemory;
|
||||
char Reserved[236];
|
||||
} VesaInfoType;
|
||||
|
||||
|
||||
/*=========================================================================*
|
||||
* VesaModeInfoType - Info 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 funcs valid in this mode *
|
||||
* bit 3: 0 = monochrome, 1 = color *
|
||||
* bit 4: 0 = text mode, 1 = graphics *
|
||||
* WinA_Attributes - bit 0 = win exists, bit 1=readable, bit 2= writable *
|
||||
* WinB_Attributes - bit 0 = win 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 {
|
||||
short Attributes;
|
||||
char WinA_Attributes;
|
||||
char WinB_Attributes;
|
||||
short WinGranularity;
|
||||
short WinSize;
|
||||
short WinA_Segment;
|
||||
short WinB_Segment;
|
||||
REALPTR WinFunc;
|
||||
short BytesPerScanline;
|
||||
short XRes;
|
||||
short YRes;
|
||||
char XCharSize;
|
||||
char YCharSize;
|
||||
char NumPlanes;
|
||||
char BitsPerPixel;
|
||||
char NumBanks;
|
||||
char MemoryModel;
|
||||
char BankSize;
|
||||
char NumInputPages;
|
||||
char Reserved;
|
||||
char RedMaskSize;
|
||||
char RedFieldPosition;
|
||||
char GreenMaskSize;
|
||||
char GreenFieldPosition;
|
||||
char BlueMaskSize;
|
||||
char BlueFieldPosition;
|
||||
char RsvdMaskSize;
|
||||
char RsvdFieldPosition;
|
||||
char DirectColorModeInfo;
|
||||
char pad[216];
|
||||
} VesaModeInfoType;
|
||||
|
||||
|
||||
extern "C" {
|
||||
extern int GraphicMode;
|
||||
extern long XRes;
|
||||
extern long YRes;
|
||||
|
||||
extern long BankTable [];
|
||||
extern REALPTR VesaFunc;
|
||||
extern unsigned long RMVesaVector ;
|
||||
extern unsigned long RMVesaRegs ;
|
||||
}
|
||||
|
||||
/*=========================================================================*/
|
||||
/* The following prototypes are for the file: VIDEO.CPP */
|
||||
/*=========================================================================*/
|
||||
|
||||
extern "C" int Set_Video_Mode(int mode);
|
||||
int Get_Video_Mode(void);
|
||||
void Update_Video_Mode (void) ;
|
||||
void Vesa_Info(void);
|
||||
void Vesa_Set_Window(long grain_num);
|
||||
int Get_Original_Video_Mode(void);
|
||||
void Set_Original_Video_Mode(int mode);
|
||||
|
||||
/*=========================================================================*/
|
||||
/* The following prototypes are for the file: INITDLAY.CPP */
|
||||
/*=========================================================================*/
|
||||
|
||||
extern VOID Init_Delay(VOID);
|
||||
extern BOOL VertBlank;
|
||||
|
||||
/*=========================================================================*/
|
||||
/* The following prototypes are for the file: VERTBLNK.ASM */
|
||||
/*=========================================================================*/
|
||||
|
||||
extern "C" {
|
||||
extern WORD Get_Vert_Blank(VOID);
|
||||
extern VOID Wait_Vert_Blank(BOOL blank);
|
||||
}
|
||||
|
||||
/*=========================================================================*/
|
||||
|
||||
#endif // VIDEO_H
|
Reference in New Issue
Block a user