Kernel and FreeCOM feature wishes: XECHO and SCREEN (should be easy)

Eric Auer <[email protected]> Mon, 11 Nov 2002 01:10:32 +0100 (MET)
Newsgroups gmane.os.freedos.devel
Message-ID <[email protected]>
Hi, I have noticed that the kernel allows the "echo" command to show
up in fdconfig.sys. Now I have this SYSEECHO/EECHO tool, which prints
its argument and replaces all $ by the ESCAPE character, for use with
ANSI. I know that FreeCOM now allows ESCAPE to be part of the argument
of ECHO, but it is hard to type it with a text editor when you write
a batch file. Other people are using other special ECHO tools that, for
example, do not print a carriage return / line feed at the end. Plus I
have the problem that "echo." does not work as expected with FreeCOM.
Whoops, sorry, it DOES with FreeCOM 0.83 beta 50 :-).

So what I propose is the following:
An XECHO (or however you want to call it) that
- does not print a carriage return / line feed at the end
- accepts \033 (this example is ASCII 27, ESCAPE) octal character escapes
- optionally could accept other escapes as well (\b backspace, \a beep,
  \n newline \r carriage return \t tab \v vertical tab \\ backslash)

The last wish is optional, as you can write \007 for beep, \012 for newline
\015 for carriage return \011 for tab and so on. So only the \xxx is really
important (that the numbers are octal is only for Unix habit compatibility:
You can use decimal or hexadecimal numbers as well, or use a completely
different syntax).

Such an echo command would be able to do the following:
- print ANSI escape sequences to change colors
- print small amounts of binary data which you could > to a file
- help in putting together batch files, as in:
  xecho echo This batch file was created at > auto.bat
  time /t >> auto.bat
  xecho  on FreeDOS >> auto.bat


After seeing several hand-made "special echo" tools, I hope you can end
all this hassles by including one that can do everything in kernel and
shell. Thanks a lot!

PS: I have been pondering the SCREEN= command. You can change the font
with it at boot time, to allow more lines on the screen. I think it should
have TWO arguments optionally: If you give the second, it is the mode
number for int 0x10 ah=0, otherwise the mode stays the same and only the
font is changed, as currently, with int 0x10, ah=11 (only some of the AL
values work without further parameters: The kernel should do a sanity check
before issueing int 10.11.xx).
Useful values for AL, font-wise, are:
0x11: 8x14 font (25/28 rows on EGA/VGA)
0x12: 8x8 font (43/50 rows)
0x14: 8x16 font (21/25 rows)
The 1, 2 and 4 values seem to work the same.
Useful values for AL, mode-wise, are:
0/1: 40x25, 2/3: 80x25 (the even ones use grayscale on some systems),
7: 80x25 monochrome, other values vary a lot depending on your hardware.
See the Intlist, entry V-1000. Contains modes with up to 160 columns and
up to 60 rows, and of course a lot of graphics modes which I would not
recommend because displaying text in graphics mode through the BIOS is very
slow.

For more modern modes, you would normally use VESA VBE and not the int 0x10
ah=0 interface, but I doubt that this is worth the effort for adding to the
kernel. However, VESA modes 0..0xff are the same as normal modes 0..0xff,
so a single VESA function call can handle both cases. Do not forget that old
computers do not have VESA, so you need to do the install check first!
Set VESA mode is int 0x10, AX=0x4f02, BX=mode - if it works, AX=0x004f
is returned. As no other functions have ever used int 0x10 AX=4f02, so
you can omit the install check and just say "if AX is not 0x004f, try again
with int 0x10 AH=0".

Some interesting text modes among the VESA modes:
0x108: 80x60   0x109: 132x25   0x10a: 132x43   0x10b: 132x50   0x10c: 132x60
Those are the only standardized ones: A real VESA application would
normally query the VESA interface for the list of available modes and
pick one that has the desired number of colors, size, and so on.

Of course it would be cool to have screen mode setting in FreeCOM as well!

Thanks for your efforts...

Eric