Writing to the console

% When a console device is written to, the function <#2637#> con_write<#2637#> gets invoked. This function manages all the control characters and escape sequences used to provide applications with complete screen management. The escape sequences implemented are those of the <#2638#> vt102<#2638#> terminal. This means that your environment should say <#2639#> TERM=vt102<#2639#> when you are <#2640#> telnet<#2640#>ting to a non-\ host; the best choice for local activities, however, is <#2641#> TERM=console<#2641#> because the \ console offers a superset of <#2642#> vt102<#2642#> functionality. <#2643#> con_write()<#2643#>, thus, is mostly made up of nested switch statements, used to handle a finite state automaton interpreting escape sequences one character at a time. When in normal mode, the character being printed is written directly to the video memory, using the current <#2644#> attr<#2644#>-ibute. Within <#2645#> console.c<#2645#>, all the fields of <#2646#> struct vc<#2646#> are made accessible through macros, so any reference to (for example) <#2647#> attr<#2647#>, does actually refer to the field in the structure <#2648#> vc_cons[currcons]<#2648#>, as long as <#2649#> currcons<#2649#> is the number of the console being referred to.

#tex2html_wrap2968#

Actual mapping and unmapping of the console memory to screen is performed by the functions <#2652#> set_scrmem()<#2652#> (which copies data from the console buffer to video memory) and <#2653#> get_scrmem<#2653#> (which copies back data to the console buffer). The private buffer of the current console is physically mapped on the actual video RAM, in order to minimize the number of data transfers. This means that <#2654#> get<#2654#>- and <#2655#> set<#2655#>- -<#2656#>_scrmem()<#2656#> are <#2657#> static<#2657#> to <#2658#> console.c<#2658#> and are called only during a console switch.