VOGONS

Common searches


First post, by MiNiDOS

User metadata
Rank Newbie
Rank
Newbie

Hi, I was hoping some of you may drive me to the answer I am looking for:

The thing is that in my AUTOEXEC.BAT, I start several programs. A few of them usually spit out some startup message to the CON. And a few are really writing quite a long string of text that clutters the screen.

I have managed to get rid of many of these program messages by redirecting their output to NUL, and in others I had to resort to more extreme measures such as using the CTTY NUL and CTTY CON pair to enclose the chatty program. But then, there are a few that it seems no matter what I do, they still get their messages out. Hex editing them is not possible since they run self-checks.

Do you have any tip on how to approach these tame resistant programs that won't shut up when they start, besides these common tricks I mentioned?

I thought of some kind of hacky tool that fools DOS into that there is another type of display adapter which I don't have so that the program writes to it and not to my real screen. And then reactivate my screen after the offending program is already running. In theory, it seems a good idea, but I don't know of any tool that does this.

I would appreciate any help in this matter.

Reply 1 of 17, by bakemono

User metadata
Rank Oldbie
Rank
Oldbie

Maybe hook the BIOS and DOS interrupts for the duration of autoexec.bat? You could pass through all functions unrelated to screen output, but return for any attempts at string/character output.

again another retro game on itch: https://90soft90.itch.io/shmup-salad

Reply 2 of 17, by doshea

User metadata
Rank Member
Rank
Member

I assume that if redirecting output to NUL or using CTTY doesn't work, then the program in question isn't using DOS's output routines/interrupt functions, although I could be wrong. Presumably using the BIOS routines would bypass the redirection though.

If you don't mind a VGA-specific solution, here are some thoughts on things you could do, assuming the programs you're starting from AUTOEXEC.BAT don't have any VGA-specific code that would interfere (I wouldn't really imagine many of them would):

First, I have a vague memory that VGA text mode had multiple (4?) pages or something, where you could get it to read from different parts of the video memory at 0xB800:0x0000. I guess there is 32K of memory there, and 80x50 (maximum standard text mode dimensions?) x 2 bytes per character cell x 4 pages = 32,000, so maybe my memory is correct? If this is a thing, perhaps you could switch to another page, but DOS and the programs wouldn't know anything about that and just keep writing to the first page?

Alternatively, http://www.scs.stanford.edu/10wi-cs140/pintos … /vga/vgamem.htm says:

The first element that defines this mapping is whether or not the VGA decodes accesses from the CPU. This is controlled by the RAM Enable field. If display memory decoding is disabled, then the VGA hardware ignores writes to its address space.

That sounds promising too.

Reply 3 of 17, by doshea

User metadata
Rank Member
Rank
Member

I did a Google search for "dos splash screen" (no quotes) and there were a few interesting matches right here on VOGONS. It looks like there might be some existing solutions, so possibly no coding required. Unfortunately one option apparently uses 3KB of RAM, I'd certainly want to avoid that if I was setting this kind of thing up for myself.

Reply 5 of 17, by MiNiDOS

User metadata
Rank Newbie
Rank
Newbie
wierd_w wrote on 2024-04-17, 03:36:

Indeed, outputting to null should fix most of it.

eg,

LH Verboseprg.exe > null

Perhaps, you missunderstood my request, I have already gone way past the regular OS route.

bakemono wrote on 2024-04-14, 11:38:

Maybe hook the BIOS and DOS interrupts for the duration of autoexec.bat? You could pass through all functions unrelated to screen output, but return for any attempts at string/character output.

My programming skills in real mode x86 are very rusty, right now they do not involve hooking up interrupts, playing with vectors and doing funky things to the system. Just orthodox interrupt calling in tiny asm snippets.

doshea wrote on 2024-04-16, 04:10:

First, I have a vague memory that VGA text mode had multiple (4?) pages or something, where you could get it to read from different parts of the video memory at 0xB800:0x0000. I guess there is 32K of memory there, and 80x50 (maximum standard text mode dimensions?) x 2 bytes per character cell x 4 pages = 32,000, so maybe my memory is correct? If this is a thing, perhaps you could switch to another page, but DOS and the programs wouldn't know anything about that and just keep writing to the first page?

