VOGONS


First post, by lucky7456969

User metadata
Rank Oldbie
Rank
Oldbie

Would there be any chances for a chinese system that doesn't intercept escape sequences properly from dosbox?
I have a chinese demo program here which runs under eten.
When I generate graphics characters from the command prompt on the fly, it works as expected. But when I put this code stream into a C program, the graphics characters just did not come out.
I find out that the program works when it is booted from the dos image.
So i doubt it wasn't the emulated Hardware's fault. But rather something dos implementation is missing. I checked stdout but it was too difficult for me to decipher the code. Here is the code snippet I am using

printf ("%cSC0,SD0;",27);

looking forward to hearing your advice.

Reply 1 of 17, by lucky7456969

User metadata
Rank Oldbie
Rank
Oldbie

Any hints? Thanks
Jack

Reply 2 of 17, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

ansi

Reply 3 of 17, by lucky7456969

User metadata
Rank Oldbie
Rank
Oldbie

Hi wd,
Can ansi be disabled?
Thanks
Jack

Reply 4 of 17, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Yes, but what may be necessary in your case may be some chinese support along with more ansi ESC things.

Reply 5 of 17, by lucky7456969

User metadata
Rank Oldbie
Rank
Oldbie

Hi wd,
May I just give it a try because I remember I was in college, ANSI.sys would cause problem to my program even on real DOS.... Could you please give me some instructions on how to disable ANSI.SYS?
Thanks a lot
Jack

Reply 6 of 17, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

That's all in dev_con.h

Reply 7 of 17, by lucky7456969

User metadata
Rank Oldbie
Rank
Oldbie

Thanks, i'll check that out!

Reply 8 of 17, by lucky7456969

User metadata
Rank Oldbie
Rank
Oldbie

Sorry for coming back. I wonder if there are any third party tools (TSR or something similar) that alternatively turn on and off ANSI.
Thanks for your time once again
Jack

Last edited by lucky7456969 on 2012-01-13, 14:05. Edited 1 time in total.

Reply 9 of 17, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

doubt that

Reply 10 of 17, by lucky7456969

User metadata
Rank Oldbie
Rank
Oldbie

Okay, then I better off try another method...
Thanks

Reply 11 of 17, by lucky7456969

User metadata
Rank Oldbie
Rank
Oldbie

What's up with this?

