1
0
Fork 0

Let CGA Modes use vga timings

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1639
This commit is contained in:
Sjoerd van der Berg 2004-02-02 09:27:34 +00:00
parent 3c2770a8f0
commit f449c47830
2 changed files with 24 additions and 28 deletions

View file

@ -293,10 +293,10 @@ void VGA_SetupDrawing(void) {
break;
case M_CGA4:
case M_CGA16: //Let is use 320x200 res and double pixels myself
aspect_ratio/=2; //Hack for half the vtotal in cga mode
scaleh=2;scalew=2;
vga.draw.blocks=width;
width<<=2;
height/=2;
pitch=width;
vga.draw.lines_scaled=1;
vga.draw.address_line_total=2;
@ -304,8 +304,7 @@ void VGA_SetupDrawing(void) {
VGA_DrawLine=(vga.mode == M_CGA4) ? VGA_CGA4_Draw_Line : VGA_CGA16_Draw_Line;
break;
case M_CGA2:
aspect_ratio/=2; //Hack for half the vtotal in cga mode
scaleh=2;
scaleh=2;height/=2;
vga.draw.address_line_total=2;
vga.draw.blocks=width;
width<<=3;
@ -332,7 +331,7 @@ void VGA_SetupDrawing(void) {
vga.draw.address_add=160;
vga.draw.address_line_total=4;
vga.draw.lines_scaled=1;
width<<=2;
width<<=2;height/=2;
pitch=width;
VGA_DrawLine=VGA_TANDY16_Draw_Line;
break;

View file

@ -6,10 +6,8 @@
#include "int10.h"
#include "mouse.h"
#define _HALF_CLOCK 0x0001
#define _LINE_DOUBLE 0x0002
#define _VGA_LINE_DOUBLE 0x0004
#define _VGA_PIXEL_DOUBLE 0x0008
#define _EGA_HALF_CLOCK 0x0001
#define _EGA_LINE_DOUBLE 0x0002
#define SEQ_REGS 0x05
#define GFX_REGS 0x09
@ -17,34 +15,34 @@
VideoModeBlock ModeList[]={
/* mode ,type ,sw ,sh ,tw ,th ,cw,ch ,pt,pstart ,plength,htot,vtot,hde,vde ,rate,special flags */
{ 0x000 ,M_TEXT16 ,320 ,400 ,40 ,25 ,9 ,16 ,8 ,0xB8000 ,0x0800 ,50 ,449 ,40 ,400 ,70 ,_HALF_CLO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,0x10000,100 ,449 ,80 ,400 ,70 , 0 },
{ 0x153 ,M_LIN8 ,320 ,480 ,40 ,60 ,8 ,8 ,1 ,0xA0000 ,0x10000,100 ,525 ,80 ,480 ,70 , 0 },
{0xFFFF ,M_ERROR ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0x00000 ,0x0000 ,0 ,0 ,0 ,0 ,0 ,0 },
@ -177,7 +175,7 @@ foundmode:
memset(seq_data,0,SEQ_REGS);
seq_data[1]|=1; //8 dot fonts by default
seq_data[1]|= //Check for half clock
(CurMode->special & _HALF_CLOCK) ? 0x08 : 0x00;
(CurMode->special & _EGA_HALF_CLOCK) ? 0x08 : 0x00;
seq_data[4]|=0x02; //More than 64kb
switch (CurMode->type) {
case M_TEXT2:
@ -219,7 +217,7 @@ foundmode:
hor_overflow|=((CurMode->hdispend) & 0x100) >> 6;
/* End horizontal Blanking */
Bitu blank_end;
if (CurMode->special & _HALF_CLOCK) {
if (CurMode->special & _EGA_HALF_CLOCK) {
blank_end = (CurMode->htotal-1) & 0x7f;
} else {
blank_end = (CurMode->htotal-2) & 0x7f;
@ -229,7 +227,7 @@ foundmode:
/* Start Horizontal Retrace */
Bitu ret_start;
if (CurMode->special & _HALF_CLOCK) {
if (CurMode->special & _EGA_HALF_CLOCK) {
ret_start = (CurMode->hdispend+2);
} else {
ret_start = (CurMode->hdispend+4);
@ -238,7 +236,7 @@ foundmode:
hor_overflow|=(ret_start & 0x100) >> 4;
/* End Horizontal Retrace */
Bitu ret_end;
if (CurMode->special & _HALF_CLOCK) {
if (CurMode->special & _EGA_HALF_CLOCK) {
ret_end = (CurMode->htotal-2) & 0x3f;
} else {
ret_end = (CurMode->htotal-4) & 0x3f;
@ -286,7 +284,7 @@ foundmode:
ver_overflow|=(line_compare & 0x400) >> 4;
Bit8u underline=0;
/* Maximum scanline / Underline Location */
if (CurMode->special & _LINE_DOUBLE) max_scanline|=0x80;
if (CurMode->special & _EGA_LINE_DOUBLE) max_scanline|=0x80;
switch (CurMode->type) {
case M_TEXT2:
case M_TEXT16:
@ -295,12 +293,11 @@ foundmode:
break;
case M_VGA:
underline=0x40;
if (CurMode->special & _VGA_LINE_DOUBLE) max_scanline|=1;
max_scanline|=1; //Vga doesn't use double line but this
break;
case M_LIN8:
underline=0x60; //Seems to enable the every 4th clock on my s3
if (CurMode->special & _VGA_LINE_DOUBLE) max_scanline|=1;
// if (CurMode->special & _VGA_LINE_DOUBLE) max_scanline|=1;
break;
}
IO_Write(crtc_base,0x09);IO_Write(crtc_base+1,max_scanline);