While, I was ready to give a go to this approach, I found a tiny program called PAGE that just switched between different pages (yes, they are four). DOS boots on PAGE 0 and before the offending program starts, I switched to PAGE 1 and after it was initialized, I cleared that screen and returned to PAGE 0.

It sort of works, but it is not a tidy solution since messages are displayed for a couple of seconds on PAGE 1 while it is active, but then of course, when it returns back to PAGE 0, there is no trace left of them.

Reply 6 of 17, by Disruptor

User metadata
Rank Oldbie
Rank
Oldbie

I guess that has something to do with STDERR. Some programs print standard messages to STDOUT and error messages to STDERR
If you use redirection with "> NUL" you just redirect STDOUT.
Don't use "> NULL" !
I don't know whether "CTTY NUL" redirects STDERR too.

In Windows' Dosbox you can redirect STDERR with "2>NUL". I don't think this works in DOS.

Reply 7 of 17, by doshea

User metadata
Rank Member
Rank
Member
MiNiDOS wrote on 2024-04-24, 01:12:

While, I was ready to give a go to this approach, I found a tiny program called PAGE that just switched between different pages (yes, they are four). DOS boots on PAGE 0 and before the offending program starts, I switched to PAGE 1 and after it was initialized, I cleared that screen and returned to PAGE 0.

It sort of works, but it is not a tidy solution since messages are displayed for a couple of seconds on PAGE 1 while it is active, but then of course, when it returns back to PAGE 0, there is no trace left of them.

Oh, sorry, I imagined that it should be possible to set the page being output to and the page being displayed separately. I had a look at Ralf Brown's Interrupt List though and while I could have easily missed something, I didn't see any obvious sign that this is actually possible. Perhaps there's still some trick like that that an expert would know though.

For the record, I got the impression from RBIL that the above method might work on EGA and possibly earlier video standards too.

I had a go at this and it seems to work, if you're interested:

doshea wrote on 2024-04-16, 04:10:

Alternatively, http://www.scs.stanford.edu/10wi-cs140/pintos … /vga/vgamem.htm says:

The first element that defines this mapping is whether or not the VGA decodes accesses from the CPU. This is controlled by the RAM Enable field. If display memory decoding is disabled, then the VGA hardware ignores writes to its address space.

It seems like this might not be supported in emulation much, if that's something you care about:
- it doesn't work in DOSBox 0.74-3
- it doesn't work in QEMU 6.1.0
- from looking at the source of Bochs 2.7.0, it ignores the field, so I didn't try running it in Bochs
Maybe PCem or 86Box would emulate this since they have more accurate hardware emulation.

I tried it out on a real machine with an Intel 865G chipset, which I guess is reasonably old now so hopefully it's still a reasonably accurate VGA implementation, and it did stop the text on the screen from being updated, but the cursor still moved around (I was just typing commands at a prompt here) which looks a bit silly! 😁 I suppose there are tools you can use to make the cursor invisible to work around this, or that could potentially be combined into the same utility.

It seems like if you turn off RAM Enable when the cursor is near the top of the screen, generate say 5 lines of output, then turn RAM Enable back on again, since the cursor has moved down the screen, any further output will appear 5 lines down, with 5 blank lines in between. If you generate more than 25 lines of output, then when you turn RAM Enable back on again, the cursor will be at the bottom of the screen. I guess that to stop your prompt appearing part way down the screen - or at the bottom - with a lot of blank space above it, you might need to CLS before you turn RAM Enable back on (not to actually clear the screen but to move the cursor up). It might be possible to figure out a combination of steps that makes things look okay though. Perhaps you could even output some ANSI art splash screen before turning off RAM Enable.

If you or anyone is interested I can put source and binaries on GitHub.

Reply 8 of 17, by MiNiDOS

User metadata
Rank Newbie
Rank
Newbie
Disruptor wrote on 2024-04-24, 08:43:
I guess that has something to do with STDERR. Some programs print standard messages to STDOUT and error messages to STDERR If yo […]
Show full quote

