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

@ -44,6 +44,7 @@ enum MachineType {
MCH_CGA,
MCH_TANDY,
MCH_PCJR,
MCH_EGA,
MCH_VGA
};
@ -57,7 +58,11 @@ extern MachineType machine;
extern bool SDLNetInited;
#define IS_TANDY_ARCH ((machine==MCH_TANDY) || (machine==MCH_PCJR))
#define IS_EGAVGA_ARCH ((machine==MCH_EGA) || (machine==MCH_VGA))
#define IS_VGA_ARCH (machine==MCH_VGA)
#define TANDY_ARCH_CASE MCH_TANDY: case MCH_PCJR
#define EGAVGA_ARCH_CASE MCH_EGA: case MCH_VGA
#define VGA_ARCH_CASE MCH_VGA
#ifndef DOSBOX_LOGGING_H
#include "logging.h"

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dev_con.h,v 1.32 2007-06-30 19:33:45 c2woody Exp $ */
/* $Id: dev_con.h,v 1.33 2007-09-20 16:42:43 c2woody Exp $ */
#include "dos_inc.h"
#include "../ints/int10.h"
@ -62,7 +62,7 @@ bool device_CON::Read(Bit8u * data,Bit16u * size) {
readcache=0;
}
while (*size>count) {
reg_ah=(machine==MCH_VGA)?0x10:0x0;
reg_ah=(IS_EGAVGA_ARCH)?0x10:0x0;
CALLBACK_RunRealInt(0x16);
switch(reg_al) {
case 13:

View file

@ -887,7 +887,7 @@ Bitu keyboard_layout::read_codepage_file(const char* codepage_file_name, Bit32s
dos.loaded_codepage=(Bit16u)(codepage_id&0xffff);
// update font if necessary
if (font_changed && (CurMode->type==M_TEXT) && (machine==MCH_VGA)) {
if (font_changed && (CurMode->type==M_TEXT) && (IS_EGAVGA_ARCH)) {
INT10_LoadFont(Real2Phys(int10.rom.font_16),true,256,0,0,16);
}
INT10_SetupRomMemoryChecksum();

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dosbox.cpp,v 1.121 2007-08-16 07:50:31 c2woody Exp $ */
/* $Id: dosbox.cpp,v 1.122 2007-09-20 16:42:43 c2woody Exp $ */
#include <stdlib.h>
#include <stdarg.h>
@ -254,7 +254,7 @@ static void DOSBOX_RealInit(Section * sec) {
"# They are used to (briefly) document the effect of each option.\n");
MAPPER_AddHandler(DOSBOX_UnlockSpeed, MK_f12, MMOD2,"speedlock","Speedlock");
svgaCard = SVGA_S3Trio;
svgaCard=SVGA_None;
machine=MCH_VGA;
std::string cmd_machine;
const char * mtype;
@ -264,8 +264,11 @@ static void DOSBOX_RealInit(Section * sec) {
else if (strcasecmp(mtype,"tandy")==0) machine=MCH_TANDY;
else if (strcasecmp(mtype,"pcjr")==0) machine=MCH_PCJR;
else if (strcasecmp(mtype,"hercules")==0) machine=MCH_HERC;
else if (strcasecmp(mtype,"vga")==0) machine=MCH_VGA;
else LOG_MSG("DOSBOX:Unknown machine type %s",mtype);
else if (strcasecmp(mtype,"ega")==0) machine=MCH_EGA;
else if (strcasecmp(mtype,"vga")==0) {
machine=MCH_VGA;
svgaCard=SVGA_S3Trio;
} else LOG_MSG("DOSBOX:Unknown machine type %s",mtype);
}

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);
}

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: bios.cpp,v 1.68 2007-06-12 20:22:08 c2woody Exp $ */
/* $Id: bios.cpp,v 1.69 2007-09-20 16:42:43 c2woody Exp $ */
#include "dosbox.h"
#include "mem.h"
@ -705,7 +705,7 @@ static Bitu INT15_Handler(void) {
LOG(LOG_BIOS,LOG_ERROR)("INT15:Unknown call %4X",reg_ax);
reg_ah=0x86;
CALLBACK_SCF(true);
if ((machine==MCH_VGA) || (machine==MCH_CGA)) {
if ((IS_EGAVGA_ARCH) || (machine==MCH_CGA)) {
/* relict from comparisons, as int15 exits with a retf2 instead of an iret */
CALLBACK_SZF(false);
}
@ -917,7 +917,7 @@ public:
//Startup monochrome
config|=0x30;
break;
case MCH_VGA:
case EGAVGA_ARCH_CASE:
case MCH_CGA:
case TANDY_ARCH_CASE:
//Startup 80x25 color

View file

@ -140,7 +140,9 @@ static Bitu INT10_Handler(void) {
reg_al=real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_MODE)|(real_readb(BIOSMEM_SEG,BIOSMEM_VIDEO_CTL)&0x80);
reg_ah=(Bit8u)real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS);
break;
case 0x10: /* EGA/VGA Palette functions */
case 0x10: /* Palette functions */
if ((machine==MCH_CGA) || ((!IS_VGA_ARCH) && (reg_al>0x02))) break;
//TODO: subfunction 0x03 for ega
switch (reg_al) {
case 0x00: /* SET SINGLE PALETTE REGISTER */
INT10_SetSinglePaletteRegister(reg_bl,reg_bh);
@ -195,7 +197,7 @@ static Bitu INT10_Handler(void) {
}
break;
case 0x11: /* Character generator functions */
if (machine<MCH_VGA)
if (!IS_EGAVGA_ARCH)
break;
switch (reg_al) {
/* Textmode calls */
@ -216,6 +218,7 @@ static Bitu INT10_Handler(void) {
break;
case 0x04: /* Load 8x16 font */
case 0x14:
if (!IS_VGA_ARCH) break;
INT10_LoadFont(Real2Phys(int10.rom.font_16),reg_al==0x14,256,0,0,16);
break;
/* Graphics mode calls */
@ -235,6 +238,7 @@ static Bitu INT10_Handler(void) {
real_writew(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT,8);
goto graphics_chars;
case 0x24: /* Rom 8x16 set */
if (!IS_VGA_ARCH) break;
RealSetVec(0x43,int10.rom.font_16);
real_writew(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT,16);
goto graphics_chars;
@ -277,6 +281,7 @@ graphics_chars:
reg_bp=RealOff(int10.rom.font_8_second);
break;
case 0x06: /* font 8x16 */
if (!IS_VGA_ARCH) break;
SegSet16(es,RealSeg(int10.rom.font_16));
reg_bp=RealOff(int10.rom.font_16);
break;
@ -291,7 +296,7 @@ graphics_chars:
}
break;
case 0x12: /* alternate function select */
if (machine<MCH_VGA)
if (!IS_EGAVGA_ARCH)
break;
switch (reg_bl) {
case 0x10: /* Get EGA Information */
@ -302,20 +307,27 @@ graphics_chars:
case 0x20: /* Set alternate printscreen */
break;
case 0x30: /* Select vertical resolution */
case 0x32: /* Video adressing */
if (!IS_VGA_ARCH) break;
LOG(LOG_INT10,LOG_ERROR)("Function 12:Call %2X not handled",reg_bl);
reg_al=0x12; //fake a success call
break;
case 0x31: /* Palette loading on modeset */
{
if (!IS_VGA_ARCH) break;
Bit8u temp = real_readb(BIOSMEM_SEG,BIOSMEM_MODESET_CTL) & 0xf7;
if (reg_al&1) temp|=8; // enable if al=0
real_writeb(BIOSMEM_SEG,BIOSMEM_MODESET_CTL,temp);
reg_al=0x12;
break;
}
case 0x32: /* Video adressing */
if (!IS_VGA_ARCH) break;
LOG(LOG_INT10,LOG_ERROR)("Function 12:Call %2X not handled",reg_bl);
reg_al=0x12; //fake a success call
break;
case 0x33: /* SWITCH GRAY-SCALE SUMMING */
{
if (!IS_VGA_ARCH) break;
Bit8u temp = real_readb(BIOSMEM_SEG,BIOSMEM_MODESET_CTL) & 0xfd;
if (!(reg_al&1)) temp|=2; // enable if al=0
real_writeb(BIOSMEM_SEG,BIOSMEM_MODESET_CTL,temp);
@ -325,12 +337,19 @@ graphics_chars:
case 0x34: /* ALTERNATE FUNCTION SELECT (VGA) - CURSOR EMULATION */
{
// bit 0: 0=enable, 1=disable
if (!IS_VGA_ARCH) break;
Bit8u temp = real_readb(BIOSMEM_SEG,BIOSMEM_VIDEO_CTL) & 0xfe;
real_writeb(BIOSMEM_SEG,BIOSMEM_VIDEO_CTL,temp|reg_al);
reg_al=0x12;
break;
}
case 0x35:
if (!IS_VGA_ARCH) break;
LOG(LOG_INT10,LOG_ERROR)("Function 12:Call %2X not handled",reg_bl);
reg_al=0x12;
break;
case 0x36: /* VGA Refresh control */
if (!IS_VGA_ARCH) break;
/*
Call disables/enables the vga from outputting video,
don't support it, but fake a success return
@ -347,7 +366,7 @@ graphics_chars:
INT10_WriteString(reg_dh,reg_dl,reg_al,reg_bl,SegPhys(es)+reg_bp,reg_cx,reg_bh);
break;
case 0x1A: /* Display Combination */
if (machine<MCH_VGA) break;
if (!IS_VGA_ARCH) break;
if (reg_al==0) {
reg_bx=real_readb(BIOSMEM_SEG,BIOSMEM_DCC_INDEX);
reg_al=0x1A;
@ -360,7 +379,7 @@ graphics_chars:
}
break;
case 0x1B: /* functionality State Information */
if (machine<MCH_VGA) break;
if (!IS_VGA_ARCH) break;
switch (reg_bx) {
case 0x0000:
INT10_GetFuncStateInformation(SegPhys(es)+reg_di);
@ -371,11 +390,12 @@ graphics_chars:
}
break;
case 0x1C: /* Video Save Area */
if (machine<MCH_VGA) break;
if (IS_VGA_ARCH) break;
if (reg_al==0) reg_bx = 0;
reg_al = 0x1C;
break;
case 0x4f: /* VESA Calls */
if ((!IS_VGA_ARCH) || (svgaCard==SVGA_None)) break;
switch (reg_al) {
case 0x00: /* Get SVGA Information */
reg_al=0x4f;

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: int10_char.cpp,v 1.50 2007-06-12 20:22:08 c2woody Exp $ */
/* $Id: int10_char.cpp,v 1.51 2007-09-20 16:42:43 c2woody Exp $ */
/* Character displaying moving functions */
@ -271,14 +271,13 @@ filling:
}
void INT10_SetActivePage(Bit8u page) {
Bit16u mem_address;
if (page>7) return;
mem_address=page*real_readw(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE);
/* Write the new page start */
real_writew(BIOSMEM_SEG,BIOSMEM_CURRENT_START,mem_address);
if (machine==MCH_VGA && CurMode->mode<0x8) mem_address>>=1;
if (IS_EGAVGA_ARCH && CurMode->mode<0x8) mem_address>>=1;
/* Write the new start address in vgahardware */
Bit16u base=real_readw(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS);
IO_Write(base,0x0c);
@ -522,7 +521,7 @@ void WriteChar(Bit16u col,Bit16u row,Bit8u page,Bit8u chr,Bit8u attr,bool useatt
void INT10_WriteChar(Bit8u chr,Bit8u attr,Bit8u page,Bit16u count,bool showattr) {
if (CurMode->type!=M_TEXT) {
switch (machine) {
case MCH_VGA:
case EGAVGA_ARCH_CASE:
page%=CurMode->ptotal;
break;
case MCH_CGA:

View file

@ -78,14 +78,16 @@ void INT10_SetupRomMemory(void) {
PhysPt rom_base=PhysMake(0xc000,0);
Bitu i;
int10.rom.used=3;
if (machine==MCH_VGA) {
if (IS_EGAVGA_ARCH) {
// set up the start of the ROM
phys_writew(rom_base+0,0xaa55);
phys_writeb(rom_base+2,0x40); // Size of ROM: 64 512-blocks = 32KB
phys_writeb(rom_base+0x1e,0x49); // IBM string
phys_writeb(rom_base+0x1f,0x42);
phys_writeb(rom_base+0x20,0x4d);
phys_writeb(rom_base+0x21,0x00);
if (IS_VGA_ARCH) {
phys_writeb(rom_base+0x1e,0x49); // IBM string
phys_writeb(rom_base+0x1f,0x42);
phys_writeb(rom_base+0x20,0x4d);
phys_writeb(rom_base+0x21,0x00);
}
int10.rom.used=0x100;
}
int10.rom.font_8_first=RealMake(0xC000,int10.rom.used);
@ -116,7 +118,7 @@ void INT10_SetupRomMemory(void) {
if (IS_TANDY_ARCH) {
RealSetVec(0x44,int10.rom.font_8_first);
}
if (machine == MCH_VGA) { //EGA/VGA. Just to be safe
if (IS_EGAVGA_ARCH) { //EGA/VGA. Just to be safe
//Reserve checksum location
checksumlocation = int10.rom.used++;
}
@ -145,7 +147,7 @@ void INT10_ReloadRomFonts(void) {
}
void INT10_SetupRomMemoryChecksum(void) {
if (machine == MCH_VGA) { //EGA/VGA. Just to be safe
if (IS_EGAVGA_ARCH) { //EGA/VGA. Just to be safe
/* Sum of all bytes in rom module 256 should be 0 */
Bit8u sum = 0;
PhysPt rom_base = PhysMake(0xc000,0);

View file

@ -272,7 +272,7 @@ static void FinishSetMode(bool clearmem) {
real_writeb(BIOSMEM_SEG,BIOSMEM_MODESET_CTL,real_readb(BIOSMEM_SEG,BIOSMEM_MODESET_CTL)&0x7f);
// FIXME We nearly have the good tables. to be reworked
if (machine==MCH_VGA) real_writeb(BIOSMEM_SEG,BIOSMEM_DCC_INDEX,0x08); // 8 is VGA should be ok for now
if (IS_VGA_ARCH) real_writeb(BIOSMEM_SEG,BIOSMEM_DCC_INDEX,0x08); // 8 is VGA should be ok for now
real_writew(BIOSMEM_SEG,BIOSMEM_VS_POINTER,0x00);
real_writew(BIOSMEM_SEG,BIOSMEM_VS_POINTER+2,0x00);
@ -468,7 +468,11 @@ bool INT10_SetVideoMode(Bitu mode) {
mode-=0x80;
}
LOG(LOG_INT10,LOG_NORMAL)("Set Video Mode %X",mode);
if (machine!=MCH_VGA) return INT10_SetVideoMode_OTHER(mode,clearmem);
if (!IS_EGAVGA_ARCH) return INT10_SetVideoMode_OTHER(mode,clearmem);
if ((machine==MCH_EGA) && (mode>0x10)) {
LOG(LOG_INT10,LOG_ERROR)("EGA:Trying to set illegal mode %X",mode);
return false;
}
Bit8u modeset_ctl,video_ctl,vga_switches;
if (!SetCurMode(ModeList_VGA,mode)){
@ -643,7 +647,10 @@ bool INT10_SetVideoMode(Bitu mode) {
ver_overflow|=(line_compare & 0x400) >> 4;
Bit8u underline=0;
/* Maximum scanline / Underline Location */
if (CurMode->special & _EGA_LINE_DOUBLE) max_scanline|=0x80;
if (CurMode->special & _EGA_LINE_DOUBLE) {
if (machine==MCH_EGA) max_scanline=1;
else max_scanline|=0x80;
}
switch (CurMode->type) {
case M_TEXT:
max_scanline|=CurMode->cheight-1;
@ -661,7 +668,8 @@ bool INT10_SetVideoMode(Bitu mode) {
break;
case M_CGA2:
case M_CGA4:
max_scanline|=1;
if (machine==MCH_EGA) max_scanline|=2;
else max_scanline|=1;
break;
}
if (CurMode->vdispend==350) underline=0x0f;
@ -819,13 +827,23 @@ bool INT10_SetVideoMode(Bitu mode) {
for (i=1;i<16;i++) att_data[i]=0x3f;
break;
case 0x10:
case 0x12: goto att_text16;
case 0x12:
if (IS_VGA_ARCH)
goto att_text16;
// ega fallthrough
default:
if ( CurMode->type == M_LIN4 )
goto att_text16;
for (i=0;i<8;i++) {
att_data[i]=i;
att_data[i+8]=i+0x10;
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;
}
}
break;
}
@ -929,7 +947,7 @@ dac_text16:
}
break;
}
if (machine==MCH_VGA) {
if (IS_VGA_ARCH) {
/* check if gray scale summing is enabled */
if (real_readb(BIOSMEM_SEG,BIOSMEM_MODESET_CTL) & 2) {
INT10_PerformGrayScaleSumming(0,256);

View file

@ -39,7 +39,8 @@ void INT10_SetSinglePaletteRegister(Bit8u reg,Bit8u val) {
IO_Read(VGAREG_TDY_RESET);
WriteTandyACTL(reg+0x10,val);
break;
case MCH_VGA:
case EGAVGA_ARCH_CASE:
if (!IS_VGA_ARCH) reg&=0x1f;
if(reg<=ACTL_MAX_REG) {
ResetACTL();
IO_Write(VGAREG_ACTL_ADDRESS,reg);
@ -70,7 +71,7 @@ void INT10_SetAllPaletteRegisters(PhysPt data) {
// Then the border
WriteTandyACTL(0x02,mem_readb(data));
break;
case MCH_VGA:
case EGAVGA_ARCH_CASE:
ResetACTL();
// First the colors
for(Bit8u i=0;i<0x10;i++) {
@ -215,7 +216,7 @@ void INT10_SetBackgroundBorder(Bit8u val) {
real_writeb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL,temp);
if (machine == MCH_CGA || IS_TANDY_ARCH)
IO_Write(0x3d9,temp);
else if (machine == MCH_VGA) {
else if (IS_EGAVGA_ARCH) {
val = ((val << 1) & 0x10) | (val & 0x7);
/* Aways set the overscan color */
INT10_SetSinglePaletteRegister( 0x11, val );
@ -238,7 +239,7 @@ void INT10_SetColorSelect(Bit8u val) {
real_writeb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL,temp);
if (machine == MCH_CGA || IS_TANDY_ARCH)
IO_Write(0x3d9,temp);
else if (machine == MCH_VGA) {
else if (IS_EGAVGA_ARCH) {
if (CurMode->mode <= 3) //Maybe even skip the total function!
return;
val = (temp & 0x10) | 2 | val;