Home | History | Annotate | Download | only in WinQuake
      1 /*
      2 Copyright (C) 1996-1997 Id Software, Inc.
      3 
      4 This program is free software; you can redistribute it and/or
      5 modify it under the terms of the GNU General Public License
      6 as published by the Free Software Foundation; either version 2
      7 of the License, or (at your option) any later version.
      8 
      9 This program is distributed in the hope that it will be useful,
     10 but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     12 
     13 See the GNU General Public License for more details.
     14 
     15 You should have received a copy of the GNU General Public License
     16 along with this program; if not, write to the Free Software
     17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
     18 
     19 */
     20 //
     21 // vregset.c: video register-setting interpreter
     22 //
     23 
     24 #include <dos.h>
     25 #include <conio.h>
     26 
     27 #include "quakedef.h"
     28 #include "vregset.h"
     29 
     30 //#define outportb	loutportb
     31 
     32 void loutportb (int port, int val)
     33 {
     34 	printf ("port, val: %x %x\n", port, val);
     35 	getch ();
     36 }
     37 
     38 /*
     39 ================
     40 VideoRegisterSet
     41 ================
     42 */
     43 void VideoRegisterSet (int *pregset)
     44 {
     45 	int		port, temp0, temp1, temp2;
     46 
     47 	for ( ;; )
     48 	{
     49 		switch (*pregset++)
     50 		{
     51 			case VRS_END:
     52 				return;
     53 
     54 			case VRS_BYTE_OUT:
     55 				port = *pregset++;
     56 				outportb (port, *pregset++);
     57 				break;
     58 
     59 			case VRS_BYTE_RMW:
     60 				port = *pregset++;
     61 				temp0 = *pregset++;
     62 				temp1 = *pregset++;
     63 				temp2 = inportb (port);
     64 				temp2 &= temp0;
     65 				temp2 |= temp1;
     66 				outportb (port, temp2);
     67 				break;
     68 
     69 			case VRS_WORD_OUT:
     70 				port = *pregset++;
     71 				outportb (port, *pregset & 0xFF);
     72 				outportb (port+1, *pregset >> 8);
     73 				pregset++;
     74 				break;
     75 
     76 			default:
     77 				Sys_Error ("VideoRegisterSet: Invalid command\n");
     78 		}
     79 	}
     80 }
     81 
     82