I guess that has something to do with STDERR. Some programs print standard messages to STDOUT and error messages to STDERR
If you use redirection with "> NUL" you just redirect STDOUT.
Don't use "> NULL" !
I don't know whether "CTTY NUL" redirects STDERR too.

In Windows' Dosbox you can redirect STDERR with "2>NUL". I don't think this works in DOS.

According to documentation I found, CTT NUL redirects STDERR. In any case, I got a little utility called 2&1 which is specifically designed to redirect STDERR. But, it fails to accomplish the task just the same.

Reply 9 of 17, by MiNiDOS

User metadata
Rank Newbie
Rank
Newbie
doshea wrote on 2024-04-24, 11:58:
Oh, sorry, I imagined that it should be possible to set the page being output to and the page being displayed separately. I had […]
Show full quote
MiNiDOS wrote on 2024-04-24, 01:12:

While, I was ready to give a go to this approach, I found a tiny program called PAGE that just switched between different pages (yes, they are four). DOS boots on PAGE 0 and before the offending program starts, I switched to PAGE 1 and after it was initialized, I cleared that screen and returned to PAGE 0.

It sort of works, but it is not a tidy solution since messages are displayed for a couple of seconds on PAGE 1 while it is active, but then of course, when it returns back to PAGE 0, there is no trace left of them.

Oh, sorry, I imagined that it should be possible to set the page being output to and the page being displayed separately. I had a look at Ralf Brown's Interrupt List though and while I could have easily missed something, I didn't see any obvious sign that this is actually possible. Perhaps there's still some trick like that that an expert would know though.

For the record, I got the impression from RBIL that the above method might work on EGA and possibly earlier video standards too.

I had a go at this and it seems to work, if you're interested:

doshea wrote on 2024-04-16, 04:10:

Alternatively, http://www.scs.stanford.edu/10wi-cs140/pintos … /vga/vgamem.htm says:

The first element that defines this mapping is whether or not the VGA decodes accesses from the CPU. This is controlled by the RAM Enable field. If display memory decoding is disabled, then the VGA hardware ignores writes to its address space.

It seems like this might not be supported in emulation much, if that's something you care about:
- it doesn't work in DOSBox 0.74-3
- it doesn't work in QEMU 6.1.0
- from looking at the source of Bochs 2.7.0, it ignores the field, so I didn't try running it in Bochs
Maybe PCem or 86Box would emulate this since they have more accurate hardware emulation.

I tried it out on a real machine with an Intel 865G chipset, which I guess is reasonably old now so hopefully it's still a reasonably accurate VGA implementation, and it did stop the text on the screen from being updated, but the cursor still moved around (I was just typing commands at a prompt here) which looks a bit silly! 😁 I suppose there are tools you can use to make the cursor invisible to work around this, or that could potentially be combined into the same utility.

It seems like if you turn off RAM Enable when the cursor is near the top of the screen, generate say 5 lines of output, then turn RAM Enable back on again, since the cursor has moved down the screen, any further output will appear 5 lines down, with 5 blank lines in between. If you generate more than 25 lines of output, then when you turn RAM Enable back on again, the cursor will be at the bottom of the screen. I guess that to stop your prompt appearing part way down the screen - or at the bottom - with a lot of blank space above it, you might need to CLS before you turn RAM Enable back on (not to actually clear the screen but to move the cursor up). It might be possible to figure out a combination of steps that makes things look okay though. Perhaps you could even output some ANSI art splash screen before turning off RAM Enable.

If you or anyone is interested I can put source and binaries on GitHub.

Please post it on GitHub. I am not not surrendering (yet). Thanks in advance

Reply 10 of 17, by flynnsbit

User metadata
Rank Newbie
Rank
Newbie

The best I have found is the combination of blackout and banner to "hide" the config.sys and autoexec.bat startup messages with either a black screen or a boot image, both possible with that combo. https://web.archive.org/web/19990128124420/ht … om/%7EJPMorris/ look for his banner package.

"The toolkit consists of three programs:

Blackout
Banner
Gif2Raw

Source is provided for all except gif2raw.

Blackout by Dr. G Lokhorst
--------

