Add final (slightly modified and extended) part of patch 1295927 (vga accuracy) from keith. Add (modified) bug/patch 1241142(ansi emulation updates) from moe. Add fix suggested by vasyl to fix MyChess. Corrected some missing parts in these patches. (Missing update nbrows in dev_con.h). Implemented a writebuffer to workaround the CR/LF issue. Let's hope everything still works
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2333
This commit is contained in:
parent
06d4ae4b3b
commit
0b4350c79d
7 changed files with 66 additions and 36 deletions
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: dev_con.h,v 1.20 2005-02-10 10:20:50 qbix79 Exp $ */
|
||||
/* $Id: dev_con.h,v 1.21 2005-10-02 10:12:29 qbix79 Exp $ */
|
||||
|
||||
#include "dos_inc.h"
|
||||
#include "../ints/int10.h"
|
||||
|
@ -34,7 +34,8 @@ public:
|
|||
void ClearAnsi(void);
|
||||
Bit16u GetInformation(void);
|
||||
private:
|
||||
Bit8u cache;
|
||||
Bit8u readcache;
|
||||
Bit8u lastwrite;
|
||||
struct ansi { /* should create a constructor which fills them with the appriorate values */
|
||||
bool esc;
|
||||
bool sci;
|
||||
|
@ -53,10 +54,10 @@ private:
|
|||
bool device_CON::Read(Bit8u * data,Bit16u * size) {
|
||||
Bit16u oldax=reg_ax;
|
||||
Bit16u count=0;
|
||||
if ((cache) && (*size)) {
|
||||
data[count++]=cache;
|
||||
if(dos.echo) INT10_TeletypeOutput(cache,7);
|
||||
cache=0;
|
||||
if ((readcache) && (*size)) {
|
||||
data[count++]=readcache;
|
||||
if(dos.echo) INT10_TeletypeOutput(readcache,7);
|
||||
readcache=0;
|
||||
}
|
||||
while (*size>count) {
|
||||
reg_ah=0;
|
||||
|
@ -89,7 +90,7 @@ bool device_CON::Read(Bit8u * data,Bit16u * size) {
|
|||
case 0:
|
||||
data[count++]=reg_al;
|
||||
if (*size>count) data[count++]=reg_ah;
|
||||
else cache=reg_ah;
|
||||
else readcache=reg_ah;
|
||||
break;
|
||||
}
|
||||
if(dos.echo) { //what to do if *size==1 and character is BS ?????
|
||||
|
@ -117,9 +118,11 @@ bool device_CON::Write(Bit8u * data,Bit16u * size) {
|
|||
count++;
|
||||
continue;
|
||||
} else {
|
||||
/* Some sort of "hack" now that \n doesn't set col to 0 (int10_char.cpp old chessgame) */
|
||||
if((data[count] == '\n') && (lastwrite != '\r')) INT10_TeletypeOutputAttr('\r',ansi.attr,ansi.enabled);
|
||||
/* pass attribute only if ansi is enabled */
|
||||
INT10_TeletypeOutputAttr(data[count],ansi.attr,ansi.enabled);
|
||||
count++;
|
||||
lastwrite = data[count++];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +133,7 @@ bool device_CON::Write(Bit8u * data,Bit16u * size) {
|
|||
case '[':
|
||||
ansi.sci=true;
|
||||
break;
|
||||
case '7': /* save cursor pos +attr */
|
||||
case '7': /* save cursor pos + attr */
|
||||
case '8': /* restore this (Wonder if this is actually used) */
|
||||
case 'D':/* scrolling DOWN*/
|
||||
case 'M':/* scrolling UP*/
|
||||
|
@ -298,16 +301,15 @@ bool device_CON::Write(Bit8u * data,Bit16u * size) {
|
|||
break;
|
||||
case 'J': /*erase screen and move cursor home*/
|
||||
if(ansi.data[0]==0) ansi.data[0]=2;
|
||||
if(ansi.data[0]!=2) {/* only number 2 (the standard one supported) */
|
||||
LOG(LOG_IOCTL,LOG_NORMAL)("ANSI: esc[%dJ called : not supported",ansi.data[0]);
|
||||
break;
|
||||
if(ansi.data[0]!=2) {/* every version behaves like type 2 */
|
||||
LOG(LOG_IOCTL,LOG_NORMAL)("ANSI: esc[%dJ called : not supported handling as 2",ansi.data[0]);
|
||||
}
|
||||
for(i=0;i<(Bitu)ansi.ncols*ansi.nrows;i++) INT10_TeletypeOutputAttr(' ',ansi.attr,true);
|
||||
INT10_ScrollWindow(0,0,999,999,0,ansi.attr,0xFF);
|
||||
ClearAnsi();
|
||||
INT10_SetCursorPos(0,0,0);
|
||||
break;
|
||||
case 'h': /* set MODE (if code =7 enable linewrap) */
|
||||
case 'I': /*RESET MODE */
|
||||
case 'h': /* SET MODE (if code =7 enable linewrap) */
|
||||
case 'I': /* RESET MODE */
|
||||
LOG(LOG_IOCTL,LOG_NORMAL)("ANSI: set/reset mode called(not supported)");
|
||||
ClearAnsi();
|
||||
break;
|
||||
|
@ -320,9 +322,13 @@ bool device_CON::Write(Bit8u * data,Bit16u * size) {
|
|||
ansi.saverow=CURSOR_POS_ROW(0);
|
||||
ClearAnsi();
|
||||
break;
|
||||
case 'K':/* erase till end of line */
|
||||
for(i = CURSOR_POS_COL(0);i<(Bitu) ansi.ncols; i++) INT10_TeletypeOutputAttr(' ',ansi.attr,true);
|
||||
ClearAnsi(); /* maybe set cursor back to starting place ???? */
|
||||
case 'K':/* erase till end of line (don't touch cursor) */
|
||||
col = CURSOR_POS_COL(0);
|
||||
row = CURSOR_POS_ROW(0);
|
||||
INT10_WriteChar(' ',ansi.attr,0,ansi.ncols-col,true); //Use this one to prevent scrolling when end of screen is reached
|
||||
//for(i = col;i<(Bitu) ansi.ncols; i++) INT10_TeletypeOutputAttr(' ',ansi.attr,true);
|
||||
INT10_SetCursorPos(row,col,0);
|
||||
ClearAnsi();
|
||||
break;
|
||||
case 'l':/* (if code =7) disable linewrap */
|
||||
case 'p':/* reassign keys (needs strings) */
|
||||
|
@ -352,17 +358,18 @@ Bit16u device_CON::GetInformation(void) {
|
|||
Bit16u head=mem_readw(BIOS_KEYBOARD_BUFFER_HEAD);
|
||||
Bit16u tail=mem_readw(BIOS_KEYBOARD_BUFFER_TAIL);
|
||||
|
||||
if ((head==tail) && !cache) return 0x80D3; /* No Key Available */
|
||||
if ((head==tail) && !readcache) return 0x80D3; /* No Key Available */
|
||||
return 0x8093; /* Key Available */
|
||||
};
|
||||
|
||||
device_CON::device_CON() {
|
||||
SetName("CON");
|
||||
cache=0;
|
||||
readcache=0;
|
||||
lastwrite=0;
|
||||
ansi.enabled=false;
|
||||
ansi.attr=0x7;
|
||||
ansi.ncols=real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS); //should be updated once set/reset mode is implemented
|
||||
ansi.nrows=real_readb(BIOSMEM_SEG,BIOSMEM_NB_ROWS) + 1;
|
||||
ansi.nrows=real_readb(BIOSMEM_SEG,BIOSMEM_NB_ROWS);
|
||||
ansi.saverow=0;
|
||||
ansi.savecol=0;
|
||||
ClearAnsi();
|
||||
|
|
|
@ -94,10 +94,29 @@ static Bitu read_p3cc(Bitu port,Bitu iolen) {
|
|||
return vga.misc_output;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Test 13: Hardware: General Registers
|
||||
Mode 00h, General -- Feat Ctrl: IBM=00h Current=FFh
|
||||
Mode 00h, General -- Input Status 0: IBM=70h Current=FFh
|
||||
.. & modes 1,2,3,4,5,6,d,e,10,11,12,13
|
||||
|
||||
following read handlers silence the above vgatest errors.
|
||||
|
||||
*/
|
||||
|
||||
static Bitu read_p3ca(Bitu port,Bitu iolen) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Bitu read_p3c2(Bitu port,Bitu iolen) {
|
||||
return 0x70;
|
||||
}
|
||||
|
||||
void VGA_SetupMisc(void) {
|
||||
if (machine==MCH_VGA) {
|
||||
IO_RegisterReadHandler(0x3ca,read_p3ca,IO_MB);
|
||||
IO_RegisterReadHandler(0x3c2,read_p3c2,IO_MB);
|
||||
IO_RegisterWriteHandler(0x3c2,write_p3c2,IO_MB);
|
||||
IO_RegisterReadHandler(0x3cc,read_p3cc,IO_MB);
|
||||
} else if (machine==MCH_CGA || machine==MCH_TANDY) {
|
||||
|
@ -105,7 +124,6 @@ void VGA_SetupMisc(void) {
|
|||
} else if (machine==MCH_HERC) {
|
||||
IO_RegisterReadHandler(0x3ba,read_p3da,IO_MB);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ static Bitu INT10_Handler(void) {
|
|||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (reg_ah) {
|
||||
case 0x00: /* Set VideoMode */
|
||||
INT10_SetVideoMode(reg_al);
|
||||
|
@ -279,6 +280,14 @@ graphics_chars:
|
|||
reg_cx=real_readb(BIOSMEM_SEG,BIOSMEM_SWITCHES) & 0x0F;
|
||||
break;
|
||||
}
|
||||
case 0x34: /* ALTERNATE FUNCTION SELECT (VGA) - CURSOR EMULATION */
|
||||
{
|
||||
// bit 0: 0=enable, 1=disable
|
||||
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 0x36: /* VGA Refresh control */
|
||||
/*
|
||||
Call disables/enables the vga from outputting video,
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
#define VGAMEM_MTEXT 0xB000
|
||||
|
||||
#define BIOS_NCOLS Bit16u ncols=real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS);
|
||||
#define BIOS_NROWS Bit16u nrows=real_readb(BIOSMEM_SEG,BIOSMEM_NB_ROWS)+1;
|
||||
#define BIOS_NROWS Bit16u nrows=real_readb(BIOSMEM_SEG,BIOSMEM_NB_ROWS);
|
||||
|
||||
extern Bit8u int10_font_08[256 * 8];
|
||||
extern Bit8u int10_font_14[256 * 14];
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: int10_char.cpp,v 1.37 2005-09-01 14:31:40 qbix79 Exp $ */
|
||||
/* $Id: int10_char.cpp,v 1.38 2005-10-02 10:12:31 qbix79 Exp $ */
|
||||
|
||||
/* Character displaying moving functions */
|
||||
|
||||
|
@ -309,11 +309,12 @@ void INT10_SetCursorShape(Bit8u first,Bit8u last) {
|
|||
goto dowrite;
|
||||
}
|
||||
/* Check if we need to convert CGA Bios cursor values */
|
||||
if (!(real_readb(BIOSMEM_SEG,BIOSMEM_VIDEO_CTL) & 0x1)) {
|
||||
if (!(real_readb(BIOSMEM_SEG,BIOSMEM_VIDEO_CTL) & 0x1)) { // set by int10 fun12 sub34
|
||||
// if (CurMode->mode>0x3) goto dowrite; //Only mode 0-3 are text modes on cga
|
||||
if ((first & 0xe0) || (last & 0xe0)) goto dowrite;
|
||||
Bit8u cheight=real_readb(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT)-1;
|
||||
/* Creative routine i based of the original ibmvga bios */
|
||||
|
||||
if (last<first) {
|
||||
if (!last) goto dowrite;
|
||||
first=last;
|
||||
|
@ -331,8 +332,9 @@ void INT10_SetCursorShape(Bit8u first,Bit8u last) {
|
|||
} else {
|
||||
first=(first-last)+cheight;
|
||||
last=cheight;
|
||||
if (cheight>0xc) {
|
||||
first--;
|
||||
|
||||
if (cheight>0xc) { // vgatest sets 15 15 2x where only one should be decremented to 14 14
|
||||
first--; // implementing int10 fun12 sub34 fixed this.
|
||||
last--;
|
||||
}
|
||||
}
|
||||
|
@ -537,7 +539,7 @@ void INT10_TeletypeOutputAttr(Bit8u chr,Bit8u attr,bool useattr) {
|
|||
cur_col=0;
|
||||
break;
|
||||
case '\n':
|
||||
cur_col=0;
|
||||
// cur_col=0; //Seems to break an old chess game
|
||||
cur_row++;
|
||||
break;
|
||||
case '\t':
|
||||
|
|
|
@ -66,7 +66,7 @@ void INT10_LoadFont(PhysPt font,bool reload,Bitu count,Bitu offset,Bitu map,Bitu
|
|||
IO_Write(base+1,(IO_Read(base+1) & 0xe0)|(height-1));
|
||||
//Vertical display end bios says, but should stay the same?
|
||||
//Rows setting in bios segment
|
||||
real_writeb(BIOSMEM_SEG,BIOSMEM_NB_ROWS,(CurMode->sheight/height)-1);
|
||||
real_writeb(BIOSMEM_SEG,BIOSMEM_NB_ROWS,(CurMode->sheight/height));
|
||||
real_writeb(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT,height);
|
||||
//TODO Reprogram cursor size?
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ static void FinishSetMode(bool clearmem) {
|
|||
real_writew(BIOSMEM_SEG,BIOSMEM_NB_COLS,CurMode->twidth);
|
||||
real_writew(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE,CurMode->plength);
|
||||
real_writew(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS,((CurMode->mode==7 )|| (CurMode->mode==0x0f)) ? 0x3b4 : 0x3d4);
|
||||
real_writeb(BIOSMEM_SEG,BIOSMEM_NB_ROWS,CurMode->theight-1);
|
||||
real_writeb(BIOSMEM_SEG,BIOSMEM_NB_ROWS,CurMode->theight);
|
||||
real_writew(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT,CurMode->cheight);
|
||||
real_writeb(BIOSMEM_SEG,BIOSMEM_VIDEO_CTL,(0x60|(clearmem?0:0x80)));
|
||||
real_writeb(BIOSMEM_SEG,BIOSMEM_SWITCHES,0x09);
|
||||
|
@ -487,12 +487,6 @@ bool INT10_SetVideoMode(Bitu mode) {
|
|||
overflow|=((CurMode->vtotal-2) & 0x200) >> 4;
|
||||
ver_overflow|=((CurMode->vtotal-2) & 0x400) >> 10;
|
||||
|
||||
/*
|
||||
These aren't exactly accurate i think,
|
||||
Should be more like a certain percentage based on vertical total
|
||||
So you get same sized borders, but okay :)
|
||||
*/
|
||||
|
||||
Bitu vretrace;
|
||||
switch (CurMode->vdispend) {
|
||||
case 400: vretrace=CurMode->vdispend+12;
|
||||
|
|
Loading…
Add table
Reference in a new issue