From 89c9f7d9ad54efd4cf7ff34a11018346639ab785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Strohh=C3=A4cker?= Date: Mon, 28 May 2007 16:29:11 +0000 Subject: [PATCH] fix reading vga sequencer data port for invalid indices, thanks to vasyl (see sf bug #1173098); fixes some svga detection routines (Grandest Fleet 2, sf bug #1723717) Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2861 --- src/hardware/vga_s3.cpp | 7 ++++++- src/hardware/vga_seq.cpp | 2 -- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hardware/vga_s3.cpp b/src/hardware/vga_s3.cpp index 7bdc3c09..ec418544 100644 --- a/src/hardware/vga_s3.cpp +++ b/src/hardware/vga_s3.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_s3.cpp,v 1.6 2007-01-08 19:45:40 qbix79 Exp $ */ +/* $Id: vga_s3.cpp,v 1.7 2007-05-28 16:29:11 c2woody Exp $ */ #include "dosbox.h" #include "inout.h" @@ -375,6 +375,7 @@ Bitu SVGA_S3_ReadCRTC( Bitu reg, Bitu iolen) { } void SVGA_S3_WriteSEQ(Bitu reg,Bitu val,Bitu iolen) { + if (reg>0x8 && vga.s3.pll.lock!=0x6) return; switch (reg) { case 0x08: vga.s3.pll.lock=val; @@ -405,6 +406,10 @@ void SVGA_S3_WriteSEQ(Bitu reg,Bitu val,Bitu iolen) { Bitu SVGA_S3_ReadSEQ(Bitu reg,Bitu iolen) { /* S3 specific group */ + if (reg>0x8 && vga.s3.pll.lock!=0x6) { + if (reg<0x1b) return 0; + else return reg; + } switch (reg) { case 0x08: /* PLL Unlock */ return vga.s3.pll.lock; diff --git a/src/hardware/vga_seq.cpp b/src/hardware/vga_seq.cpp index 6ca66344..04d29aa6 100644 --- a/src/hardware/vga_seq.cpp +++ b/src/hardware/vga_seq.cpp @@ -31,7 +31,6 @@ void write_p3c4(Bitu port,Bitu val,Bitu iolen) { }; void write_p3c5(Bitu port,Bitu val,Bitu iolen) { - if (seq(index)>0x8 && vga.s3.pll.lock!=0x6) return; // LOG_MSG("SEQ WRITE reg %X val %X",seq(index),val); switch(seq(index)) { case 0: /* Reset */ @@ -114,7 +113,6 @@ void write_p3c5(Bitu port,Bitu val,Bitu iolen) { Bitu read_p3c5(Bitu port,Bitu iolen) { // LOG_MSG("VGA:SEQ:Read from index %2X",seq(index)); - if (seq(index)>0x8 && vga.s3.pll.lock!=0x6) return seq(index); switch(seq(index)) { case 0: /* Reset */ return seq(reset);