Blackout is the core of this toolkit. It prevents drivers in your startup
files (autoexec.bat, config.sys) from being able to print to the screen.

Although it is a device driver, it can also be run from the command line, or
your autoexec.bat file. Indeed, this is needed to let programs talk to the
screen again.

Quick guide to usage:

Add this line to the START of the CONFIG.SYS file:

DEVICE=C:\BLACKOUT\BLACKOUT.EXE

Add these lines near the END of the AUTOEXEC.BAT file:

C:\BLACKOUT\BLACKOUT.EXE
MODE CO80

Perferably before the taskmanager! (If you use it)"

Reply 11 of 17, by Cyberdyne

User metadata
Rank Oldbie
Rank
Oldbie

One permanent version is HEX edit those unneeded messages out from your SYS and executable files. I usually strip all unneeded from my stuff for personal use, and then Apack Syspack Upx all those. Great for super boot floppies also.

I am aroused about any X86 motherboard that has full functional ISA slot. I think i have problem. Not really into that original (Turbo) XT,286,386 and CGA/EGA stuff. So just a DOS nut.
PS. If I upload RAR, it is a 16-bit DOS RAR Version 2.50.

Reply 12 of 17, by doshea

User metadata
Rank Member
Rank
Member

Some nice suggestions in the last few posts! Also it was interesting to learn about the difference between redirection and CTTY in terms of stderr.

I posted the tool I wrote on GitHub, vgaonoff-0.1.zip available from here includes both source and binary. I also included some example batch files that demonstrate it in action with a sort of splash screen with a progress bar (it just occurred to me that this was possible so I may as well try it), although it requires Norton Utilities Batch Enhancer for its DELAY subcommand so it doesn't all flash by too quickly, and I didn't do anything about making the cursor disappear. Since making the cursor disappear should be easy - or at least isn't a mystery, it's well-documented I think - I'm happy to add that later if the first part is actually useful. Please take note of my warning in README.md about not using this on non-VGA systems:

WARNING: This assumes that VGA adapter is present without checking for it. Most likely if you use this with an EGA adapter, garbage will be written to the register, causing unknown effects. Please file an issue if you expect to use this in a case where a non-VGA adapter may be present.

Again, I'd be happy to improve it if it's actually going to be used, but I assume it's not going to be used so I didn't want to waste time making it too polished just now 😁

Reply 13 of 17, by Disruptor

User metadata
Rank Oldbie
Rank
Oldbie
MiNiDOS wrote on 2024-04-26, 02:16:
Disruptor wrote on 2024-04-24, 08:43:
I guess that has something to do with STDERR. Some programs print standard messages to STDOUT and error messages to STDERR If yo […]
Show full quote

I guess that has something to do with STDERR. Some programs print standard messages to STDOUT and error messages to STDERR
If you use redirection with "> NUL" you just redirect STDOUT.
Don't use "> NULL" !
I don't know whether "CTTY NUL" redirects STDERR too.

In Windows' Dosbox you can redirect STDERR with "2>NUL". I don't think this works in DOS.

According to documentation I found, CTTY NUL redirects STDERR. In any case, I got a little utility called 2&1 which is specifically designed to redirect STDERR. But, it fails to accomplish the task just the same.

Perhaps it writes directly into video memory.

Reply 14 of 17, by MiNiDOS

User metadata
Rank Newbie
Rank
Newbie
Cyberdyne wrote on 2024-04-26, 07:34:

One permanent version is HEX edit those unneeded messages out from your SYS and executable files. I usually strip all unneeded from my stuff for personal use, and then Apack Syspack Upx all those. Great for super boot floppies also.

Yes, it should work on most cases, but many programs are either encrypted or have self checking code, so it is not as easy as it seems at first sight.

Reply 15 of 17, by MiNiDOS

User metadata
Rank Newbie
Rank
Newbie
doshea wrote on 2024-04-26, 09:11:
Some nice suggestions in the last few posts! Also it was interesting to learn about the difference between redirection and CTTY […]
Show full quote

Some nice suggestions in the last few posts! Also it was interesting to learn about the difference between redirection and CTTY in terms of stderr.

