1
0
Fork 0

Fix up hercules graphics mode a bit

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1593
This commit is contained in:
Sjoerd van der Berg 2004-01-17 09:56:33 +00:00
parent 902533e079
commit ca58b4cf61
3 changed files with 18 additions and 12 deletions

View file

@ -28,7 +28,7 @@
#define FIXED_CGA_SIZED 1
static void VGA_HERC_Draw(Bit8u * bitdata,Bitu pitch) {
Bit8u * reader=&vga.mem.linear[(vga.herc.mode_control & 0x80) ? 8*1024 : 0];
Bit8u * reader=&vga.mem.linear[0];
for (Bitu y=0;y<vga.draw.height;y++) {
Bit8u * tempread=reader+((y & 3) * 8 * 1024);
Bit8u * draw=bitdata;
@ -250,7 +250,6 @@ static void VGA_BlankTimer() {
vga.config.retrace=true;
}
void VGA_DrawHandler(RENDER_Part_Handler part_handler) {
Bit8u * buf,* bufsplit;
/* Draw the current frame */
@ -421,9 +420,9 @@ void VGA_SetupDrawing(void) {
case M_HERC:
vga.draw.double_height=false; //Hack if there's a runtime switch
width*=9;
height=384;
height=348;
pitch=width;
aspect_ratio=1.0;
aspect_ratio=1.5;
break;
case M_TANDY16:
width<<=3;

View file

@ -297,9 +297,12 @@ void VGA_SetupHandlers(void) {
case M_CGA16:
case M_CGA4:
case M_CGA2:
case M_HERC:
range_handler=&vgaph.hmap;
break;
case M_HERC:
range_handler=&vgaph.hmap;
if (vga.herc.mode_control&0x80) goto range_b800;
else goto range_b000;
default:
LOG_MSG("Unhandled vga mode %X",vga.mode);
}
@ -311,12 +314,14 @@ void VGA_SetupHandlers(void) {
MEM_SetPageHandler(VGA_PAGE_B0,16,&vgaph.hram);
break;
case 2:
range_b000:
vgapages.map_base=VGA_PAGE_B0;
MEM_SetPageHandler(VGA_PAGE_B0,8,range_handler);
MEM_SetPageHandler(VGA_PAGE_A0,16,&vgaph.hram);
MEM_SetPageHandler(VGA_PAGE_B8,8,&vgaph.hram);
break;
case 3:
range_b800:
vgapages.map_base=VGA_PAGE_B8;
MEM_SetPageHandler(VGA_PAGE_B8,8,range_handler);
MEM_SetPageHandler(VGA_PAGE_A0,16,&vgaph.hram);

View file

@ -207,13 +207,15 @@ static Bit8u read_p3cc(Bit32u port) {
static void write_hercules(Bit32u port,Bit8u val) {
Bit8u mask;
switch (port) {
case 0x3b8:
mask=0xff-0x80-0x2;;
if (vga.herc.enable_bits & 1) {
mask|=0x2;
if (vga.mode != M_HERC || vga.mode != M_TEXT2) {
VGA_ATTR_SetPalette(1,0x0f);
/* Hack around like it looks we are in 0xb000 segment */
vga.gfx.miscellaneous=(vga.gfx.miscellaneous & ~0x0c)|0x0a;
VGA_ATTR_SetPalette(1,0x07);
/* Force 0x3b4/5 registers */
if (vga.misc_output & 1) write_p3c2(0,vga.misc_output & ~1);
}
if (val & 0x2) {
@ -223,9 +225,10 @@ static void write_hercules(Bit32u port,Bit8u val) {
}
}
if (vga.herc.enable_bits & 0x2) {
LOG_MSG("Herc page %d",val >> 7);
mask|=0x80;
VGA_SetupHandlers();
}
vga.herc.mode_control=val;
vga.herc.mode_control=(vga.herc.mode_control & ~mask) | (val&mask);
break;
case 0x3bf:
vga.herc.enable_bits=val;
@ -248,8 +251,6 @@ static Bit8u read_hercules(Bit32u port) {
void VGA_SetupMisc(void) {
// if (machine==MCH_HERC) EnableHercules();
vga.herc.enable_bits=0;
IO_RegisterWriteHandler(0x3d8,write_p3d8,"VGA Feature Control Register");
IO_RegisterWriteHandler(0x3d9,write_p3d9,"CGA Color Select Register");
@ -259,6 +260,7 @@ void VGA_SetupMisc(void) {
IO_RegisterReadHandler(0x3cc,read_p3cc,"VGA Misc Output");
if (machine==MCH_HERC || machine==MCH_AUTO) {
vga.herc.mode_control=0x8;
IO_RegisterWriteHandler(0x3b8,write_hercules,"Hercules");
IO_RegisterWriteHandler(0x3bf,write_hercules,"Hercules");
}