printf ("%cT24,140,40,0,2/2,"blah, blah", 27);
if(!ansi.sci){

switch(data[count]){
case '[':
ansi.sci=true;
break;
case '7': /* save cursor pos + attr */
case '8': /* restore this (Wonder if this is actually used) */
case 'D':/* scrolling DOWN*/
case 'M':/* scrolling UP*/
default:
LOG(LOG_IOCTL,LOG_NORMAL)("ANSI: unknown char %c after a esc",data[count]); /*prob () */
ClearAnsi();
break;
}
count++;
continue;
}
/*ansi.esc and ansi.sci are true */
Bit8u page = real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAGE);
switch(data[count]){
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
ansi.data[ansi.numberofarg]=10*ansi.data[ansi.numberofarg]+(data[count]-'0');
break;
case ';': /* till a max of NUMBER_ANSI_DATA */
ansi.numberofarg++;
break;
case 'm': /* SGR */
for(i=0;i<=ansi.numberofarg;i++){
ansi.enabled=true;
switch(ansi.data[i]){
case 0: /* normal */
ansi.attr=0x07;//Real ansi does this as well. (should do current defaults)
ansi.enabled=false;
break;
case 1: /* bold mode on*/
ansi.attr|=0x08;
break;
case 4: /* underline */
LOG(LOG_IOCTL,LOG_NORMAL)("ANSI:no support for underline yet");
break;
case 5: /* blinking */
ansi.attr|=0x80;
break;
case 7: /* reverse */
ansi.attr=0x70;//Just like real ansi. (should do use current colors reversed)
break;
case 30: /* fg color black */
ansi.attr&=0xf8;
ansi.attr|=0x0;
break;
Show last 177 lines
				case 31:  /* fg color red */
ansi.attr&=0xf8;
ansi.attr|=0x4;
break;
case 32: /* fg color green */
ansi.attr&=0xf8;
ansi.attr|=0x2;
break;
case 33: /* fg color yellow */
ansi.attr&=0xf8;
ansi.attr|=0x6;
break;
case 34: /* fg color blue */
ansi.attr&=0xf8;
ansi.attr|=0x1;
break;
case 35: /* fg color magenta */
ansi.attr&=0xf8;
ansi.attr|=0x5;
break;
case 36: /* fg color cyan */
ansi.attr&=0xf8;
ansi.attr|=0x3;
break;
case 37: /* fg color white */
ansi.attr&=0xf8;
ansi.attr|=0x7;
break;
case 40:
ansi.attr&=0x8f;
ansi.attr|=0x0;
break;
case 41:
ansi.attr&=0x8f;
ansi.attr|=0x40;
break;
case 42:
ansi.attr&=0x8f;
ansi.attr|=0x20;
break;
case 43:
ansi.attr&=0x8f;
ansi.attr|=0x60;
break;
case 44:
ansi.attr&=0x8f;
ansi.attr|=0x10;
break;
case 45:
ansi.attr&=0x8f;
ansi.attr|=0x50;
break;
case 46:
ansi.attr&=0x8f;
ansi.attr|=0x30;
break;
case 47:
ansi.attr&=0x8f;
ansi.attr|=0x70;
break;
default:
break;
}
}
ClearAnsi();
break;
case 'f':
case 'H':/* Cursor Pos*/
if(!ansi.warned) { //Inform the debugger that ansi is used.
ansi.warned = true;
LOG(LOG_IOCTL,LOG_WARN)("ANSI SEQUENCES USED");
}
/* Turn them into positions that are on the screen */
if(ansi.data[0] == 0) ansi.data[0] = 1;
if(ansi.data[1] == 0) ansi.data[1] = 1;
if(ansi.data[0] > ansi.nrows) ansi.data[0] = (Bit8u)ansi.nrows;
if(ansi.data[1] > ansi.ncols) ansi.data[1] = (Bit8u)ansi.ncols;
Real_INT10_SetCursorPos(--(ansi.data[0]),--(ansi.data[1]),page); /*ansi=1 based, int10 is 0 based */
ClearAnsi();
break;
/* cursor up down and forward and backward only change the row or the col not both */
case 'A': /* cursor up*/
col=CURSOR_POS_COL(page) ;
row=CURSOR_POS_ROW(page) ;
tempdata = (ansi.data[0]? ansi.data[0] : 1);
if(tempdata > row) { row=0; }
else { row-=tempdata;}
Real_INT10_SetCursorPos(row,col,page);
ClearAnsi();
break;
case 'B': /*cursor Down */
col=CURSOR_POS_COL(page) ;
row=CURSOR_POS_ROW(page) ;
tempdata = (ansi.data[0]? ansi.data[0] : 1);
if(tempdata + static_cast<Bitu>(row) >= ansi.nrows)
{ row = ansi.nrows - 1;}
else { row += tempdata; }
Real_INT10_SetCursorPos(row,col,page);
ClearAnsi();
break;
case 'C': /*cursor forward */
col=CURSOR_POS_COL(page);
row=CURSOR_POS_ROW(page);
tempdata=(ansi.data[0]? ansi.data[0] : 1);
if(tempdata + static_cast<Bitu>(col) >= ansi.ncols)
{ col = ansi.ncols - 1;}
else { col += tempdata;}
Real_INT10_SetCursorPos(row,col,page);
ClearAnsi();
break;
case 'D': /*Cursor Backward */
col=CURSOR_POS_COL(page);
row=CURSOR_POS_ROW(page);
tempdata=(ansi.data[0]? ansi.data[0] : 1);
if(tempdata > col) {col = 0;}
else { col -= tempdata;}
Real_INT10_SetCursorPos(row,col,page);
ClearAnsi();
break;
case 'J': /*erase screen and move cursor home*/
if(ansi.data[0]==0) ansi.data[0]=2;
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]);
}
INT10_ScrollWindow(0,0,255,255,0,ansi.attr,page);
ClearAnsi();
Real_INT10_SetCursorPos(0,0,page);
break;
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;
case 'u': /* Restore Cursor Pos */
Real_INT10_SetCursorPos(ansi.saverow,ansi.savecol,page);
ClearAnsi();
break;
case 's': /* SAVE CURSOR POS */
ansi.savecol=CURSOR_POS_COL(page);
ansi.saverow=CURSOR_POS_ROW(page);
ClearAnsi();
break;
case 'K': /* erase till end of line (don't touch cursor) */
col = CURSOR_POS_COL(page);
row = CURSOR_POS_ROW(page);
INT10_WriteChar(' ',ansi.attr,page,ansi.ncols-col,true); //Real_WriteChar(ansi.ncols-col,row,page,' ',ansi.attr,true);

