OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Apr 27, 2024 12:28 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: tty console buffer question
PostPosted: Tue Jan 23, 2024 10:30 pm 
Offline
Member
Member

Joined: Sat Aug 18, 2018 8:44 pm
Posts: 127
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?


Top
 Profile  
 
 Post subject: Re: tty console buffer question
PostPosted: Tue Jan 23, 2024 11:32 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5146
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?

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.


Top
 Profile  
 
 Post subject: Re: tty console buffer question
PostPosted: Tue Jan 23, 2024 11:36 pm 
Offline
Member
Member

Joined: Wed Mar 30, 2011 12:31 am
Posts: 676
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.

_________________
toaruos on github | toaruos.org | gitlab | twitter | bim - a text editor


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 23 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group