1/* 2Copyright (C) 1996-1997 Id Software, Inc. 3 4This program is free software; you can redistribute it and/or 5modify it under the terms of the GNU General Public License 6as published by the Free Software Foundation; either version 2 7of the License, or (at your option) any later version. 8 9This program is distributed in the hope that it will be useful, 10but WITHOUT ANY WARRANTY; without even the implied warranty of 11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 13See the GNU General Public License for more details. 14 15You should have received a copy of the GNU General Public License 16along with this program; if not, write to the Free Software 17Foundation, 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 32void loutportb (int port, int val) 33{ 34 printf ("port, val: %x %x\n", port, val); 35 getch (); 36} 37 38/* 39================ 40VideoRegisterSet 41================ 42*/ 43void 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