several ega machine fixes (mode parameters, double scanning, palette data etc.)
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3011
This commit is contained in:
parent
53350b35be
commit
129fbb70fd
3 changed files with 77 additions and 49 deletions
|
@ -28,12 +28,10 @@ void VGA_ATTR_SetPalette(Bit8u index,Bit8u val) {
|
|||
val &= 63;
|
||||
val |= (vga.attr.color_select & 0xc) << 4;
|
||||
if (GCC_UNLIKELY(!IS_VGA_ARCH)) {
|
||||
if ((vga.misc_output&0xc4)==0x40) {
|
||||
if (val&0x10) val|=0x38;
|
||||
else {
|
||||
val&=0x7;
|
||||
if (val==6) val=0x14;
|
||||
}
|
||||
if (val&0x10) val|=0x38;
|
||||
else {
|
||||
val&=0x7;
|
||||
if (val==6) val=0x14;
|
||||
}
|
||||
}
|
||||
VGA_DAC_CombineColor(index,val);
|
||||
|
|
|
@ -584,6 +584,7 @@ static void VGA_VerticalTimer(Bitu val) {
|
|||
vga.draw.address_line = vga.config.hlines_skip;
|
||||
vga.draw.split_line = (vga.config.line_compare/vga.draw.lines_scaled);
|
||||
// go figure...
|
||||
if (machine==MCH_EGA) vga.draw.split_line*=2;
|
||||
// if (machine==MCH_EGA) vga.draw.split_line = ((((vga.config.line_compare&0x5ff)+1)*2-1)/vga.draw.lines_scaled);
|
||||
switch (vga.mode) {
|
||||
case M_EGA:
|
||||
|
@ -637,8 +638,10 @@ static void VGA_VerticalTimer(Bitu val) {
|
|||
PIC_AddEvent(VGA_DrawPart,(float)vga.draw.delay.parts,vga.draw.parts_lines);
|
||||
// PIC_AddEvent(VGA_DrawPart,(float)(vga.draw.delay.parts/2),vga.draw.parts_lines); //Else tearline in Tyrian and second reality
|
||||
if (GCC_UNLIKELY(machine==MCH_EGA)) {
|
||||
PIC_ActivateIRQ(2);
|
||||
vga.draw.vret_triggered=true;
|
||||
if (!(vga.crtc.vertical_retrace_end&0x20)) {
|
||||
PIC_ActivateIRQ(2);
|
||||
vga.draw.vret_triggered=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -787,7 +790,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=false; // might actually be a special implementation of double scanning for ega
|
||||
else vga.draw.double_scan=(vga.seq.clocking_mode&0x08)>0; // not really correct...
|
||||
} else {
|
||||
htotal = vga.other.htotal + 1;
|
||||
hdend = vga.other.hdend;
|
||||
|
@ -850,7 +853,7 @@ void VGA_SetupDrawing(Bitu val) {
|
|||
/*
|
||||
// just curious
|
||||
LOG_MSG("H total %d, V Total %d",htotal,vtotal);
|
||||
LOG_MSG("H D End %d, V D End %d",hdispend,vdispend);
|
||||
LOG_MSG("H D End %d, V D End %d",hdend,vdend);
|
||||
LOG_MSG("vrstart: %d, vrend: %d\n",vrstart,vrend);
|
||||
LOG_MSG("htotal: %2.6f, vtotal: %2.6f,\n"\
|
||||
"hblkstart: %2.6f, hblkend: %2.6f,\n"\
|
||||
|
@ -861,8 +864,8 @@ void VGA_SetupDrawing(Bitu val) {
|
|||
vga.draw.delay.hblkstart, vga.draw.delay.hblkend,
|
||||
vga.draw.delay.vblkstart, vga.draw.delay.vblkend,
|
||||
vga.draw.delay.vrstart, vga.draw.delay.vrend,
|
||||
vga.draw.delay.vend);
|
||||
*/
|
||||
vga.draw.delay.vdend);
|
||||
*/
|
||||
vga.draw.parts_total=VGA_PARTS;
|
||||
/*
|
||||
6 Horizontal Sync Polarity. Negative if set
|
||||
|
@ -904,6 +907,7 @@ void VGA_SetupDrawing(Bitu val) {
|
|||
|
||||
vga.draw.delay.parts = vga.draw.delay.vdend/vga.draw.parts_total;
|
||||
vga.draw.resizing=false;
|
||||
vga.draw.vret_triggered=false;
|
||||
|
||||
//Check to prevent useless black areas
|
||||
if (hbstart<hdend) hdend=hbstart;
|
||||
|
@ -1057,7 +1061,7 @@ void VGA_SetupDrawing(Bitu val) {
|
|||
};
|
||||
VGA_CheckScanLength();
|
||||
if (vga.draw.double_scan) {
|
||||
height/=2;
|
||||
if (IS_VGA_ARCH) height/=2;
|
||||
doubleheight=true;
|
||||
}
|
||||
//Only check for extra double height in vga modes
|
||||
|
|
|
@ -106,19 +106,19 @@ VideoModeBlock ModeList_VGA[]={
|
|||
|
||||
VideoModeBlock ModeList_EGA[]={
|
||||
/* mode ,type ,sw ,sh ,tw ,th ,cw,ch ,pt,pstart ,plength,htot,vtot,hde,vde special flags */
|
||||
{ 0x000 ,M_TEXT ,320 ,350 ,40 ,25 ,8 ,14 ,8 ,0xB8000 ,0x0800 ,50 ,449 ,40 ,350 ,_EGA_HALF_CLOCK },
|
||||
{ 0x001 ,M_TEXT ,320 ,350 ,40 ,25 ,8 ,14 ,8 ,0xB8000 ,0x0800 ,50 ,449 ,40 ,350 ,_EGA_HALF_CLOCK },
|
||||
{ 0x002 ,M_TEXT ,640 ,350 ,80 ,25 ,8 ,14 ,8 ,0xB8000 ,0x1000 ,100 ,449 ,80 ,350 ,0 },
|
||||
{ 0x003 ,M_TEXT ,640 ,350 ,80 ,25 ,8 ,14 ,8 ,0xB8000 ,0x1000 ,100 ,449 ,80 ,350 ,0 },
|
||||
{ 0x004 ,M_CGA4 ,320 ,200 ,40 ,25 ,8 ,8 ,1 ,0xB8000 ,0x4000 ,50 ,449 ,40 ,400 ,_EGA_HALF_CLOCK | _EGA_LINE_DOUBLE},
|
||||
{ 0x005 ,M_CGA4 ,320 ,200 ,40 ,25 ,8 ,8 ,1 ,0xB8000 ,0x4000 ,50 ,449 ,40 ,400 ,_EGA_HALF_CLOCK | _EGA_LINE_DOUBLE},
|
||||
{ 0x006 ,M_CGA2 ,640 ,200 ,80 ,25 ,8 ,8 ,1 ,0xB8000 ,0x4000 ,100 ,449 ,80 ,400 ,_EGA_HALF_CLOCK | _EGA_LINE_DOUBLE},
|
||||
{ 0x007 ,M_TEXT ,720 ,350 ,80 ,25 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GA_LINE_DOUBLE },
|
||||
{ 0x00F ,M_EGA ,640 ,350 ,80 ,25 ,8 ,14 ,2 ,0xA0000 ,0x8000 ,100 ,449 ,80 ,350 ,0 },/*was EGA_2*/
|
||||
{ 0x010 ,M_EGA ,640 ,350 ,80 ,25 ,8 ,14 ,2 ,0xA0000 ,0x8000 ,100 ,449 ,80 ,350 ,0 },
|
||||
{ 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 },
|
||||
|
||||
{0xFFFF ,M_ERROR ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0x00000 ,0x0000 ,0 ,0 ,0 ,0 ,0 },
|
||||
};
|
||||
|
@ -542,14 +542,20 @@ bool INT10_SetVideoMode(Bitu mode) {
|
|||
switch (CurMode->type) {
|
||||
case M_TEXT:
|
||||
seq_data[2]|=0x3; //Enable plane 0 and 1
|
||||
seq_data[4]|=0x05; //Alpanumeric and odd/even enabled
|
||||
seq_data[4]|=0x01; //Alpanumeric
|
||||
if (IS_VGA_ARCH) seq_data[4]|=0x04; //odd/even enabled
|
||||
break;
|
||||
case M_CGA2:
|
||||
seq_data[2]|=0xf; //Enable plane 0
|
||||
if (machine==MCH_EGA) seq_data[4]|=0x04; //odd/even enabled
|
||||
break;
|
||||
case M_CGA4:
|
||||
if (machine==MCH_EGA) seq_data[2]|=0x03; //Enable plane 0 and 1
|
||||
break;
|
||||
case M_LIN4:
|
||||
case M_EGA:
|
||||
seq_data[2]|=0xf; //Enable all planes for writing
|
||||
if (machine==MCH_EGA) seq_data[4]|=0x04; //odd/even enabled
|
||||
break;
|
||||
case M_LIN8: //Seems to have the same reg layout from testing
|
||||
case M_LIN15:
|
||||
|
@ -669,8 +675,7 @@ bool INT10_SetVideoMode(Bitu mode) {
|
|||
Bit8u underline=0;
|
||||
/* Maximum scanline / Underline Location */
|
||||
if (CurMode->special & _EGA_LINE_DOUBLE) {
|
||||
if (machine==MCH_EGA) max_scanline=1;
|
||||
else max_scanline|=0x80;
|
||||
if (machine!=MCH_EGA) max_scanline|=0x80;
|
||||
}
|
||||
switch (CurMode->type) {
|
||||
case M_TEXT:
|
||||
|
@ -689,8 +694,7 @@ bool INT10_SetVideoMode(Bitu mode) {
|
|||
break;
|
||||
case M_CGA2:
|
||||
case M_CGA4:
|
||||
if (machine==MCH_EGA) max_scanline|=2;
|
||||
else max_scanline|=1;
|
||||
max_scanline|=1;
|
||||
break;
|
||||
}
|
||||
if (CurMode->vdispend==350) underline=0x0f;
|
||||
|
@ -719,6 +723,9 @@ 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);
|
||||
|
@ -746,8 +753,14 @@ bool INT10_SetVideoMode(Bitu mode) {
|
|||
case M_EGA:
|
||||
if (CurMode->mode==0x11) // 0x11 also sets address wrap. thought maybe all 2 color modes did but 0x0f doesn't.
|
||||
mode_control=0xc3; // so.. 0x11 or 0x0f a one off?
|
||||
else
|
||||
mode_control=0xe3;
|
||||
else {
|
||||
if (machine==MCH_EGA) {
|
||||
if (CurMode->special & _EGA_LINE_DOUBLE) mode_control=0xc3;
|
||||
else mode_control=0x8b;
|
||||
} else {
|
||||
mode_control=0xe3;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case M_TEXT:
|
||||
case M_VGA:
|
||||
|
@ -760,6 +773,7 @@ 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 */
|
||||
|
@ -819,8 +833,15 @@ bool INT10_SetVideoMode(Bitu mode) {
|
|||
break;
|
||||
case M_CGA4:
|
||||
gfx_data[0x5]|=0x20; //CGA mode
|
||||
case M_CGA2:
|
||||
gfx_data[0x6]|=0x0f; //graphics mode at at 0xb800=0xbfff
|
||||
if (machine==MCH_EGA) gfx_data[0x5]|=0x10;
|
||||
break;
|
||||
case M_CGA2:
|
||||
if (machine==MCH_EGA) {
|
||||
gfx_data[0x6]|=0x0d; //graphics mode at at 0xb800=0xbfff
|
||||
} else {
|
||||
gfx_data[0x6]|=0x0f; //graphics mode at at 0xb800=0xbfff
|
||||
}
|
||||
break;
|
||||
}
|
||||
for (i=0;i<GFX_REGS;i++) {
|
||||
|
@ -855,16 +876,9 @@ bool INT10_SetVideoMode(Bitu mode) {
|
|||
default:
|
||||
if ( CurMode->type == M_LIN4 )
|
||||
goto att_text16;
|
||||
if (!IS_VGA_ARCH) {
|
||||
for (i=0;i<8;i++) {
|
||||
att_data[i]=i;
|
||||
att_data[i+8]=i+0x38;
|
||||
}
|
||||
} else {
|
||||
for (i=0;i<8;i++) {
|
||||
att_data[i]=i;
|
||||
att_data[i+8]=i+0x10;
|
||||
}
|
||||
for (i=0;i<8;i++) {
|
||||
att_data[i]=i;
|
||||
att_data[i+8]=i+0x10;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -874,15 +888,27 @@ bool INT10_SetVideoMode(Bitu mode) {
|
|||
for (i=0;i<16;i++) att_data[i]=i;
|
||||
break;
|
||||
case M_TEXT:
|
||||
att_data[0x13]=0x08; //Pel panning on 8, although we don't have 9 dot text mode
|
||||
att_data[0x10]=0x0C; //Color Text with blinking
|
||||
if (machine==MCH_EGA) {
|
||||
att_data[0x13]=0x00;
|
||||
att_data[0x10]=0x08; //8 Bit characters
|
||||
} else {
|
||||
att_data[0x13]=0x08; //Pel panning on 8, although we don't have 9 dot text mode
|
||||
att_data[0x10]=0x0C; //Color Text with blinking
|
||||
}
|
||||
real_writeb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL,0x30);
|
||||
att_text16:
|
||||
for (i=0;i<8;i++) {
|
||||
att_data[i]=i;
|
||||
att_data[i+8]=i+0x38;
|
||||
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;
|
||||
}
|
||||
}
|
||||
att_data[0x06]=0x14; //Odd Color 6 yellow/brown.
|
||||
if (IS_VGA_ARCH) att_data[0x06]=0x14; //Odd Color 6 yellow/brown.
|
||||
break;
|
||||
case M_CGA2:
|
||||
att_data[0x10]=0x01; //Color Graphics
|
||||
|
|
Loading…
Add table
Reference in a new issue