1
0
Fork 0

add partial ega-only machine

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2992
This commit is contained in:
Sebastian Strohhäcker 2007-09-20 16:42:43 +00:00
parent 5c9a311f7b
commit 6188566e38
23 changed files with 208 additions and 111 deletions

View file

@ -325,7 +325,8 @@ public:
DMA(Section* configuration):Module_base(configuration){
Bitu i;
DmaControllers[0] = new DmaController(0);
if (machine==MCH_VGA) DmaControllers[1] = new DmaController(1);
if (IS_EGAVGA_ARCH) DmaControllers[1] = new DmaController(1);
else DmaControllers[1] = NULL;
for (i=0;i<0x10;i++) {
Bitu mask=IO_MB;
@ -333,7 +334,7 @@ public:
/* install handler for first DMA controller ports */
DmaControllers[0]->DMA_WriteHandler[i].Install(i,DMA_Write_Port,mask);
DmaControllers[0]->DMA_ReadHandler[i].Install(i,DMA_Read_Port,mask);
if (machine==MCH_VGA) {
if (IS_EGAVGA_ARCH) {
/* install handler for second DMA controller ports */
DmaControllers[1]->DMA_WriteHandler[i].Install(0xc0+i*2,DMA_Write_Port,mask);
DmaControllers[1]->DMA_ReadHandler[i].Install(0xc0+i*2,DMA_Read_Port,mask);
@ -343,7 +344,7 @@ public:
DmaControllers[0]->DMA_WriteHandler[0x10].Install(0x81,DMA_Write_Port,IO_MB,3);
DmaControllers[0]->DMA_ReadHandler[0x10].Install(0x81,DMA_Read_Port,IO_MB,3);
if (machine==MCH_VGA) {
if (IS_EGAVGA_ARCH) {
/* install handlers for ports 0x81-0x83 (on the second DMA controller) */
DmaControllers[1]->DMA_WriteHandler[0x10].Install(0x89,DMA_Write_Port,IO_MB,3);
DmaControllers[1]->DMA_ReadHandler[0x10].Install(0x89,DMA_Read_Port,IO_MB,3);

View file

@ -791,7 +791,7 @@ private:
MixerObject MixerChan;
public:
GUS(Section* configuration):Module_base(configuration){
if(machine!=MCH_VGA) return;
if(!IS_EGAVGA_ARCH) return;
Section_prop * section=static_cast<Section_prop *>(configuration);
if(!section->Get_bool("gus")) return;
@ -864,7 +864,7 @@ public:
~GUS() {
if(machine!=MCH_VGA) return;
if(!IS_EGAVGA_ARCH) return;
Section_prop * section=static_cast<Section_prop *>(m_configuration);
if(!section->Get_bool("gus")) return;

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: sblaster.cpp,v 1.66 2007-08-08 08:03:48 qbix79 Exp $ */
/* $Id: sblaster.cpp,v 1.67 2007-09-20 16:42:43 c2woody Exp $ */
#include <iomanip>
#include <sstream>
@ -1314,7 +1314,7 @@ private:
else type=SBT_16;
if (type==SBT_16) {
if ((machine!=MCH_VGA) || !SecondDMAControllerAvailable()) type=SBT_PRO2;
if ((!IS_EGAVGA_ARCH) || !SecondDMAControllerAvailable()) type=SBT_PRO2;
}
/* OPL/CMS Init */

View file

@ -56,7 +56,7 @@ void VGA_DetermineMode(void) {
}
/* Test for graphics or alphanumeric mode */
} else if (vga.attr.mode_control & 1) {
if (vga.gfx.mode & 0x40) VGA_SetMode(M_VGA);
if (IS_VGA_ARCH && (vga.gfx.mode & 0x40)) VGA_SetMode(M_VGA);
else if (vga.gfx.mode & 0x20) VGA_SetMode(M_CGA4);
else if ((vga.gfx.miscellaneous & 0x0c)==0x0c) VGA_SetMode(M_CGA2);
else {

View file

@ -27,6 +27,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 ((vga.misc_output&0xc4)==0x40) {
if (val&0x10) val|=0x38;
else {
val&=0x7;
if (val==6) val=0x14;
}
}
}
VGA_DAC_CombineColor(index,val);
}
@ -61,6 +70,7 @@ void write_p3c0(Bitu port,Bitu val,Bitu iolen) {
*/
break;
case 0x10: /* Mode Control Register */
if (!IS_VGA_ARCH) val&=0x1f; // not really correct, but should do it
if ((attr(mode_control) ^ val) & 0x80) {
attr(mode_control)^=0x80;
for (Bitu i=0;i<0x10;i++) {
@ -143,6 +153,10 @@ void write_p3c0(Bitu port,Bitu val,Bitu iolen) {
*/
break;
case 0x14: /* Color Select Register */
if (!IS_VGA_ARCH) {
attr(color_select)=0;
break;
}
if (attr(color_select) ^ val) {
attr(color_select)=val;
for (Bitu i=0;i<0x10;i++) {
@ -190,16 +204,12 @@ Bitu read_p3c1(Bitu port,Bitu iolen) {
};
void VGA_SetupAttr(void) {
if (machine==MCH_VGA) {
IO_RegisterReadHandler(0x3c0,read_p3c0,IO_MB);
if (IS_EGAVGA_ARCH) {
IO_RegisterWriteHandler(0x3c0,write_p3c0,IO_MB);
IO_RegisterReadHandler(0x3c1,read_p3c1,IO_MB);
if (IS_VGA_ARCH) {
IO_RegisterReadHandler(0x3c0,read_p3c0,IO_MB);
IO_RegisterReadHandler(0x3c1,read_p3c1,IO_MB);
}
}
}

View file

@ -124,7 +124,8 @@ void vga_write_p3d5(Bitu port,Bitu val,Bitu iolen) {
case 0x08: /* Preset Row Scan Register */
crtc(preset_row_scan)=val;
vga.config.hlines_skip=val&31;
vga.config.bytes_skip=(val>>5)&3;
if (IS_VGA_ARCH) vga.config.bytes_skip=(val>>5)&3;
else vga.config.bytes_skip=0;
// LOG_DEBUG("Skip lines %d bytes %d",vga.config.hlines_skip,vga.config.bytes_skip);
/*
0-4 Number of lines we have scrolled down in the first character row.
@ -135,7 +136,8 @@ void vga_write_p3d5(Bitu port,Bitu val,Bitu iolen) {
*/
break;
case 0x09: /* Maximum Scan Line Register */
vga.config.line_compare=(vga.config.line_compare & 0x5ff)|(val&0x40)<<3;
if (IS_VGA_ARCH)
vga.config.line_compare=(vga.config.line_compare & 0x5ff)|(val&0x40)<<3;
if ((vga.crtc.maximum_scan_line ^ val) & 0xbf) {
crtc(maximum_scan_line)=val;
VGA_StartResize();
@ -154,7 +156,8 @@ void vga_write_p3d5(Bitu port,Bitu val,Bitu iolen) {
case 0x0A: /* Cursor Start Register */
crtc(cursor_start)=val;
vga.draw.cursor.sline=val&0x1f;
vga.draw.cursor.enabled=!(val&0x20);
if (IS_VGA_ARCH) vga.draw.cursor.enabled=!(val&0x20);
else vga.draw.cursor.enabled=true;
/*
0-4 First scanline of cursor within character.
5 Turns Cursor off if set
@ -203,7 +206,8 @@ void vga_write_p3d5(Bitu port,Bitu val,Bitu iolen) {
break;
case 0x11: /* Vertical Retrace End Register */
crtc(vertical_retrace_end)=val;
crtc(read_only)=(val & 128)>0;
if (IS_VGA_ARCH) crtc(read_only)=(val & 128)>0;
else crtc(read_only)=false;
/*
0-3 Vertical Retrace ends when the last 4 bits of the line counter equals
this value.
@ -242,13 +246,17 @@ void vga_write_p3d5(Bitu port,Bitu val,Bitu iolen) {
break;
case 0x14: /* Underline Location Register */
crtc(underline_location)=val;
//Byte,word,dword mode
if ( crtc(underline_location) & 0x20 )
vga.config.addr_shift = 2;
else if ( crtc( mode_control) & 0x40 )
vga.config.addr_shift = 0;
else
if (IS_VGA_ARCH) {
//Byte,word,dword mode
if ( crtc(underline_location) & 0x20 )
vga.config.addr_shift = 2;
else if ( crtc( mode_control) & 0x40 )
vga.config.addr_shift = 0;
else
vga.config.addr_shift = 1;
} else {
vga.config.addr_shift = 1;
}
/*
0-4 Position of underline within Character cell.
5 If set memory address is only changed every fourth character clock.
@ -291,8 +299,8 @@ void vga_write_p3d5(Bitu port,Bitu val,Bitu iolen) {
vga.tandy.addr_mask = ~0;
vga.tandy.line_shift = 0;
}
VGA_DetermineMode();
//Should we really need to do a determinemode here?
// VGA_DetermineMode();
/*
0 If clear use CGA compatible memory addressing system
by substituting character row scan counter bit 0 for address bit 13,

View file

@ -202,15 +202,29 @@ void VGA_SetupDAC(void) {
vga.dac.state=DAC_READ;
vga.dac.read_index=0;
vga.dac.write_index=0;
if (machine==MCH_VGA) {
if (IS_VGA_ARCH) {
/* Setup the DAC IO port Handlers */
IO_RegisterWriteHandler(0x3c6,write_p3c6,IO_MB);
IO_RegisterReadHandler(0x3c6,read_p3c6,IO_MB);
IO_RegisterWriteHandler(0x3c7,write_p3c7,IO_MB);
IO_RegisterReadHandler(0x3c7,read_p3c7,IO_MB);
IO_RegisterReadHandler(0x3c8,read_p3c8,IO_MB);
IO_RegisterWriteHandler(0x3c8,write_p3c8,IO_MB);
IO_RegisterReadHandler(0x3c8,read_p3c8,IO_MB);
IO_RegisterWriteHandler(0x3c9,write_p3c9,IO_MB);
IO_RegisterReadHandler(0x3c9,read_p3c9,IO_MB);
} else if (machine==MCH_EGA) {
for (Bitu i=0;i<64;i++) {
if ((i&4)>0) vga.dac.rgb[i].red=0x2a;
else vga.dac.rgb[i].red=0;
if ((i&32)>0) vga.dac.rgb[i].red+=0x15;
if ((i&2)>0) vga.dac.rgb[i].green=0x2a;
else vga.dac.rgb[i].green=0;
if ((i&16)>0) vga.dac.rgb[i].green+=0x15;
if ((i&1)>0) vga.dac.rgb[i].blue=0x2a;
else vga.dac.rgb[i].blue=0;
if ((i&8)>0) vga.dac.rgb[i].blue+=0x15;
}
}
};

View file

@ -531,6 +531,8 @@ static void VGA_VerticalTimer(Bitu val) {
vga.draw.address = vga.config.real_start;
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 = ((((vga.config.line_compare&0x5ff)+1)*2-1)/vga.draw.lines_scaled);
switch (vga.mode) {
case M_EGA:
case M_LIN4:
@ -653,12 +655,13 @@ void VGA_SetupDrawing(Bitu val) {
float fps; Bitu clock;
Bitu htotal, hdend, hbstart, hbend, hrstart, hrend;
Bitu vtotal, vdend, vbstart, vbend, vrstart, vrend;
if (machine==MCH_VGA) {
htotal = 5 + vga.crtc.horizontal_total;
if (IS_EGAVGA_ARCH) {
htotal = 2 + vga.crtc.horizontal_total;
if (IS_VGA_ARCH) htotal += 3;
hdend = 1 + vga.crtc.horizontal_display_end;
hbstart = vga.crtc.start_horizontal_blanking;
hbend = vga.crtc.end_horizontal_blanking&0x1F |
((vga.crtc.end_horizontal_retrace&0x80)>>2);
hbend = vga.crtc.end_horizontal_blanking&0x1F;
if (IS_VGA_ARCH) hbend |= (vga.crtc.end_horizontal_retrace&0x80)>>2;
hbend = hbstart + ((hbend - hbstart) & 0x3F);
hrstart = vga.crtc.start_horizontal_retrace;
hrend = vga.crtc.end_horizontal_retrace & 0x1f;
@ -668,15 +671,17 @@ void VGA_SetupDrawing(Bitu val) {
else
hrend = hrstart + hrend;
vtotal=2 + vga.crtc.vertical_total |
((vga.crtc.overflow & 1) << 8) | ((vga.crtc.overflow & 0x20) << 4);
vdend = 1 + (vga.crtc.vertical_display_end |
((vga.crtc.overflow & 2)<<7) |
((vga.crtc.overflow & 0x40) << 3) |
((vga.s3.ex_ver_overflow & 0x2) << 9));
vrstart = vga.crtc.vertical_retrace_start +
((vga.crtc.overflow & 0x04) << 6) |
((vga.crtc.overflow & 0x80) << 2);
vtotal= 2 + vga.crtc.vertical_total | ((vga.crtc.overflow & 1) << 8);
vdend = 1 + vga.crtc.vertical_display_end | ((vga.crtc.overflow & 2)<<7);
vrstart = vga.crtc.vertical_retrace_start + ((vga.crtc.overflow & 0x04) << 6);
if (IS_VGA_ARCH) {
// additional bits only present on vga cards
vtotal |= (vga.crtc.overflow & 0x20) << 4;
vdend |= ((vga.crtc.overflow & 0x40) << 3) |
((vga.s3.ex_ver_overflow & 0x2) << 9);
vrstart |= ((vga.crtc.overflow & 0x80) << 2);
}
vrend = vga.crtc.vertical_retrace_end & 0xF;
vrend = ( vrend - vrstart)&0xF;
if ( !vrend)
@ -684,10 +689,13 @@ void VGA_SetupDrawing(Bitu val) {
else
vrend = vrstart + vrend;
vbstart = vga.crtc.start_vertical_blanking |
((vga.crtc.overflow & 0x08) << 5) |
((vga.crtc.maximum_scan_line & 0x20) << 4);
vbend = vga.crtc.end_vertical_blanking & 0x3f;
vbstart = vga.crtc.start_vertical_blanking | ((vga.crtc.overflow & 0x08) << 5);
if (IS_VGA_ARCH) {
vbstart |= ((vga.crtc.maximum_scan_line & 0x20) << 4);
vbend = vga.crtc.end_vertical_blanking & 0x3f;
} else {
vbend = vga.crtc.end_vertical_blanking & 0xf;
}
vbend = (vbend - vbstart) & 0x3f;
if ( !vbend)
vbend = vbstart + 0x3f + 1;
@ -720,7 +728,9 @@ void VGA_SetupDrawing(Bitu val) {
vga.draw.address_line_total=(vga.crtc.maximum_scan_line&0xf)+1;
/* Check for dual transfer whatever thing,master clock/2 */
if (vga.s3.pll.cmd & 0x10) clock/=2;
vga.draw.double_scan=(vga.crtc.maximum_scan_line&0x80)>0;
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 {
htotal = vga.other.htotal + 1;
hdend = vga.other.hdend;
@ -988,7 +998,7 @@ void VGA_SetupDrawing(Bitu val) {
height/=2;
doubleheight=true;
}
//Only check for exra double heigh in vga modes
//Only check for extra double height in vga modes
if (!doubleheight && (vga.mode<M_TEXT) && !(vga.draw.address_line_total & 1)) {
vga.draw.address_line_total/=2;
doubleheight=true;

View file

@ -213,11 +213,13 @@ static Bitu read_p3cf(Bitu port,Bitu iolen) {
void VGA_SetupGFX(void) {
if (machine==MCH_VGA) {
if (IS_EGAVGA_ARCH) {
IO_RegisterWriteHandler(0x3ce,write_p3ce,IO_MB);
IO_RegisterWriteHandler(0x3cf,write_p3cf,IO_MB);
IO_RegisterReadHandler(0x3ce,read_p3ce,IO_MB);
IO_RegisterReadHandler(0x3cf,read_p3cf,IO_MB);
if (IS_VGA_ARCH) {
IO_RegisterReadHandler(0x3ce,read_p3ce,IO_MB);
IO_RegisterReadHandler(0x3cf,read_p3cf,IO_MB);
}
}
}

View file

@ -799,7 +799,7 @@ void VGA_SetupHandlers(void) {
}
goto range_done;
// MEM_SetPageHandler(vga.tandy.mem_bank<<2,vga.tandy.is_32k_mode ? 0x08 : 0x04,range_handler);
case MCH_VGA:
case EGAVGA_ARCH_CASE:
break;
default:
LOG_MSG("Illegal machine type %d", machine );

View file

@ -143,11 +143,13 @@ static Bitu read_p3c2(Bitu port,Bitu iolen) {
}
void VGA_SetupMisc(void) {
if (machine==MCH_VGA) {
IO_RegisterReadHandler(0x3ca,read_p3ca,IO_MB);
if (IS_EGAVGA_ARCH) {
IO_RegisterReadHandler(0x3c2,read_p3c2,IO_MB);
IO_RegisterWriteHandler(0x3c2,write_p3c2,IO_MB);
IO_RegisterReadHandler(0x3cc,read_p3cc,IO_MB);
if (IS_VGA_ARCH) {
IO_RegisterReadHandler(0x3ca,read_p3ca,IO_MB);
IO_RegisterReadHandler(0x3cc,read_p3cc,IO_MB);
}
} else if (machine==MCH_CGA || IS_TANDY_ARCH) {
IO_RegisterReadHandler(0x3da,vga_read_p3da,IO_MB);
} else if (machine==MCH_HERC) {

View file

@ -70,9 +70,11 @@ void write_p3c5(Bitu port,Bitu val,Bitu iolen) {
case 3: /* Character Map Select */
{
seq(character_map_select)=val;
Bit8u font1=((val & 0x3) << 1) | ((val & 0x10) >> 4);
Bit8u font1=(val & 0x3) << 1;
if (IS_VGA_ARCH) font1|=(val & 0x10) >> 4;
vga.draw.font_tables[0]=&vga.draw.font[font1*8*1024];
Bit8u font2=((val & 0xc) >> 1) | ((val & 0x20) >> 5);
Bit8u font2=((val & 0xc) >> 1);
if (IS_VGA_ARCH) font2|=(val & 0x20) >> 5;
vga.draw.font_tables[1]=&vga.draw.font[font2*8*1024];
}
/*
@ -94,10 +96,12 @@ void write_p3c5(Bitu port,Bitu val,Bitu iolen) {
rather than the Map Mask and Read Map Select Registers.
*/
seq(memory_mode)=val;
/* Changing this means changing the VGA Memory Read/Write Handler */
if (val&0x08) vga.config.chained=true;
else vga.config.chained=false;
VGA_SetupHandlers();
if (IS_VGA_ARCH) {
/* Changing this means changing the VGA Memory Read/Write Handler */
if (val&0x08) vga.config.chained=true;
else vga.config.chained=false;
VGA_SetupHandlers();
}
break;
default:
switch (svgaCard) {
@ -139,11 +143,13 @@ Bitu read_p3c5(Bitu port,Bitu iolen) {
void VGA_SetupSEQ(void) {
if (machine==MCH_VGA) {
if (IS_EGAVGA_ARCH) {
IO_RegisterWriteHandler(0x3c4,write_p3c4,IO_MB);
IO_RegisterWriteHandler(0x3c5,write_p3c5,IO_MB);
IO_RegisterReadHandler(0x3c4,read_p3c4,IO_MB);
IO_RegisterReadHandler(0x3c5,read_p3c5,IO_MB);
if (IS_VGA_ARCH) {
IO_RegisterReadHandler(0x3c4,read_p3c4,IO_MB);
IO_RegisterReadHandler(0x3c5,read_p3c5,IO_MB);
}
}
}

View file

@ -1073,7 +1073,7 @@ Bitu XGA_Read(Bitu port, Bitu len) {
}
void VGA_SetupXGA(void) {
if (machine!=MCH_VGA) return;
if (!IS_VGA_ARCH) return;
memset(&xga, 0, sizeof(XGAStatus));
@ -1165,8 +1165,4 @@ void VGA_SetupXGA(void) {
IO_RegisterWriteHandler(0xe2ea,&XGA_Write,IO_MB | IO_MW | IO_MD);
IO_RegisterReadHandler(0xe2ea,&XGA_Read,IO_MB | IO_MW | IO_MD);
}