1
0
Fork 0

some more ega updates (monitor, height control, text modes)

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3015
This commit is contained in:
Sebastian Strohhäcker 2007-10-13 16:34:06 +00:00
parent e9e734d8d8
commit 993f47a01c
4 changed files with 74 additions and 58 deletions

View file

@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: vga_attr.cpp,v 1.26 2007-10-13 16:34:06 c2woody Exp $ */
#include "dosbox.h"
#include "inout.h"
#include "vga.h"
@ -27,11 +29,15 @@ void VGA_ATTR_SetPalette(Bit8u index,Bit8u val) {
if (vga.attr.mode_control & 0x80) val = (val&0xf) | (vga.attr.color_select << 4);
val &= 63;
val |= (vga.attr.color_select & 0xc) << 4;
if (GCC_UNLIKELY(!IS_VGA_ARCH)) {
if (val&0x10) val|=0x38;
else {
val&=0x7;
if (val==6) val=0x14;
if (GCC_UNLIKELY(machine==MCH_EGA)) {
if ((vga.crtc.vertical_total | ((vga.crtc.overflow & 1) << 8)) == 260) {
// check for intensity bit
if (val&0x10) val|=0x38;
else {
val&=0x7;
// check for special brown
if (val==6) val=0x14;
}
}
}
VGA_DAC_CombineColor(index,val);

View file

@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: vga_draw.cpp,v 1.86 2007-10-13 16:34:06 c2woody Exp $ */
#include <string.h>
#include <math.h>
#include "dosbox.h"
@ -790,7 +792,7 @@ void VGA_SetupDrawing(Bitu val) {
if (vga.s3.pll.cmd & 0x10) clock/=2;
if (IS_VGA_ARCH) vga.draw.double_scan=(vga.crtc.maximum_scan_line&0x80)>0;
else vga.draw.double_scan=(vga.seq.clocking_mode&0x08)>0; // not really correct...
else vga.draw.double_scan=(vtotal==262);
} else {
htotal = vga.other.htotal + 1;
hdend = vga.other.hdend;

View file

@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: vga_misc.cpp,v 1.35 2007-10-13 16:34:06 c2woody Exp $ */
#include "dosbox.h"
#include "inout.h"
#include "pic.h"
@ -123,28 +125,26 @@ static Bitu read_p3cc(Bitu port,Bitu iolen) {
return vga.misc_output;
}
/*
Test 13: Hardware: General Registers
Mode 00h, General -- Feat Ctrl: IBM=00h Current=FFh
Mode 00h, General -- Input Status 0: IBM=70h Current=FFh
.. & modes 1,2,3,4,5,6,d,e,10,11,12,13
following read handlers silence the above vgatest errors.
*/
// VGA feature control register
static Bitu read_p3ca(Bitu port,Bitu iolen) {
return 0;
}
static Bitu read_p3c8(Bitu port,Bitu iolen) {
return 0x10;
}
static Bitu read_p3c2(Bitu port,Bitu iolen) {
Bitu retcode=0x70;
if (GCC_UNLIKELY(machine==MCH_EGA)) {
Bitu retcode=0x60;
retcode |= (vga.draw.vret_triggered ? 0x80 : 0x00);
vga.draw.vret_triggered=false;
// ega colour monitor
if ((((vga.misc_output>>2)&3)==0) || (((vga.misc_output>>2)&3)==3)) retcode|=0x10;
return retcode;
} else {
return 0x70;
}
return retcode;
}
void VGA_SetupMisc(void) {
@ -155,6 +155,8 @@ void VGA_SetupMisc(void) {
if (IS_VGA_ARCH) {
IO_RegisterReadHandler(0x3ca,read_p3ca,IO_MB);
IO_RegisterReadHandler(0x3cc,read_p3cc,IO_MB);
} else {
IO_RegisterReadHandler(0x3c8,read_p3c8,IO_MB);
}
} else if (machine==MCH_CGA || IS_TANDY_ARCH) {
IO_RegisterReadHandler(0x3da,vga_read_p3da,IO_MB);

View file

@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: int10_modes.cpp,v 1.68 2007-10-13 16:34:06 c2woody Exp $ */
#include <string.h>
#include "dosbox.h"
@ -106,10 +108,10 @@ VideoModeBlock ModeList_VGA[]={
VideoModeBlock ModeList_EGA[]={
/* mode ,type ,sw ,sh ,tw ,th ,cw,ch ,pt,p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@ -117,8 +119,8 @@ VideoModeBlock ModeList_EGA[]={
{ 0x00D ,M_EGA ,320 ,200 ,40 ,25 ,8 ,8 ,8 ,0xA0000 ,0x2000 ,60 ,262 ,40 ,200 ,_EGA_HALF_CLOCK | _EGA_LINE_DOUBLE },
{ 0x00E ,M_EGA ,640 ,200 ,80 ,25 ,8 ,8 ,4 ,0xA0000 ,0x4000 ,120 ,262 ,80 ,200 ,_EGA_LINE_DOUBLE },
{ 0x00F ,M_EGA ,640 ,350 ,80 ,25 ,8 ,14 ,2 ,0xA0000 ,0x8000 ,120 ,440 ,80 ,350 ,0 },/*was EGA_2*/
{ 0x010 ,M_EGA ,640 ,350 ,80 ,25 ,8 ,14 ,2 ,0xA0000 ,0x8000 ,96 ,336 ,80 ,350 ,0 },
{ 0x00F ,M_EGA ,640 ,350 ,80 ,25 ,8 ,14 ,2 ,0xA0000 ,0x8000 ,96 ,366 ,80 ,350 ,0 },/*was EGA_2*/
{ 0x010 ,M_EGA ,640 ,350 ,80 ,25 ,8 ,14 ,2 ,0xA0000 ,0x8000 ,96 ,366 ,80 ,350 ,0 },
{0xFFFF ,M_ERROR ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0x00000 ,0x0000 ,0 ,0 ,0 ,0 ,0 },
};
@ -538,6 +540,7 @@ bool INT10_SetVideoMode(Bitu mode) {
memset(seq_data,0,SEQ_REGS);
if (CurMode->cwidth==8) seq_data[1]|=1; //8 dot fonts by default
if (CurMode->special & _EGA_HALF_CLOCK) seq_data[1]|=0x08; //Check for half clock
if ((machine==MCH_EGA) && (CurMode->special & _EGA_HALF_CLOCK)) seq_data[1]|=0x02;
seq_data[4]|=0x02; //More than 64kb
switch (CurMode->type) {
case M_TEXT:
@ -621,14 +624,22 @@ bool INT10_SetVideoMode(Bitu mode) {
ver_overflow|=((CurMode->vtotal-2) & 0x400) >> 10;
Bitu vretrace;
switch (CurMode->vdispend) {
case 400: vretrace=CurMode->vdispend+12;
break;
case 480: vretrace=CurMode->vdispend+10;
break;
case 350: vretrace=CurMode->vdispend+37;
break;
default: vretrace=CurMode->vdispend+12;
if (IS_VGA_ARCH) {
switch (CurMode->vdispend) {
case 400: vretrace=CurMode->vdispend+12;
break;
case 480: vretrace=CurMode->vdispend+10;
break;
case 350: vretrace=CurMode->vdispend+37;
break;
default: vretrace=CurMode->vdispend+12;
}
} else {
switch (CurMode->vdispend) {
case 350: vretrace=CurMode->vdispend;
break;
default: vretrace=CurMode->vdispend+24;
}
}
/* Vertical Retrace Start */
@ -647,14 +658,22 @@ bool INT10_SetVideoMode(Bitu mode) {
ver_overflow|=((CurMode->vdispend-1) & 0x400) >> 9;
Bitu vblank_trim;
switch (CurMode->vdispend) {
case 400: vblank_trim=6;
break;
case 480: vblank_trim=7;
break;
case 350: vblank_trim=5;
break;
default: vblank_trim=8;
if (IS_VGA_ARCH) {
switch (CurMode->vdispend) {
case 400: vblank_trim=6;
break;
case 480: vblank_trim=7;
break;
case 350: vblank_trim=5;
break;
default: vblank_trim=8;
}
} else {
switch (CurMode->vdispend) {
case 350: vblank_trim=0;
break;
default: vblank_trim+23;
}
}
/* Vertical Blank Start */
@ -723,9 +742,6 @@ bool INT10_SetVideoMode(Bitu mode) {
break;
default:
offset = CurMode->hdispend/2;
if ((machine==MCH_EGA) && (CurMode->type==M_EGA)) {
if (!(CurMode->special & _EGA_LINE_DOUBLE)) offset/=2;
}
}
IO_Write(crtc_base,0x13);
IO_Write(crtc_base + 1,offset & 0xff);
@ -773,7 +789,6 @@ bool INT10_SetVideoMode(Bitu mode) {
mode_control |= 0x08;
break;
}
if (machine==MCH_EGA) mode_control|=0x10;
IO_Write(crtc_base,0x17);IO_Write(crtc_base+1,mode_control);
/* Renable write protection */
@ -870,9 +885,7 @@ bool INT10_SetVideoMode(Bitu mode) {
break;
case 0x10:
case 0x12:
if (IS_VGA_ARCH)
goto att_text16;
// ega fallthrough
goto att_text16;
default:
if ( CurMode->type == M_LIN4 )
goto att_text16;
@ -897,16 +910,9 @@ bool INT10_SetVideoMode(Bitu mode) {
}
real_writeb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL,0x30);
att_text16:
if (machine==MCH_EGA) {
for (i=0;i<8;i++) {
att_data[i]=i;
att_data[i+8]=i+0x10;
}
} else {
for (i=0;i<8;i++) {
att_data[i]=i;
att_data[i+8]=i+0x38;
}
for (i=0;i<8;i++) {
att_data[i]=i;
att_data[i+8]=i+0x38;
}
if (IS_VGA_ARCH) att_data[0x06]=0x14; //Odd Color 6 yellow/brown.
break;