I posted the tool I wrote on GitHub, vgaonoff-0.1.zip available from here includes both source and binary. I also included some example batch files that demonstrate it in action with a sort of splash screen with a progress bar (it just occurred to me that this was possible so I may as well try it), although it requires Norton Utilities Batch Enhancer for its DELAY subcommand so it doesn't all flash by too quickly, and I didn't do anything about making the cursor disappear. Since making the cursor disappear should be easy - or at least isn't a mystery, it's well-documented I think - I'm happy to add that later if the first part is actually useful. Please take note of my warning in README.md about not using this on non-VGA systems:

WARNING: This assumes that VGA adapter is present without checking for it. Most likely if you use this with an EGA adapter, garbage will be written to the register, causing unknown effects. Please file an issue if you expect to use this in a case where a non-VGA adapter may be present.

Again, I'd be happy to improve it if it's actually going to be used, but I assume it's not going to be used so I didn't want to waste time making it too polished just now 😁

Thank you very much. It works for me.

That said if you would like to improve upon VGAONOFF I would dare suggest the following changes:

1. Make sure the binaries archive contained also the example BAT files (currently only available in the sources archive).
2. Make an exit strategy for when a VGA card is not present (exit silently, return an errorlevel, send a CON message to the user, or a combination of these).
3. Just in case, VGA detection code seems quite easy by using INT 10H service 1A https://stanislavs.org/helppc/int_10-1a.html

Thanks again.

Reply 16 of 17, by MiNiDOS

User metadata
Rank Newbie
Rank
Newbie
Disruptor wrote on 2024-04-26, 17:28:
MiNiDOS wrote on 2024-04-26, 02:16:
Disruptor wrote on 2024-04-24, 08:43:
I guess that has something to do with STDERR. Some programs print standard messages to STDOUT and error messages to STDERR If yo […]
Show full quote

I guess that has something to do with STDERR. Some programs print standard messages to STDOUT and error messages to STDERR
If you use redirection with "> NUL" you just redirect STDOUT.
Don't use "> NULL" !
I don't know whether "CTTY NUL" redirects STDERR too.

In Windows' Dosbox you can redirect STDERR with "2>NUL". I don't think this works in DOS.

According to documentation I found, CTTY NUL redirects STDERR. In any case, I got a little utility called 2&1 which is specifically designed to redirect STDERR. But, it fails to accomplish the task just the same.

Perhaps it writes directly into video memory.

I am sure by now that the offending program does something as kinky as that. And I bet there are many others out there that do the same thing.

Reply 17 of 17, by doshea

User metadata
Rank Member
Rank
Member
MiNiDOS wrote on 2024-04-27, 16:05:

Thank you very much. It works for me.

Cool!

That said if you would like to improve upon VGAONOFF I would dare suggest the following changes:

1. Make sure the binaries archive contained also the example BAT files (currently only available in the sources archive).

Oops, I never looked in the .zip file - why would I, what could go wrong? - but now I remember I didn't add "-r" to the "zip" command line when I made that file, so yes, I provided an "examples" directory which is empty. Silly me, but at least I managed to release something for a change 😁 Thanks for letting me know.

2. Make an exit strategy for when a VGA card is not present (exit silently, return an errorlevel, send a CON message to the user, or a combination of these).
3. Just in case, VGA detection code seems quite easy by using INT 10H service 1A https://stanislavs.org/helppc/int_10-1a.html

Now that I know this is useful to at least one person, I probably will add this soon, especially since you gave me a pointer to how to check, thanks!

Did you find a utility to turn the cursor off, or would you like that added too?

MiNiDOS wrote on 2024-04-27, 16:07:
Disruptor wrote on 2024-04-26, 17:28:

Perhaps it writes directly into video memory.

I am sure by now that the offending program does something as kinky as that. And I bet there are many others out there that do the same thing.

Yeah, I seem to recall there being plenty of libraries around that would reimplement basic operations like "write text output at the current cursor location" (e.g. C's printf()) via direct output to video memory because it was faster, and I used those kinds of things even when it probably wasn't necessary. It did also have the benefit that you could use colours even when ANSI.SYS wasn't loaded, but mostly it was probably just premature, unnecessary optimisation 😁