1
0
Fork 0

Be more compatible by converting tabs to spaces in the DOS console device rather than in the video BIOS teletype function.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3983
This commit is contained in:
ripsaw8080 2016-05-23 11:33:09 +00:00
parent 9fc2c31a97
commit 64a04b9985
4 changed files with 19 additions and 11 deletions

View file

@ -626,6 +626,7 @@ struct DOS_Block {
bool verify;
bool breakcheck;
bool echo; // if set to true dev_con::read will echo input
bool direct_output;
struct {
RealPt mediaid;
RealPt tempdta;

View file

@ -115,7 +115,7 @@ bool device_CON::Read(Bit8u * data,Bit16u * size) {
bool device_CON::Write(Bit8u * data,Bit16u * size) {
Bit16u count=0;
Bitu i;
Bit8u col,row;
Bit8u col,row,page;
Bit16u ncols,nrows;
Bit8u tempdata;
INT10_SetCurMode();
@ -128,6 +128,16 @@ bool device_CON::Write(Bit8u * data,Bit16u * size) {
ansi.esc=true;
count++;
continue;
} else if(data[count] == '\t' && !dos.direct_output) {
/* expand tab if not direct output */
page = real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAGE);
do {
if(ansi.enabled) INT10_TeletypeOutputAttr(' ',ansi.attr,true);
else INT10_TeletypeOutput(' ',7);
col=CURSOR_POS_COL(page);
} while(col%8);
lastwrite = data[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')) {
@ -161,7 +171,7 @@ bool device_CON::Write(Bit8u * data,Bit16u * size) {
continue;
}
/*ansi.esc and ansi.sci are true */
Bit8u page = real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAGE);
page = real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAGE);
switch(data[count]){
case '0':
case '1':

View file

@ -133,7 +133,7 @@ static Bitu DOS_21Handler(void) {
Bit8u c=reg_dl;Bit16u n=1;
DOS_WriteFile(STDOUT,&c,&n);
//Not in the official specs, but happens nonetheless. (last written character)
reg_al = c;// reg_al=(c==9)?0x20:c; //Officially: tab to spaces
reg_al=(c==9)?0x20:c; //strangely, tab conversion to spaces is reflected here
}
break;
case 0x03: /* Read character from STDAUX */
@ -184,8 +184,10 @@ static Bitu DOS_21Handler(void) {
default:
{
Bit8u c = reg_dl;Bit16u n = 1;
dos.direct_output=true;
DOS_WriteFile(STDOUT,&c,&n);
reg_al = reg_dl;
dos.direct_output=false;
reg_al=c;
}
break;
};
@ -211,6 +213,7 @@ static Bitu DOS_21Handler(void) {
while ((c=mem_readb(buf++))!='$') {
DOS_WriteFile(STDOUT,&c,&n);
}
reg_al=c;
}
break;
case 0x0a: /* Buffered Input */
@ -1236,6 +1239,7 @@ public:
dos.version.major=5;
dos.version.minor=0;
dos.direct_output=false;
}
~DOS(){
for (Bit16u i=0;i<DOS_DRIVES;i++) delete Drives[i];

View file

@ -659,13 +659,6 @@ static void INT10_TeletypeOutputAttr(Bit8u chr,Bit8u attr,bool useattr,Bit8u pag
// cur_col=0; //Seems to break an old chess game
cur_row++;
break;
case '\t':
do {
INT10_TeletypeOutputAttr(' ',attr,useattr,page);
cur_row=CURSOR_POS_ROW(page);
cur_col=CURSOR_POS_COL(page);
} while(cur_col%8);
break;
default:
/* Draw the actual Character */
WriteChar(cur_col,cur_row,page,chr,attr,useattr);