[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] Stairs effect on MiNT console
On 10/01/2013 09:09, Helmut Karlowski wrote:
set_tty_mode( RAW/*COOKED*/ );
Why ??
http://sparemint.org/mailinglist/Mailing-Lists/MiNT-List.201007/1278330820.6162.29.camel@jetpack.demon.co.uk.text
Ok, thanks for the pointer.
I have read a lot of stuff and made tests.
Now I have a good overview of the overall design, issues, and source code.
But the solution is not obvious.
A few information/comments, which are subject to discussion.
1) In FreeMiNT, /dev/console is an alias to CON:, which refers to the BIOS
console.
2) In POSIX, terminal devices (referred as tty's) can operate in 2 modes:
- COOKED (the default, a.k.a. canonical mode). Input is line buffered, and
output translates LF to CR+LF.
- RAW (a.k.a non-canonical mode). Input is not buffered, and on output LF is
not translated.
3) Normal POSIX programs expect COOKED mode. Mainly, they expect that a
single \n in a source produces CR+LF on the terminal. If the terminal is in
RAW mode, the stairs effect appears, even on Linux.
4) Normal TOS programs expect RAW mode (COOKED does not exist on plain TOS).
So we must output exactly what the terminal expects, such as
Cconws("Hello\r\n");
5) TOS programs may use CON:, and expects RAW mode. POSIX programs may use
/dev/console, and expects COOKED mode. Unfortunately, both devices are
aliases, so the actual mode can't be different between them.
6) Standard C programs using stdout expect something similar to a COOKED
mode. I mean, \n must be enough for printf(). So the MiNTLib implements a
text mode in stdio, which automatically adds the missing CR when outputting
to a RAW TOS device. When running on FreeMiNT, that text mode translation is
disabled because it is supposed to be done by the real COOKED terminal.
7) I don't understand why XaAES needs to hack the RAW/COOKED mode of the
BIOS console. This looks very wrong, since XaAES is supposed to do all its
I/O through the VDI.
8) As far as I understood, the COOKED/RAW mode is an attribute of a
terminal, not of a process. So changes in a terminal mode remains after the
process' death. In some e-mails, I saw references to efforts in XaAES for
having per-process console mode, resetting the mode inside a loop, etc. IMHO
in the case of that would make sense, this should be done in the kernel, not
XaAES...
9) The original issue was about ^S causing trouble to TaskBar, because it
had a lot of debug text going to the console. So it interfered with the
stop/start output mechanism. The solution was to put the BIOS console in RAW
mode, with the effect of disabling the stop/start mechanism, but with the
side effect of adding stairs to the console output. However you should know
that COOKED is actually combination of finer tty options. ONLCR is
responsible to remove the stairs effect. Maybe setting the BIOS console to
RAW+ONLCR would do the trick.
10) And finally, due to the complexity of that stuff, I wonder if it is sane
to change anything before the 1.18 release.
That's enough for today.
--
Vincent Rivière