1998-11-01 12:51:47 +00:00
|
|
|
|
/*
|
|
|
|
|
* VGA hardware emulation
|
|
|
|
|
*
|
|
|
|
|
* Copyright 1998 Ove K<EFBFBD>ven (with some help from Marcus Meissner)
|
|
|
|
|
*
|
2002-03-09 23:29:33 +00:00
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library 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
|
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
1998-11-01 12:51:47 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include "winbase.h"
|
2001-06-19 18:14:08 +00:00
|
|
|
|
#include "wingdi.h"
|
|
|
|
|
#include "winuser.h"
|
2000-02-03 00:46:29 +00:00
|
|
|
|
#include "wincon.h"
|
1998-11-01 12:51:47 +00:00
|
|
|
|
#include "miscemu.h"
|
2001-12-04 19:54:44 +00:00
|
|
|
|
#include "dosexe.h"
|
1998-11-01 12:51:47 +00:00
|
|
|
|
#include "vga.h"
|
|
|
|
|
#include "ddraw.h"
|
2002-03-09 23:29:33 +00:00
|
|
|
|
#include "wine/debug.h"
|
1998-11-01 12:51:47 +00:00
|
|
|
|
|
2002-03-09 23:29:33 +00:00
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
|
1999-04-19 14:56:29 +00:00
|
|
|
|
|
1998-11-01 12:51:47 +00:00
|
|
|
|
static IDirectDraw *lpddraw = NULL;
|
|
|
|
|
static IDirectDrawSurface *lpddsurf;
|
|
|
|
|
static IDirectDrawPalette *lpddpal;
|
|
|
|
|
static DDSURFACEDESC sdesc;
|
2002-04-08 20:11:28 +00:00
|
|
|
|
static LONG vga_refresh;
|
2000-02-03 00:46:29 +00:00
|
|
|
|
static HANDLE poll_timer;
|
|
|
|
|
|
2002-01-29 02:46:43 +00:00
|
|
|
|
static int vga_width;
|
|
|
|
|
static int vga_height;
|
|
|
|
|
static int vga_depth;
|
2002-04-08 20:11:28 +00:00
|
|
|
|
static BYTE vga_text_attr;
|
|
|
|
|
|
2002-04-19 00:05:38 +00:00
|
|
|
|
static BOOL vga_mode_initialized = FALSE;
|
|
|
|
|
|
2002-04-08 20:11:28 +00:00
|
|
|
|
static CRITICAL_SECTION vga_lock = CRITICAL_SECTION_INIT("VGA");
|
2002-01-29 02:46:43 +00:00
|
|
|
|
|
2002-02-02 18:42:11 +00:00
|
|
|
|
typedef HRESULT (WINAPI *DirectDrawCreateProc)(LPGUID,LPDIRECTDRAW *,LPUNKNOWN);
|
2001-01-05 03:44:40 +00:00
|
|
|
|
static DirectDrawCreateProc pDirectDrawCreate;
|
2000-03-17 16:58:10 +00:00
|
|
|
|
|
2002-03-23 18:48:53 +00:00
|
|
|
|
static void CALLBACK VGA_Poll( LPVOID arg, DWORD low, DWORD high );
|
|
|
|
|
|
2002-03-20 00:55:05 +00:00
|
|
|
|
/*
|
|
|
|
|
* For simplicity, I'm creating a second palette.
|
|
|
|
|
* 16 color accesses will use these pointers and insert
|
|
|
|
|
* entries from the 64-color palette into the default
|
|
|
|
|
* palette. --Robert 'Admiral' Coeyman
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
static char vga_16_palette[17]={
|
|
|
|
|
0x00, /* 0 - Black */
|
|
|
|
|
0x01, /* 1 - Blue */
|
|
|
|
|
0x02, /* 2 - Green */
|
|
|
|
|
0x03, /* 3 - Cyan */
|
|
|
|
|
0x04, /* 4 - Red */
|
|
|
|
|
0x05, /* 5 - Magenta */
|
|
|
|
|
0x14, /* 6 - Brown */
|
|
|
|
|
0x07, /* 7 - Light gray */
|
|
|
|
|
0x38, /* 8 - Dark gray */
|
|
|
|
|
0x39, /* 9 - Light blue */
|
|
|
|
|
0x3a, /* A - Light green */
|
|
|
|
|
0x3b, /* B - Light cyan */
|
|
|
|
|
0x3c, /* C - Light red */
|
|
|
|
|
0x3d, /* D - Light magenta */
|
|
|
|
|
0x3e, /* E - Yellow */
|
|
|
|
|
0x3f, /* F - White */
|
|
|
|
|
0x00 /* Border Color */
|
|
|
|
|
};
|
|
|
|
|
|
2001-11-07 20:54:08 +00:00
|
|
|
|
static PALETTEENTRY vga_def_palette[256]={
|
|
|
|
|
/* red green blue */
|
|
|
|
|
{0x00, 0x00, 0x00}, /* 0 - Black */
|
|
|
|
|
{0x00, 0x00, 0x80}, /* 1 - Blue */
|
|
|
|
|
{0x00, 0x80, 0x00}, /* 2 - Green */
|
|
|
|
|
{0x00, 0x80, 0x80}, /* 3 - Cyan */
|
|
|
|
|
{0x80, 0x00, 0x00}, /* 4 - Red */
|
|
|
|
|
{0x80, 0x00, 0x80}, /* 5 - Magenta */
|
|
|
|
|
{0x80, 0x80, 0x00}, /* 6 - Brown */
|
|
|
|
|
{0xC0, 0xC0, 0xC0}, /* 7 - Light gray */
|
|
|
|
|
{0x80, 0x80, 0x80}, /* 8 - Dark gray */
|
|
|
|
|
{0x00, 0x00, 0xFF}, /* 9 - Light blue */
|
|
|
|
|
{0x00, 0xFF, 0x00}, /* A - Light green */
|
|
|
|
|
{0x00, 0xFF, 0xFF}, /* B - Light cyan */
|
|
|
|
|
{0xFF, 0x00, 0x00}, /* C - Light red */
|
|
|
|
|
{0xFF, 0x00, 0xFF}, /* D - Light magenta */
|
|
|
|
|
{0xFF, 0xFF, 0x00}, /* E - Yellow */
|
|
|
|
|
{0xFF, 0xFF, 0xFF}, /* F - White */
|
|
|
|
|
{0,0,0} /* FIXME: a series of continuous rainbow hues should follow */
|
|
|
|
|
};
|
|
|
|
|
|
2002-03-20 00:55:05 +00:00
|
|
|
|
/*
|
|
|
|
|
* This palette is the dos default, converted from 18 bit color to 24.
|
|
|
|
|
* It contains only 64 entries of colors--all others are zeros.
|
|
|
|
|
* --Robert 'Admiral' Coeyman
|
|
|
|
|
*/
|
|
|
|
|
static PALETTEENTRY vga_def64_palette[256]={
|
|
|
|
|
/* red green blue */
|
|
|
|
|
{0x00, 0x00, 0x00}, /* 0x00 Black */
|
|
|
|
|
{0x00, 0x00, 0xaa}, /* 0x01 Blue */
|
|
|
|
|
{0x00, 0xaa, 0x00}, /* 0x02 Green */
|
|
|
|
|
{0x00, 0xaa, 0xaa}, /* 0x03 Cyan */
|
|
|
|
|
{0xaa, 0x00, 0x00}, /* 0x04 Red */
|
|
|
|
|
{0xaa, 0x00, 0xaa}, /* 0x05 Magenta */
|
|
|
|
|
{0xaa, 0xaa, 0x00}, /* 0x06 */
|
|
|
|
|
{0xaa, 0xaa, 0xaa}, /* 0x07 Light Gray */
|
|
|
|
|
{0x00, 0x00, 0x55}, /* 0x08 */
|
|
|
|
|
{0x00, 0x00, 0xff}, /* 0x09 */
|
|
|
|
|
{0x00, 0xaa, 0x55}, /* 0x0a */
|
|
|
|
|
{0x00, 0xaa, 0xff}, /* 0x0b */
|
|
|
|
|
{0xaa, 0x00, 0x55}, /* 0x0c */
|
|
|
|
|
{0xaa, 0x00, 0xff}, /* 0x0d */
|
|
|
|
|
{0xaa, 0xaa, 0x55}, /* 0x0e */
|
|
|
|
|
{0xaa, 0xaa, 0xff}, /* 0x0f */
|
|
|
|
|
{0x00, 0x55, 0x00}, /* 0x10 */
|
|
|
|
|
{0x00, 0x55, 0xaa}, /* 0x11 */
|
|
|
|
|
{0x00, 0xff, 0x00}, /* 0x12 */
|
|
|
|
|
{0x00, 0xff, 0xaa}, /* 0x13 */
|
|
|
|
|
{0xaa, 0x55, 0x00}, /* 0x14 Brown */
|
|
|
|
|
{0xaa, 0x55, 0xaa}, /* 0x15 */
|
|
|
|
|
{0xaa, 0xff, 0x00}, /* 0x16 */
|
|
|
|
|
{0xaa, 0xff, 0xaa}, /* 0x17 */
|
|
|
|
|
{0x00, 0x55, 0x55}, /* 0x18 */
|
|
|
|
|
{0x00, 0x55, 0xff}, /* 0x19 */
|
|
|
|
|
{0x00, 0xff, 0x55}, /* 0x1a */
|
|
|
|
|
{0x00, 0xff, 0xff}, /* 0x1b */
|
|
|
|
|
{0xaa, 0x55, 0x55}, /* 0x1c */
|
|
|
|
|
{0xaa, 0x55, 0xff}, /* 0x1d */
|
|
|
|
|
{0xaa, 0xff, 0x55}, /* 0x1e */
|
|
|
|
|
{0xaa, 0xff, 0xff}, /* 0x1f */
|
|
|
|
|
{0x55, 0x00, 0x00}, /* 0x20 */
|
|
|
|
|
{0x55, 0x00, 0xaa}, /* 0x21 */
|
|
|
|
|
{0x55, 0xaa, 0x00}, /* 0x22 */
|
|
|
|
|
{0x55, 0xaa, 0xaa}, /* 0x23 */
|
|
|
|
|
{0xff, 0x00, 0x00}, /* 0x24 */
|
|
|
|
|
{0xff, 0x00, 0xaa}, /* 0x25 */
|
|
|
|
|
{0xff, 0xaa, 0x00}, /* 0x26 */
|
|
|
|
|
{0xff, 0xaa, 0xaa}, /* 0x27 */
|
|
|
|
|
{0x55, 0x00, 0x55}, /* 0x28 */
|
|
|
|
|
{0x55, 0x00, 0xff}, /* 0x29 */
|
|
|
|
|
{0x55, 0xaa, 0x55}, /* 0x2a */
|
|
|
|
|
{0x55, 0xaa, 0xff}, /* 0x2b */
|
|
|
|
|
{0xff, 0x00, 0x55}, /* 0x2c */
|
|
|
|
|
{0xff, 0x00, 0xff}, /* 0x2d */
|
|
|
|
|
{0xff, 0xaa, 0x55}, /* 0x2e */
|
|
|
|
|
{0xff, 0xaa, 0xff}, /* 0x2f */
|
|
|
|
|
{0x55, 0x55, 0x00}, /* 0x30 */
|
|
|
|
|
{0x55, 0x55, 0xaa}, /* 0x31 */
|
|
|
|
|
{0x55, 0xff, 0x00}, /* 0x32 */
|
|
|
|
|
{0x55, 0xff, 0xaa}, /* 0x33 */
|
|
|
|
|
{0xff, 0x55, 0x00}, /* 0x34 */
|
|
|
|
|
{0xff, 0x55, 0xaa}, /* 0x35 */
|
|
|
|
|
{0xff, 0xff, 0x00}, /* 0x36 */
|
|
|
|
|
{0xff, 0xff, 0xaa}, /* 0x37 */
|
|
|
|
|
{0x55, 0x55, 0x55}, /* 0x38 Dark Gray */
|
|
|
|
|
{0x55, 0x55, 0xff}, /* 0x39 Light Blue */
|
|
|
|
|
{0x55, 0xff, 0x55}, /* 0x3a Light Green */
|
|
|
|
|
{0x55, 0xff, 0xff}, /* 0x3b Light Cyan */
|
|
|
|
|
{0xff, 0x55, 0x55}, /* 0x3c Light Red */
|
|
|
|
|
{0xff, 0x55, 0xff}, /* 0x3d Light Magenta */
|
|
|
|
|
{0xff, 0xff, 0x55}, /* 0x3e Yellow */
|
|
|
|
|
{0xff, 0xff, 0xff}, /* 0x3f White */
|
|
|
|
|
{0,0,0} /* The next 192 entries are all zeros */
|
|
|
|
|
};
|
|
|
|
|
|
2002-03-23 18:48:53 +00:00
|
|
|
|
static HANDLE VGA_timer;
|
|
|
|
|
static HANDLE VGA_timer_thread;
|
|
|
|
|
|
|
|
|
|
/* set the timer rate; called in the polling thread context */
|
|
|
|
|
static void CALLBACK set_timer_rate( ULONG_PTR arg )
|
|
|
|
|
{
|
|
|
|
|
LARGE_INTEGER when;
|
|
|
|
|
|
|
|
|
|
when.s.LowPart = when.s.HighPart = 0;
|
|
|
|
|
SetWaitableTimer( VGA_timer, &when, arg, VGA_Poll, 0, FALSE );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static DWORD CALLBACK VGA_TimerThread( void *dummy )
|
|
|
|
|
{
|
|
|
|
|
for (;;) WaitForMultipleObjectsEx( 0, NULL, FALSE, INFINITE, TRUE );
|
|
|
|
|
}
|
|
|
|
|
|
2000-02-03 00:46:29 +00:00
|
|
|
|
static void VGA_DeinstallTimer(void)
|
|
|
|
|
{
|
2002-03-23 18:48:53 +00:00
|
|
|
|
if (VGA_timer_thread)
|
|
|
|
|
{
|
|
|
|
|
CancelWaitableTimer( VGA_timer );
|
|
|
|
|
CloseHandle( VGA_timer );
|
|
|
|
|
TerminateThread( VGA_timer_thread, 0 );
|
|
|
|
|
CloseHandle( VGA_timer_thread );
|
|
|
|
|
VGA_timer_thread = 0;
|
2000-02-03 00:46:29 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void VGA_InstallTimer(unsigned Rate)
|
|
|
|
|
{
|
2002-03-23 18:48:53 +00:00
|
|
|
|
if (!VGA_timer_thread)
|
|
|
|
|
{
|
|
|
|
|
VGA_timer = CreateWaitableTimerA( NULL, FALSE, NULL );
|
|
|
|
|
VGA_timer_thread = CreateThread( NULL, 0, VGA_TimerThread, NULL, 0, NULL );
|
|
|
|
|
}
|
|
|
|
|
QueueUserAPC( set_timer_rate, VGA_timer_thread, (ULONG_PTR)Rate );
|
2000-02-03 00:46:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HANDLE VGA_AlphaConsole(void)
|
|
|
|
|
{
|
|
|
|
|
/* this assumes that no Win32 redirection has taken place, but then again,
|
|
|
|
|
* only 16-bit apps are likely to use this part of Wine... */
|
|
|
|
|
return GetStdHandle(STD_OUTPUT_HANDLE);
|
|
|
|
|
}
|
|
|
|
|
|
2000-05-23 21:14:11 +00:00
|
|
|
|
char*VGA_AlphaBuffer(void)
|
|
|
|
|
{
|
|
|
|
|
return DOSMEM_MapDosToLinear(0xb8000);
|
|
|
|
|
}
|
|
|
|
|
|
2000-02-03 00:46:29 +00:00
|
|
|
|
/*** GRAPHICS MODE ***/
|
1998-11-01 12:51:47 +00:00
|
|
|
|
|
2001-11-07 20:54:08 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
unsigned Xres, Yres, Depth;
|
|
|
|
|
int ret;
|
|
|
|
|
} ModeSet;
|
|
|
|
|
|
2002-05-11 23:00:17 +00:00
|
|
|
|
static void WINAPI VGA_DoExit(ULONG_PTR arg)
|
|
|
|
|
{
|
|
|
|
|
VGA_DeinstallTimer();
|
|
|
|
|
IDirectDrawSurface_SetPalette(lpddsurf,NULL);
|
|
|
|
|
IDirectDrawSurface_Release(lpddsurf);
|
|
|
|
|
lpddsurf=NULL;
|
|
|
|
|
IDirectDrawPalette_Release(lpddpal);
|
|
|
|
|
lpddpal=NULL;
|
|
|
|
|
IDirectDraw_Release(lpddraw);
|
|
|
|
|
lpddraw=NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2001-11-07 20:54:08 +00:00
|
|
|
|
static void WINAPI VGA_DoSetMode(ULONG_PTR arg)
|
1998-11-01 12:51:47 +00:00
|
|
|
|
{
|
2001-06-19 18:14:08 +00:00
|
|
|
|
LRESULT res;
|
|
|
|
|
HWND hwnd;
|
2001-11-07 20:54:08 +00:00
|
|
|
|
ModeSet *par = (ModeSet *)arg;
|
|
|
|
|
par->ret=1;
|
2001-06-19 18:14:08 +00:00
|
|
|
|
|
2002-05-11 23:00:17 +00:00
|
|
|
|
if (lpddraw) VGA_DoExit(NULL);
|
1998-11-01 12:51:47 +00:00
|
|
|
|
if (!lpddraw) {
|
2000-03-17 16:58:10 +00:00
|
|
|
|
if (!pDirectDrawCreate)
|
|
|
|
|
{
|
|
|
|
|
HMODULE hmod = LoadLibraryA( "ddraw.dll" );
|
2001-01-05 03:44:40 +00:00
|
|
|
|
if (hmod) pDirectDrawCreate = (DirectDrawCreateProc)GetProcAddress( hmod, "DirectDrawCreate" );
|
2001-06-19 18:14:08 +00:00
|
|
|
|
if (!pDirectDrawCreate) {
|
|
|
|
|
ERR("Can't lookup DirectDrawCreate from ddraw.dll.\n");
|
2001-11-07 20:54:08 +00:00
|
|
|
|
return;
|
2001-06-19 18:14:08 +00:00
|
|
|
|
}
|
2000-03-17 16:58:10 +00:00
|
|
|
|
}
|
2001-06-19 18:14:08 +00:00
|
|
|
|
res = pDirectDrawCreate(NULL,&lpddraw,NULL);
|
1998-11-01 12:51:47 +00:00
|
|
|
|
if (!lpddraw) {
|
2001-06-19 18:14:08 +00:00
|
|
|
|
ERR("DirectDraw is not available (res = %lx)\n",res);
|
2001-11-07 20:54:08 +00:00
|
|
|
|
return;
|
1998-11-01 12:51:47 +00:00
|
|
|
|
}
|
2001-12-04 19:54:44 +00:00
|
|
|
|
hwnd = CreateWindowExA(0,"STATIC","WINEDOS VGA",WS_POPUP|WS_BORDER|WS_CAPTION|WS_SYSMENU,0,0,par->Xres,par->Yres,0,0,0,NULL);
|
2001-06-19 18:14:08 +00:00
|
|
|
|
if (!hwnd) {
|
|
|
|
|
ERR("Failed to create user window.\n");
|
|
|
|
|
}
|
|
|
|
|
if ((res=IDirectDraw_SetCooperativeLevel(lpddraw,hwnd,DDSCL_FULLSCREEN|DDSCL_EXCLUSIVE))) {
|
|
|
|
|
ERR("Could not set cooperative level to exclusive (%lx)\n",res);
|
|
|
|
|
}
|
|
|
|
|
|
2001-11-07 20:54:08 +00:00
|
|
|
|
if ((res=IDirectDraw_SetDisplayMode(lpddraw,par->Xres,par->Yres,par->Depth))) {
|
|
|
|
|
ERR("DirectDraw does not support requested display mode (%dx%dx%d), res = %lx!\n",par->Xres,par->Yres,par->Depth,res);
|
1999-03-27 16:49:55 +00:00
|
|
|
|
IDirectDraw_Release(lpddraw);
|
1998-11-01 12:51:47 +00:00
|
|
|
|
lpddraw=NULL;
|
2001-11-07 20:54:08 +00:00
|
|
|
|
return;
|
1998-11-01 12:51:47 +00:00
|
|
|
|
}
|
2001-11-07 20:54:08 +00:00
|
|
|
|
|
2001-06-19 18:14:08 +00:00
|
|
|
|
res=IDirectDraw_CreatePalette(lpddraw,DDPCAPS_8BIT,NULL,&lpddpal,NULL);
|
2001-11-07 20:54:08 +00:00
|
|
|
|
if (res) {
|
2001-06-19 18:14:08 +00:00
|
|
|
|
ERR("Could not create palette (res = %lx)\n",res);
|
2001-11-07 20:54:08 +00:00
|
|
|
|
IDirectDraw_Release(lpddraw);
|
|
|
|
|
lpddraw=NULL;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ((res=IDirectDrawPalette_SetEntries(lpddpal,0,0,256,vga_def_palette))) {
|
|
|
|
|
ERR("Could not set default palette entries (res = %lx)\n", res);
|
|
|
|
|
}
|
|
|
|
|
|
1998-11-01 12:51:47 +00:00
|
|
|
|
memset(&sdesc,0,sizeof(sdesc));
|
|
|
|
|
sdesc.dwSize=sizeof(sdesc);
|
1999-01-17 16:55:11 +00:00
|
|
|
|
sdesc.dwFlags = DDSD_CAPS;
|
|
|
|
|
sdesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
1999-03-27 16:49:55 +00:00
|
|
|
|
if (IDirectDraw_CreateSurface(lpddraw,&sdesc,&lpddsurf,NULL)||(!lpddsurf)) {
|
1999-06-26 19:09:08 +00:00
|
|
|
|
ERR("DirectDraw surface is not available\n");
|
1999-03-27 16:49:55 +00:00
|
|
|
|
IDirectDraw_Release(lpddraw);
|
1998-11-01 12:51:47 +00:00
|
|
|
|
lpddraw=NULL;
|
2001-11-07 20:54:08 +00:00
|
|
|
|
return;
|
1998-11-01 12:51:47 +00:00
|
|
|
|
}
|
2000-05-23 21:14:11 +00:00
|
|
|
|
IDirectDrawSurface_SetPalette(lpddsurf,lpddpal);
|
1998-11-08 15:06:31 +00:00
|
|
|
|
vga_refresh=0;
|
1998-11-01 12:51:47 +00:00
|
|
|
|
/* poll every 20ms (50fps should provide adequate responsiveness) */
|
2000-05-10 04:43:32 +00:00
|
|
|
|
VGA_InstallTimer(20);
|
1998-11-01 12:51:47 +00:00
|
|
|
|
}
|
2001-11-07 20:54:08 +00:00
|
|
|
|
par->ret=0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int VGA_SetMode(unsigned Xres,unsigned Yres,unsigned Depth)
|
|
|
|
|
{
|
|
|
|
|
ModeSet par;
|
2002-01-29 02:46:43 +00:00
|
|
|
|
|
|
|
|
|
vga_width = Xres;
|
|
|
|
|
vga_height = Yres;
|
|
|
|
|
vga_depth = Depth;
|
|
|
|
|
|
|
|
|
|
if(Xres >= 640 || Yres >= 480) {
|
|
|
|
|
par.Xres = Xres;
|
|
|
|
|
par.Yres = Yres;
|
|
|
|
|
} else {
|
|
|
|
|
par.Xres = 640;
|
|
|
|
|
par.Yres = 480;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
par.Depth = (Depth < 8) ? 8 : Depth;
|
|
|
|
|
|
2002-04-19 00:05:38 +00:00
|
|
|
|
vga_mode_initialized = TRUE;
|
|
|
|
|
|
2001-12-04 19:54:44 +00:00
|
|
|
|
MZ_RunInThread(VGA_DoSetMode, (ULONG_PTR)&par);
|
2001-11-07 20:54:08 +00:00
|
|
|
|
return par.ret;
|
1998-11-01 12:51:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int VGA_GetMode(unsigned*Height,unsigned*Width,unsigned*Depth)
|
|
|
|
|
{
|
|
|
|
|
if (!lpddraw) return 1;
|
|
|
|
|
if (!lpddsurf) return 1;
|
|
|
|
|
if (Height) *Height=sdesc.dwHeight;
|
|
|
|
|
if (Width) *Width=sdesc.dwWidth;
|
2001-01-04 22:44:55 +00:00
|
|
|
|
if (Depth) *Depth=sdesc.ddpfPixelFormat.u1.dwRGBBitCount;
|
1998-11-01 12:51:47 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VGA_Exit(void)
|
|
|
|
|
{
|
2001-12-04 19:54:44 +00:00
|
|
|
|
if (lpddraw) MZ_RunInThread(VGA_DoExit, 0);
|
1998-11-01 12:51:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VGA_SetPalette(PALETTEENTRY*pal,int start,int len)
|
|
|
|
|
{
|
|
|
|
|
if (!lpddraw) return;
|
1999-03-27 16:49:55 +00:00
|
|
|
|
IDirectDrawPalette_SetEntries(lpddpal,0,start,len,pal);
|
1998-11-01 12:51:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-03-20 00:55:05 +00:00
|
|
|
|
/* set a single color in 16 color mode. */
|
|
|
|
|
void VGA_SetColor16(int reg,int color)
|
|
|
|
|
{
|
|
|
|
|
PALETTEENTRY *pal;
|
|
|
|
|
|
|
|
|
|
if (!lpddraw) return;
|
|
|
|
|
pal= &vga_def64_palette[color];
|
|
|
|
|
IDirectDrawPalette_SetEntries(lpddpal,0,reg,1,pal);
|
|
|
|
|
vga_16_palette[reg]=(char)color;
|
|
|
|
|
}
|
|
|
|
|
|
1998-11-01 12:51:47 +00:00
|
|
|
|
void VGA_SetQuadPalette(RGBQUAD*color,int start,int len)
|
|
|
|
|
{
|
|
|
|
|
PALETTEENTRY pal[256];
|
|
|
|
|
int c;
|
|
|
|
|
|
|
|
|
|
if (!lpddraw) return;
|
|
|
|
|
for (c=0; c<len; c++) {
|
|
|
|
|
pal[c].peRed =color[c].rgbRed;
|
|
|
|
|
pal[c].peGreen=color[c].rgbGreen;
|
|
|
|
|
pal[c].peBlue =color[c].rgbBlue;
|
|
|
|
|
pal[c].peFlags=0;
|
|
|
|
|
}
|
1999-03-27 16:49:55 +00:00
|
|
|
|
IDirectDrawPalette_SetEntries(lpddpal,0,start,len,pal);
|
1998-11-01 12:51:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LPSTR VGA_Lock(unsigned*Pitch,unsigned*Height,unsigned*Width,unsigned*Depth)
|
|
|
|
|
{
|
|
|
|
|
if (!lpddraw) return NULL;
|
|
|
|
|
if (!lpddsurf) return NULL;
|
1999-03-27 16:49:55 +00:00
|
|
|
|
if (IDirectDrawSurface_Lock(lpddsurf,NULL,&sdesc,0,0)) {
|
1999-06-26 19:09:08 +00:00
|
|
|
|
ERR("could not lock surface!\n");
|
1998-11-01 12:51:47 +00:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2001-01-04 22:44:55 +00:00
|
|
|
|
if (Pitch) *Pitch=sdesc.u1.lPitch;
|
1998-11-01 12:51:47 +00:00
|
|
|
|
if (Height) *Height=sdesc.dwHeight;
|
|
|
|
|
if (Width) *Width=sdesc.dwWidth;
|
2001-01-04 22:44:55 +00:00
|
|
|
|
if (Depth) *Depth=sdesc.ddpfPixelFormat.u1.dwRGBBitCount;
|
|
|
|
|
return sdesc.lpSurface;
|
1998-11-01 12:51:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VGA_Unlock(void)
|
|
|
|
|
{
|
2001-01-04 22:44:55 +00:00
|
|
|
|
IDirectDrawSurface_Unlock(lpddsurf,sdesc.lpSurface);
|
1998-11-01 12:51:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-02-03 00:46:29 +00:00
|
|
|
|
/*** TEXT MODE ***/
|
|
|
|
|
|
|
|
|
|
int VGA_SetAlphaMode(unsigned Xres,unsigned Yres)
|
|
|
|
|
{
|
|
|
|
|
COORD siz;
|
|
|
|
|
|
|
|
|
|
if (lpddraw) VGA_Exit();
|
|
|
|
|
|
2002-04-08 20:11:28 +00:00
|
|
|
|
/* FIXME: Where to initialize text attributes? */
|
|
|
|
|
VGA_SetTextAttribute(0xf);
|
|
|
|
|
|
2000-02-03 00:46:29 +00:00
|
|
|
|
/* the xterm is slow, so refresh only every 200ms (5fps) */
|
2000-05-10 04:43:32 +00:00
|
|
|
|
VGA_InstallTimer(200);
|
2000-02-03 00:46:29 +00:00
|
|
|
|
|
2000-05-03 17:48:21 +00:00
|
|
|
|
siz.X = Xres;
|
|
|
|
|
siz.Y = Yres;
|
2000-02-03 00:46:29 +00:00
|
|
|
|
SetConsoleScreenBufferSize(VGA_AlphaConsole(),siz);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VGA_GetAlphaMode(unsigned*Xres,unsigned*Yres)
|
|
|
|
|
{
|
|
|
|
|
CONSOLE_SCREEN_BUFFER_INFO info;
|
|
|
|
|
GetConsoleScreenBufferInfo(VGA_AlphaConsole(),&info);
|
2000-05-03 17:48:21 +00:00
|
|
|
|
if (Xres) *Xres=info.dwSize.X;
|
|
|
|
|
if (Yres) *Yres=info.dwSize.Y;
|
2000-02-03 00:46:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VGA_SetCursorPos(unsigned X,unsigned Y)
|
|
|
|
|
{
|
|
|
|
|
COORD pos;
|
2001-11-07 20:54:08 +00:00
|
|
|
|
|
|
|
|
|
if (!poll_timer) VGA_SetAlphaMode(80, 25);
|
2000-05-03 17:48:21 +00:00
|
|
|
|
pos.X = X;
|
|
|
|
|
pos.Y = Y;
|
2000-02-03 00:46:29 +00:00
|
|
|
|
SetConsoleCursorPosition(VGA_AlphaConsole(),pos);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VGA_GetCursorPos(unsigned*X,unsigned*Y)
|
|
|
|
|
{
|
|
|
|
|
CONSOLE_SCREEN_BUFFER_INFO info;
|
|
|
|
|
GetConsoleScreenBufferInfo(VGA_AlphaConsole(),&info);
|
2000-05-03 17:48:21 +00:00
|
|
|
|
if (X) *X=info.dwCursorPosition.X;
|
|
|
|
|
if (Y) *Y=info.dwCursorPosition.Y;
|
2000-02-03 00:46:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-05-23 21:14:11 +00:00
|
|
|
|
void VGA_WriteChars(unsigned X,unsigned Y,unsigned ch,int attr,int count)
|
|
|
|
|
{
|
2002-04-08 20:11:28 +00:00
|
|
|
|
CHAR_INFO info;
|
|
|
|
|
COORD siz, off;
|
|
|
|
|
SMALL_RECT dest;
|
2000-05-23 21:14:11 +00:00
|
|
|
|
unsigned XR, YR;
|
2002-04-08 20:11:28 +00:00
|
|
|
|
char *dat;
|
|
|
|
|
|
|
|
|
|
EnterCriticalSection(&vga_lock);
|
|
|
|
|
|
|
|
|
|
info.Char.AsciiChar = ch;
|
|
|
|
|
info.Attributes = (WORD)attr;
|
|
|
|
|
siz.X = 1;
|
|
|
|
|
siz.Y = 1;
|
|
|
|
|
off.X = 0;
|
|
|
|
|
off.Y = 0;
|
|
|
|
|
dest.Top=Y;
|
|
|
|
|
dest.Bottom=Y;
|
2000-05-23 21:14:11 +00:00
|
|
|
|
|
|
|
|
|
VGA_GetAlphaMode(&XR, &YR);
|
|
|
|
|
dat = VGA_AlphaBuffer() + ((XR*Y + X) * 2);
|
|
|
|
|
while (count--) {
|
2002-04-08 20:11:28 +00:00
|
|
|
|
dest.Left = X + count;
|
|
|
|
|
dest.Right = X + count;
|
|
|
|
|
|
2000-05-23 21:14:11 +00:00
|
|
|
|
*dat++ = ch;
|
2002-04-08 20:11:28 +00:00
|
|
|
|
if (attr>=0)
|
|
|
|
|
*dat = attr;
|
|
|
|
|
else
|
|
|
|
|
info.Attributes = *dat;
|
2000-05-23 21:14:11 +00:00
|
|
|
|
dat++;
|
2002-04-08 20:11:28 +00:00
|
|
|
|
|
|
|
|
|
WriteConsoleOutputA(VGA_AlphaConsole(), &info, siz, off, &dest);
|
2000-05-23 21:14:11 +00:00
|
|
|
|
}
|
2002-04-08 20:11:28 +00:00
|
|
|
|
|
|
|
|
|
LeaveCriticalSection(&vga_lock);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void VGA_PutCharAt(BYTE ascii, unsigned x, unsigned y)
|
|
|
|
|
{
|
|
|
|
|
unsigned width, height;
|
|
|
|
|
char *dat;
|
|
|
|
|
|
|
|
|
|
VGA_GetAlphaMode(&width, &height);
|
|
|
|
|
dat = VGA_AlphaBuffer() + ((width*y + x) * 2);
|
|
|
|
|
dat[0] = ascii;
|
|
|
|
|
dat[1] = vga_text_attr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VGA_PutChar(BYTE ascii)
|
|
|
|
|
{
|
|
|
|
|
unsigned width, height, x, y, nx, ny;
|
|
|
|
|
|
|
|
|
|
EnterCriticalSection(&vga_lock);
|
|
|
|
|
|
|
|
|
|
VGA_GetAlphaMode(&width, &height);
|
|
|
|
|
VGA_GetCursorPos(&x, &y);
|
|
|
|
|
|
|
|
|
|
switch(ascii) {
|
|
|
|
|
case '\b':
|
|
|
|
|
VGA_PutCharAt(' ', x, y);
|
|
|
|
|
x--;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '\t':
|
|
|
|
|
x += ((x + 8) & ~7) - x;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '\n':
|
|
|
|
|
y++;
|
|
|
|
|
x = 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '\a':
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '\r':
|
|
|
|
|
x = 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
VGA_PutCharAt(ascii, x, y);
|
|
|
|
|
x++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* FIXME: add line wrapping and scrolling
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
WriteFile(VGA_AlphaConsole(), &ascii, 1, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* The following is just a sanity check.
|
|
|
|
|
*/
|
|
|
|
|
VGA_GetCursorPos(&nx, &ny);
|
|
|
|
|
if(nx != x || ny != y)
|
|
|
|
|
WARN("VGA emulator and text console have become unsynchronized.\n");
|
|
|
|
|
|
|
|
|
|
LeaveCriticalSection(&vga_lock);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VGA_SetTextAttribute(BYTE attr)
|
|
|
|
|
{
|
|
|
|
|
vga_text_attr = attr;
|
|
|
|
|
SetConsoleTextAttribute(VGA_AlphaConsole(), attr);
|
2000-05-23 21:14:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-04-11 17:33:15 +00:00
|
|
|
|
void VGA_ClearText(unsigned row1, unsigned col1,
|
|
|
|
|
unsigned row2, unsigned col2,
|
|
|
|
|
BYTE attr)
|
|
|
|
|
{
|
|
|
|
|
unsigned width, height, x, y;
|
|
|
|
|
COORD off;
|
|
|
|
|
char *dat = VGA_AlphaBuffer();
|
|
|
|
|
HANDLE con = VGA_AlphaConsole();
|
|
|
|
|
VGA_GetAlphaMode(&width, &height);
|
|
|
|
|
|
|
|
|
|
EnterCriticalSection(&vga_lock);
|
|
|
|
|
|
|
|
|
|
for(y=row1; y<=row2; y++) {
|
|
|
|
|
off.X = col1;
|
|
|
|
|
off.Y = y;
|
|
|
|
|
FillConsoleOutputCharacterA(con, ' ', col2-col1+1, off, NULL);
|
|
|
|
|
FillConsoleOutputAttribute(con, attr, col2-col1+1, off, NULL);
|
|
|
|
|
|
|
|
|
|
for(x=col1; x<=col2; x++) {
|
|
|
|
|
char *ptr = dat + ((width*y + x) * 2);
|
|
|
|
|
ptr[0] = ' ';
|
|
|
|
|
ptr[1] = attr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LeaveCriticalSection(&vga_lock);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VGA_ScrollUpText(unsigned row1, unsigned col1,
|
|
|
|
|
unsigned row2, unsigned col2,
|
|
|
|
|
unsigned lines, BYTE attr)
|
|
|
|
|
{
|
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VGA_ScrollDownText(unsigned row1, unsigned col1,
|
|
|
|
|
unsigned row2, unsigned col2,
|
|
|
|
|
unsigned lines, BYTE attr)
|
|
|
|
|
{
|
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VGA_GetCharacterAtCursor(BYTE *ascii, BYTE *attr)
|
|
|
|
|
{
|
|
|
|
|
unsigned width, height, x, y;
|
|
|
|
|
char *dat;
|
|
|
|
|
|
|
|
|
|
VGA_GetAlphaMode(&width, &height);
|
|
|
|
|
VGA_GetCursorPos(&x, &y);
|
|
|
|
|
dat = VGA_AlphaBuffer() + ((width*y + x) * 2);
|
|
|
|
|
|
|
|
|
|
*ascii = dat[0];
|
|
|
|
|
*attr = dat[1];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-02-03 00:46:29 +00:00
|
|
|
|
/*** CONTROL ***/
|
|
|
|
|
|
2002-01-29 02:46:43 +00:00
|
|
|
|
static void VGA_Poll_Graphics(void)
|
|
|
|
|
{
|
|
|
|
|
unsigned int Pitch, Height, Width, X, Y;
|
|
|
|
|
char *surf;
|
|
|
|
|
char *dat = DOSMEM_MapDosToLinear(0xa0000);
|
|
|
|
|
|
|
|
|
|
surf = VGA_Lock(&Pitch,&Height,&Width,NULL);
|
|
|
|
|
if (!surf) return;
|
|
|
|
|
|
|
|
|
|
if(vga_width == 320 && vga_depth <= 4)
|
|
|
|
|
for (Y=0; Y<vga_height; Y++,surf+=Pitch*2,dat+=vga_width/8) {
|
|
|
|
|
for(X=0; X<vga_width; X+=8) {
|
|
|
|
|
int offset = X/8;
|
|
|
|
|
int Z;
|
|
|
|
|
for(Z=0; Z<8; Z++) {
|
|
|
|
|
int b0 = (dat[offset] >> Z) & 0x1;
|
|
|
|
|
int index = 7-Z;
|
|
|
|
|
surf[(X+index)*2] = b0;
|
|
|
|
|
surf[(X+index)*2+1] = b0;
|
|
|
|
|
surf[(X+index)*2+Pitch] = b0;
|
|
|
|
|
surf[(X+index)*2+Pitch+1] = b0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(vga_width == 320 && vga_depth == 8)
|
|
|
|
|
for (Y=0; Y<vga_height; Y++,surf+=Pitch*2,dat+=vga_width) {
|
|
|
|
|
for(X=0; X<vga_width; X++) {
|
|
|
|
|
int b0 = dat[X];
|
|
|
|
|
surf[X*2] = b0;
|
|
|
|
|
surf[X*2+1] = b0;
|
|
|
|
|
surf[X*2+Pitch] = b0;
|
|
|
|
|
surf[X*2+Pitch+1] = b0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(vga_depth <= 4)
|
|
|
|
|
for (Y=0; Y<vga_height; Y++,surf+=Pitch,dat+=vga_width/8) {
|
|
|
|
|
for(X=0; X<vga_width; X+=8) {
|
|
|
|
|
int offset = X/8;
|
|
|
|
|
int Z;
|
|
|
|
|
for(Z=0; Z<8; Z++) {
|
|
|
|
|
int b0 = (dat[offset] >> Z) & 0x1;
|
|
|
|
|
int index = 7-Z;
|
|
|
|
|
surf[X+index] = b0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VGA_Unlock();
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-08 20:11:28 +00:00
|
|
|
|
static void VGA_Poll_Text(void)
|
1998-11-01 12:51:47 +00:00
|
|
|
|
{
|
|
|
|
|
char *dat;
|
2002-01-29 02:46:43 +00:00
|
|
|
|
unsigned int Height,Width,Y,X;
|
2002-04-08 20:11:28 +00:00
|
|
|
|
CHAR_INFO ch[80];
|
|
|
|
|
COORD siz, off;
|
|
|
|
|
SMALL_RECT dest;
|
|
|
|
|
HANDLE con = VGA_AlphaConsole();
|
|
|
|
|
|
|
|
|
|
VGA_GetAlphaMode(&Width,&Height);
|
|
|
|
|
dat = VGA_AlphaBuffer();
|
|
|
|
|
siz.X = 80; siz.Y = 1;
|
|
|
|
|
off.X = 0; off.Y = 0;
|
|
|
|
|
/* copy from virtual VGA frame buffer to console */
|
|
|
|
|
for (Y=0; Y<Height; Y++) {
|
|
|
|
|
dest.Top=Y; dest.Bottom=Y;
|
|
|
|
|
for (X=0; X<Width; X++) {
|
|
|
|
|
ch[X].Char.AsciiChar = *dat++;
|
|
|
|
|
/* WriteConsoleOutputA doesn't like "dead" chars */
|
|
|
|
|
if (ch[X].Char.AsciiChar == '\0')
|
|
|
|
|
ch[X].Char.AsciiChar = ' ';
|
|
|
|
|
ch[X].Attributes = *dat++;
|
|
|
|
|
}
|
|
|
|
|
dest.Left=0; dest.Right=Width+1;
|
|
|
|
|
WriteConsoleOutputA(con, ch, siz, off, &dest);
|
|
|
|
|
}
|
|
|
|
|
}
|
1998-11-01 12:51:47 +00:00
|
|
|
|
|
2002-04-08 20:11:28 +00:00
|
|
|
|
static void CALLBACK VGA_Poll( LPVOID arg, DWORD low, DWORD high )
|
|
|
|
|
{
|
|
|
|
|
if(!TryEnterCriticalSection(&vga_lock))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* FIXME: optimize by doing this only if the data has actually changed
|
|
|
|
|
* (in a way similar to DIBSection, perhaps) */
|
|
|
|
|
if (lpddraw) {
|
|
|
|
|
VGA_Poll_Graphics();
|
|
|
|
|
} else {
|
|
|
|
|
VGA_Poll_Text();
|
1998-11-01 12:51:47 +00:00
|
|
|
|
}
|
2002-04-08 20:11:28 +00:00
|
|
|
|
|
|
|
|
|
vga_refresh=1;
|
|
|
|
|
LeaveCriticalSection(&vga_lock);
|
1998-11-01 12:51:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static BYTE palreg,palcnt;
|
|
|
|
|
static PALETTEENTRY paldat;
|
|
|
|
|
|
|
|
|
|
void VGA_ioport_out( WORD port, BYTE val )
|
|
|
|
|
{
|
|
|
|
|
switch (port) {
|
|
|
|
|
case 0x3c8:
|
|
|
|
|
palreg=val; palcnt=0; break;
|
|
|
|
|
case 0x3c9:
|
|
|
|
|
((BYTE*)&paldat)[palcnt++]=val << 2;
|
|
|
|
|
if (palcnt==3) {
|
1999-03-14 12:23:17 +00:00
|
|
|
|
VGA_SetPalette(&paldat,palreg++,1);
|
|
|
|
|
palcnt=0;
|
1998-11-01 12:51:47 +00:00
|
|
|
|
}
|
1998-11-08 15:06:31 +00:00
|
|
|
|
break;
|
1998-11-01 12:51:47 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
1998-11-08 15:06:31 +00:00
|
|
|
|
|
|
|
|
|
BYTE VGA_ioport_in( WORD port )
|
|
|
|
|
{
|
|
|
|
|
BYTE ret;
|
|
|
|
|
|
|
|
|
|
switch (port) {
|
|
|
|
|
case 0x3da:
|
|
|
|
|
/* since we don't (yet?) serve DOS VM requests while VGA_Poll is running,
|
|
|
|
|
we need to fake the occurrence of the vertical refresh */
|
2000-02-03 00:46:29 +00:00
|
|
|
|
ret=vga_refresh?0x00:0x08;
|
2002-04-19 00:05:38 +00:00
|
|
|
|
if (vga_mode_initialized)
|
|
|
|
|
vga_refresh=0;
|
|
|
|
|
else
|
|
|
|
|
/* Also fake the occurence of the vertical refresh when no graphic
|
|
|
|
|
mode has been set */
|
|
|
|
|
vga_refresh=!vga_refresh;
|
1998-11-08 15:06:31 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ret=0xff;
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2000-02-03 00:46:29 +00:00
|
|
|
|
|
|
|
|
|
void VGA_Clean(void)
|
|
|
|
|
{
|
|
|
|
|
VGA_Exit();
|
|
|
|
|
VGA_DeinstallTimer();
|
|
|
|
|
}
|