I am reading the minix 3.1 text book. regarding the tty console, I understand that
the data structure, the only buffer in the console's memory is only 80 characters
long which is only a single line... but when you shift from one tty to another, the
screen content need to be buffered and restored, so the entire win size 80x25
chars need to be buffered, am I right?
but I just can't such buffer memory, why does it not exist?
If it does not exist, how does select_console restore the original content?
tty console buffer question
-
- Member
- Posts: 5560
- Joined: Mon Mar 25, 2013 7:01 pm
Re: tty console buffer question
The display adapter has enough memory to hold all of the consoles at the same time. Switching consoles only involves choosing a different region of memory to display.ITchimp wrote:but when you shift from one tty to another, the
screen content need to be buffered and restored, so the entire win size 80x25
chars need to be buffered, am I right?
Re: tty console buffer question
Minix 3.1's CGA/VGA text mode console implementation stores console text in video memory. The 80-word (160 byte) buffers you are seeing are a temporary storage for the current line. Likely, they are doing this so that when quite a bit of text is output it can be buffered in a single place before before being flushed continuously to screen - otherwise, there does not seem to be much purpose for this, as they do not read back from it - the one place where you might want to have a RAM copy to reference instead of trying to read from video memory. Scrolling is video-to-video - ouch!
As for how multiple consoles are implemented: They're all in different places in video memory, and the driver pokes the CGA/VGA registers (actually the Motorola 6845 registers, as indicated by the function name!) directly to switch the base address when switching consoles. https://github.com/Stichting-MINIX-Rese ... ole.c#L695
With CGA/VGA text mode taking only about 4K of space per screen, even the legacy 'viewport' (which Minix's driver uses) is big enough to squeeze at least the 4 consoles Minix makes available into video memory.
As for how multiple consoles are implemented: They're all in different places in video memory, and the driver pokes the CGA/VGA registers (actually the Motorola 6845 registers, as indicated by the function name!) directly to switch the base address when switching consoles. https://github.com/Stichting-MINIX-Rese ... ole.c#L695
With CGA/VGA text mode taking only about 4K of space per screen, even the legacy 'viewport' (which Minix's driver uses) is big enough to squeeze at least the 4 consoles Minix makes available into video memory.