//for(i = col;i<(Bitu) ansi.ncols; i++) INT10_TeletypeOutputAttr(' ',ansi.attr,true);
Real_INT10_SetCursorPos(row,col,page);
ClearAnsi();
break;
case 'M': /* delete line (NANSI) */
col = CURSOR_POS_COL(page);
row = CURSOR_POS_ROW(page);
INT10_ScrollWindow(row,0,ansi.nrows-1,ansi.ncols-1,ansi.data[0]? -ansi.data[0] : -1,ansi.attr,0xFF);
ClearAnsi();
break;
case 'l':/* (if code =7) disable linewrap */
case 'p':/* reassign keys (needs strings) */
case 'i':/* printer stuff */
default:
LOG(LOG_IOCTL,LOG_NORMAL)("ANSI: unhandled char %c in esc[",data[count]);
ClearAnsi();
break;
}
count++;
}
*size=count;
return true;
}

bool device_CON::Seek(Bit32u * pos,Bit32u type) {
// seek is valid
*pos = 0;
return true;
}

Do I add branches to the switch case in order to support my demo?
Thanks
Jack

Reply 12 of 17, by lucky7456969

User metadata
Rank Oldbie
Rank
Oldbie

Seems to be a conflict between ANSI and etin escape character ASCII 27.

Reply 13 of 17, by coolhaken

User metadata
Rank Newbie
Rank
Newbie

You can change the control character of ETEN from ASCII "27" to ASCII "26" using ETCTL command.

Like this:
ETCTL/C:~(Press Alt and numpad "026")

Reply 14 of 17, by lucky7456969

User metadata
Rank Oldbie
Rank
Oldbie

Thanks, your method looks very neat. Have fun!
Another question arises, can megabuild6 be used with et3 as well?
Thanks
Jack

Reply 15 of 17, by lucky7456969

User metadata
Rank Oldbie
Rank
Oldbie

I beg your pardon, i'd like to disable ansi when entering etin because the applications were hardcoded with escape code '27', if I do what you do, i need to change the programs for which I don't have access to.

Update: I will attempt to make a patch
Thanks
Jack

Reply 16 of 17, by lucky7456969

User metadata
Rank Oldbie
Rank
Oldbie

The thing is I need to bypass dosbox's ANSI function, hence, when my legacy application passes character 27 to eten,
eten pass the 27 to dosbox, the results are the same.
Thanks

Reply 17 of 17, by coolhaken

User metadata
Rank Newbie
Rank
Newbie

If you don't want to use dosbox's ANSI function, you can make a DOS bootable HD/FD image by WinImage or similar program,
then boot to real DOS without DEVICE=C:\DOS\ANSI.SYS in config.sys in that image file.