/* Copyright 1998-1999 (c) by Salvador Eduardo Tropea This code is part of the port of Turbo Vision to gcc, please see the rest of the file for copying information. */ /***************************************************************************** ROUTINES to store/retrieve the VGA registers. *****************************************************************************/ #include typedef unsigned char uchar; typedef unsigned short ushort; #include "vgaregs.h" #ifdef TVCompf_djgpp #include /**[txh]******************************************************************** Description: This function stores ALL the VGA registers in an array. ***************************************************************************/ static int VGASaveRegs(uchar *regs) { int i; uchar MORval; /* I'm trying to do this routine as strong and generic as possible without loosing performance. So I ever put the VGA chip in the color mode (ports=0x3Dx) but I store the real state */ MORval=ReadMOR(); WriteMOR(MORval | 1); regs[MORbase]=MORval; for (i=0; i success ***************************************************************************/ int VGAStateSave(void *buffer) { uchar *s=(uchar *)buffer; if (!s) return 0; VGASaveRegs(s); VGASavePal(s+VGARegsCant); SaveBIOSDTA(s+VGARegsCant+VGAPalSize); VGALoadRegs(s); return 1; } /**[txh]******************************************************************** Description: Restores the current video mode information from the provided buffer. Return: !=0 => success ***************************************************************************/ int VGAStateLoad(void *buffer) { uchar *s=(uchar *)buffer; if (!s) return 0; LoadBIOSDTA(s+VGARegsCant+VGAPalSize); VGALoadPal(s+VGARegsCant); VGALoadRegs(s); return 1; } #endif // DJGPP