VOGONS


First post, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I was recently playing with some older DOS games that use ANSI escape sequences to output text on the console device and I encountered a small problem when using more than 25 lines. Although DOSBox appears to support the character generator functions of INT 10H (such as loading the 8x8 font giving 50 lines of text), the internal ANSI support won't set output position past line 25, I guess because it's initialized to 25 rows at startup. In DEV_CON.H there is a coded limit based on ansi.nrows, and it seems that the rows and columns of the ansi data structure aren't changed when the BIOS data for the rows and columns have been changed by the character generator functions of INT 10H. This might be a known issue, but is there a workaround?

Reply 1 of 34, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

What games? Should probably use the lines count in the con stuff.

Reply 2 of 34, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

The games are an old version of Empire and the original interpreters for Infocom games. Yes, I know there are other interpreters like Frotz that might work better, but that's not the point.

/* 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;
INT10_SetCursorPos(--(ansi.data[0]),--(ansi.data[1]),page); /*ansi=1 based, int10 is 0 based */

The above appears to be the relevant code in dev_con.h that is limiting the positioning based on the structure elements. There are probably several ways to alter this to better adapt to changes. I don't know if it would be more efficient to have the INT 10H handling code update the ansi structure, or have the CON device ANSI code constantly re-reading the BIOS values, or maybe another approach altogether.

Reply 3 of 34, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Think the problem is in the constructor, device_CON::device_CON, there only
the ansi.nrows and ansi.ncols are read from the bios locations. That means
that after a mode switch still the old values are used. The comment at that
place suggests that this isn't the final version anyways...

Thanks for reporting this, shouldn't be too hard to fix it, guess by removing
the nrows/ncols variables completely and always using the bios values.

Reply 4 of 34, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Another option might be to have a conf setting with the internal ANSI support enabled by default but with an option to disable. I realize the internal support is a good thing considering most ANSI drivers were loaded in CONFIG.SYS, but there is at least NNANSI.COM which can be loaded from the command prompt.

Reply 5 of 34, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Dunno if nnansi would work inside dosbox, if it already does then there's
no need to disable internal ansi (it uses int9 or something to get the keys).
Or it doesn't work (likely option, ansi stuff usually hangs into the device
chain) then disabling the internal ansi won't work as well.
Either way the most compatible thing would be booting msdos and using
their ansi.sys.

Reply 6 of 34, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I did try to load NNANSI, of course, thinking it might override the internal ANSI support, but it didn't work. I think the internal stuff is "at the head of the line" when it comes to intercepting the escape sequences.

Reply 7 of 34, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Yes, hooking devices into the device chain doesn't work.

Reply 8 of 34, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I modified my test build of 0.72 to re-read the BIOS values when an "H" (cursor position) ANSI command is processed, and it works well. Here's a screen of an Infocom game running with an original interpreter at 80x50:

info50tp7.png

One small additional issue is that when setting the 8x8 font, the cursor disappears. Looking at the code for INT10_LoadFont() I found a "to do" note about reprogramming the cursor shape, so I guess that just isn't implemented yet. I made a little program in assembler to run inside DOSBox that sets the 8x8 font and also reprograms the the cursor to an appropriate shape. It does the job nicely, and it's attached to this post if anyone is interested.

Reply 9 of 34, by general_vagueness

User metadata
Rank Member
Rank
Member

thank you very much 😁
this is what I've been looking for, only not
what about the ANSI support?
(note: I had a thread like this and I'm going to stop posting on it; I really should have looked around b4 I started it 😦 )

You cannot fall off the floor.
If you look hard enough, you'll find something you don't like.

How to ask questions the smart way
How to become a hacker
How to answer smart-alec questions

Reply 10 of 34, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I couldn't figure out what you were asking about, so I looked up your other thread since you don't have that many posts. The little program I made is only for setting 80x50 text mode, it doesn't do any other modes. You can only do so much in a 19 byte program.

This thread was primarily about reporting a problem with the internal ANSI support in DOSBox where it doesn't correctly process ANSI cursor positioning commands past 80 columns or 25 lines. You're probably not doing anything that uses the cursor positioning commands, and won't run into the problem.

I guess you were also asking about setting colors of the command text in DOSBox. You don't need a mode setting program for that, you can do it with ANSI commands. Just create a text file with the proper ANSI escape sequences in it and use the TYPE command in DOSBox to output that file to the console. For example, to get green text you would use <esc>[32;40m where the <esc> represents the escape character, ASCII 27. Look up ANSI escape sequences on Google or Wikipedia for a more in-depth explanation.

Reply 12 of 34, by general_vagueness

User metadata
Rank Member
Rank
Member

thanks
I knew how to use ANSI esc[ things, I just thought you had to have support installed 😅 . That's pretty much all I wanted.

You cannot fall off the floor.
If you look hard enough, you'll find something you don't like.

How to ask questions the smart way
How to become a hacker
How to answer smart-alec questions

Reply 13 of 34, by Plan9FOS

User metadata
Rank Newbie
Rank
Newbie

If you need an excellent ANSI program that runs in DOSBox, try ANSIPLUS from Kristofer Sweger at:

http://www.sweger.com/ansiplus

It's a really nice program and the full version is now free.
It lets you control color, text size, text lines, etc.

Reply 14 of 34, by general_vagueness

User metadata
Rank Member
Rank
Member

I thought I had been forgetting something and reading the thread again reminded me: is there a way I can use con (and/or other "devices") in DOSBox?
That's the only the pertinent thing I can think of right now.

Oh, and if you read my first post and are wondering, I guess I'm here to stay. I haven't really used forums before, but this one seems really good. 😀

You cannot fall off the floor.
If you look hard enough, you'll find something you don't like.

How to ask questions the smart way
How to become a hacker
How to answer smart-alec questions

Reply 15 of 34, by h00ch

User metadata
Rank Newbie
Rank
Newbie

Hi, I have an old DOS game that I wrote in my introduction to C language course in college. I haven't seen it for a long time and now that I have DOSBox installed, I'm (almost) able to see it again in all it's ANSI glory! 😀 The problem is, I only see the top 25 lines. The batch file that runs the main EXE has the statement "MODE CON lines=50" but that doesn't seem to work. Is there something in the dosbox.conf file I need to change/set to make this work?

Reply 16 of 34, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

You can try to use the Freedos mode.com.

1+1=10

Reply 17 of 34, by h00ch

User metadata
Rank Newbie
Rank
Newbie

Thanks for the quick reply. Could you tell me what I need to do to use that within DOSBox? TIA

Reply 18 of 34, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

If that use of MODE is only setting an 80x50 text screen, you can also use the little program above and run that from the batch file instead of MODE. However, as you can see from the main point of this thread, if your program uses the ANSI cursor positioning command past line 25, you'll need to try a CVS version of DOSBox or wait for a future release.

Reply 19 of 34, by h00ch

User metadata
Rank Newbie
Rank
Newbie

Cool, I guess all I needed was the "MODE.COM" file from FreeDOS. Works great now! (except for a programming bug or 2) 😉 If anyone wants to try the game, it's good for a laugh. 😀

Run CASTLE.BAT to play within DOSBox. Object of the game is to find the Priestess and escape with her back to the main doors where you start from. Keep an eye out for those secret passages! (hint: there are 4 or 5 of them and they look very slightly different from a regular wall section).