2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
31 * @OSF_FREE_COPYRIGHT@
35 * @APPLE_FREE_COPYRIGHT@
38 * NetBSD: ite.c,v 1.16 1995/07/17 01:24:34 briggs Exp
40 * Copyright (c) 1988 University of Utah.
41 * Copyright (c) 1990, 1993
42 * The Regents of the University of California. All rights reserved.
44 * This code is derived from software contributed to Berkeley by
45 * the Systems Programming Group of the University of Utah Computer
48 * Redistribution and use in source and binary forms, with or without
49 * modification, are permitted provided that the following conditions
51 * 1. Redistributions of source code must retain the above copyright
52 * notice, this list of conditions and the following disclaimer.
53 * 2. Redistributions in binary form must reproduce the above copyright
54 * notice, this list of conditions and the following disclaimer in the
55 * documentation and/or other materials provided with the distribution.
56 * 3. All advertising materials mentioning features or use of this software
57 * must display the following acknowledgement:
58 * This product includes software developed by the University of
59 * California, Berkeley and its contributors.
60 * 4. Neither the name of the University nor the names of its contributors
61 * may be used to endorse or promote products derived from this software
62 * without specific prior written permission.
64 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
65 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
66 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
67 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
68 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
69 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
70 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
71 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
72 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
73 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
76 * from: Utah $Hdr: ite.c 1.28 92/12/20$
78 * @(#)ite.c 8.2 (Berkeley) 1/12/94
84 * The ite module handles the system console; that is, stuff printed
85 * by the kernel and by user programs while "desktop" and X aren't
86 * running. Some (very small) parts are based on hp300's 4.4 ite.c,
87 * hence the above copyright.
89 * -- Brad and Lawrence, June 26th, 1994
95 #include <console/video_console.h>
97 #include <kern/kern_types.h>
98 #include <kern/kalloc.h>
99 #include <kern/debug.h>
100 #include <kern/lock.h>
101 #include <kern/spl.h>
102 #include <kern/thread_call.h>
105 #include <vm/vm_kern.h>
106 #include <machine/io_map_entries.h>
108 #include <pexpert/pexpert.h>
110 #include "iso_font.c"
113 * Generic Console (Front-End)
114 * ---------------------------
117 struct vc_info vinfo
;
118 /* if panicDialogDesired is true then we use the panic dialog when its */
119 /* allowed otherwise we won't use the panic dialog even if it is allowed */
120 boolean_t panicDialogDesired
;
123 extern int disableConsoleOutput
;
124 static boolean_t gc_enabled
= FALSE
;
125 static boolean_t gc_initialized
= FALSE
;
126 static boolean_t vm_initialized
= FALSE
;
129 void (*initialize
)(struct vc_info
* info
);
130 void (*enable
)(boolean_t enable
);
131 void (*paint_char
)(int xx
, int yy
, unsigned char ch
, int attrs
, unsigned char ch_previous
, int attrs_previous
);
132 void (*clear_screen
)(int xx
, int yy
, int top
, int bottom
, int which
);
133 void (*scroll_down
)(int num
, int top
, int bottom
);
134 void (*scroll_up
)(int num
, int top
, int bottom
);
135 void (*hide_cursor
)(int xx
, int yy
);
136 void (*show_cursor
)(int xx
, int yy
);
137 void (*update_color
)(int color
, boolean_t fore
);
140 static unsigned char * gc_buffer_attributes
= NULL
;
141 static unsigned char * gc_buffer_characters
= NULL
;
142 static unsigned char * gc_buffer_colorcodes
= NULL
;
143 static unsigned long gc_buffer_columns
= 0;
144 static unsigned long gc_buffer_rows
= 0;
145 static unsigned long gc_buffer_size
= 0;
146 decl_simple_lock_data(,gc_buffer_lock
)
150 # 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
152 # 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
153 # Background color codes:
154 # 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
160 #define ATTR_REVERSE 4
162 #define COLOR_BACKGROUND 0
163 #define COLOR_FOREGROUND 7
165 #define COLOR_CODE_GET(code, fore) (((code) & ((fore) ? 0xF0 : 0x0F)) >> ((fore) ? 4 : 0))
166 #define COLOR_CODE_SET(code, color, fore) (((code) & ((fore) ? 0x0F : 0xF0)) | ((color) << ((fore) ? 4 : 0)))
168 static unsigned char gc_color_code
= 0;
172 static int gc_x
= 0, gc_y
= 0, gc_savex
, gc_savey
;
173 static int gc_par
[MAXPARS
], gc_numpars
, gc_hanging_cursor
, gc_attr
, gc_saveattr
;
175 /* VT100 tab stops & scroll region */
176 static char gc_tab_stops
[255];
177 static int gc_scrreg_top
, gc_scrreg_bottom
;
179 enum { kProgressAcquireDelay
= 5 /* secs */ };
182 ESnormal
, /* Nothing yet */
184 ESsquare
, /* Got ESC [ */
185 ESgetpars
, /* About to get or getting the parameters */
186 ESgotpars
, /* Finished getting the parameters */
187 ESfunckey
, /* Function key */
188 EShash
, /* DEC-specific stuff (screen align, etc.) */
189 ESsetG0
, /* Specify the G0 character set */
190 ESsetG1
, /* Specify the G1 character set */
193 ESignore
/* Ignore this sequence */
194 } gc_vt100state
= ESnormal
;
196 static int gc_wrap_mode
= 1, gc_relative_origin
= 0;
197 static int gc_charset_select
= 0, gc_save_charset_s
= 0;
198 static int gc_charset
[2] = { 0, 0 };
199 static int gc_charset_save
[2] = { 0, 0 };
201 static void gc_clear_line(int xx
, int yy
, int which
);
202 static void gc_clear_screen(int xx
, int yy
, int top
, int bottom
, int which
);
203 static void gc_enable(boolean_t enable
);
204 static void gc_hide_cursor(int xx
, int yy
);
205 static void gc_initialize(struct vc_info
* info
);
206 static void gc_paint_char(int xx
, int yy
, unsigned char ch
, int attrs
);
207 static void gc_putchar(char ch
);
208 static void gc_putc_askcmd(unsigned char ch
);
209 static void gc_putc_charsetcmd(int charset
, unsigned char ch
);
210 static void gc_putc_charsizecmd(unsigned char ch
);
211 static void gc_putc_esc(unsigned char ch
);
212 static void gc_putc_getpars(unsigned char ch
);
213 static void gc_putc_gotpars(unsigned char ch
);
214 static void gc_putc_normal(unsigned char ch
);
215 static void gc_putc_square(unsigned char ch
);
216 static void gc_refresh_screen(void);
217 static void gc_reset_screen(void);
218 static void gc_reset_tabs(void);
219 static void gc_reset_vt100(void);
220 static void gc_scroll_down(int num
, int top
, int bottom
);
221 static void gc_scroll_up(int num
, int top
, int bottom
);
222 static void gc_show_cursor(int xx
, int yy
);
223 static void gc_update_color(int color
, boolean_t fore
);
224 extern int vcputc(int l
, int u
, int c
);
227 gc_clear_line(int xx
, int yy
, int which
)
232 * This routine runs extremely slowly. I don't think it's
233 * used all that often, except for To end of line. I'll go
234 * back and speed this up when I speed up the whole vc
239 case 0: /* To end of line */
241 end
= vinfo
.v_columns
-1;
243 case 1: /* To start of line */
247 case 2: /* Whole line */
249 end
= vinfo
.v_columns
-1;
253 for (i
= start
; i
<= end
; i
++) {
254 gc_paint_char(i
, yy
, ' ', ATTR_NONE
);
260 gc_clear_screen(int xx
, int yy
, int top
, int bottom
, int which
)
264 if (!gc_buffer_size
) return;
267 simple_lock(&gc_buffer_lock
);
269 if ( xx
< gc_buffer_columns
&& yy
< gc_buffer_rows
&& bottom
<= gc_buffer_rows
)
271 unsigned long start
, end
;
274 case 0: /* To end of screen */
275 start
= (yy
* gc_buffer_columns
) + xx
;
276 end
= (bottom
* gc_buffer_columns
) - 1;
278 case 1: /* To start of screen */
279 start
= (top
* gc_buffer_columns
);
280 end
= (yy
* gc_buffer_columns
) + xx
;
282 case 2: /* Whole screen */
283 start
= (top
* gc_buffer_columns
);
284 end
= (bottom
* gc_buffer_columns
) - 1;
288 memset(gc_buffer_attributes
+ start
, 0x00, end
- start
+ 1);
289 memset(gc_buffer_characters
+ start
, 0x00, end
- start
+ 1);
290 memset(gc_buffer_colorcodes
+ start
, gc_color_code
, end
- start
+ 1);
293 simple_unlock(&gc_buffer_lock
);
296 gc_ops
.clear_screen(xx
, yy
, top
, bottom
, which
);
300 gc_enable( boolean_t enable
)
302 unsigned char * buffer_attributes
;
303 unsigned char * buffer_characters
;
304 unsigned char * buffer_colorcodes
;
305 unsigned long buffer_columns
;
306 unsigned long buffer_rows
;
307 unsigned long buffer_size
;
311 if ( enable
== FALSE
)
313 disableConsoleOutput
= TRUE
;
315 gc_ops
.enable(FALSE
);
319 simple_lock( &gc_buffer_lock
);
321 if ( gc_buffer_size
)
323 buffer_attributes
= gc_buffer_attributes
;
324 buffer_characters
= gc_buffer_characters
;
325 buffer_colorcodes
= gc_buffer_colorcodes
;
326 buffer_size
= gc_buffer_size
;
328 gc_buffer_attributes
= NULL
;
329 gc_buffer_characters
= NULL
;
330 gc_buffer_colorcodes
= NULL
;
331 gc_buffer_columns
= 0;
335 simple_unlock( &gc_buffer_lock
);
338 kfree( buffer_attributes
, buffer_size
);
339 kfree( buffer_characters
, buffer_size
);
340 kfree( buffer_colorcodes
, buffer_size
);
344 simple_unlock( &gc_buffer_lock
);
350 if ( vm_initialized
)
352 buffer_columns
= vinfo
.v_columns
;
353 buffer_rows
= vinfo
.v_rows
;
354 buffer_size
= buffer_columns
* buffer_rows
;
358 buffer_attributes
= (unsigned char *) kalloc( buffer_size
);
359 buffer_characters
= (unsigned char *) kalloc( buffer_size
);
360 buffer_colorcodes
= (unsigned char *) kalloc( buffer_size
);
362 if ( buffer_attributes
== NULL
||
363 buffer_characters
== NULL
||
364 buffer_colorcodes
== NULL
)
366 if ( buffer_attributes
) kfree( buffer_attributes
, buffer_size
);
367 if ( buffer_characters
) kfree( buffer_characters
, buffer_size
);
368 if ( buffer_colorcodes
) kfree( buffer_colorcodes
, buffer_size
);
376 memset( buffer_attributes
, 0x00, buffer_size
);
377 memset( buffer_characters
, 0x00, buffer_size
);
378 memset( buffer_colorcodes
, 0x0F, buffer_size
);
384 simple_lock( &gc_buffer_lock
);
386 gc_buffer_attributes
= buffer_attributes
;
387 gc_buffer_characters
= buffer_characters
;
388 gc_buffer_colorcodes
= buffer_colorcodes
;
389 gc_buffer_columns
= buffer_columns
;
390 gc_buffer_rows
= buffer_rows
;
391 gc_buffer_size
= buffer_size
;
393 simple_unlock( &gc_buffer_lock
);
400 disableConsoleOutput
= FALSE
;
405 gc_hide_cursor(int xx
, int yy
)
410 simple_lock(&gc_buffer_lock
);
412 if ( xx
< gc_buffer_columns
&& yy
< gc_buffer_rows
)
414 unsigned long index
= (yy
* gc_buffer_columns
) + xx
;
415 unsigned char attribute
= gc_buffer_attributes
[index
];
416 unsigned char character
= gc_buffer_characters
[index
];
417 unsigned char colorcode
= gc_buffer_colorcodes
[index
];
418 unsigned char colorcodesave
= gc_color_code
;
420 simple_unlock(&gc_buffer_lock
);
423 gc_update_color(COLOR_CODE_GET(colorcode
, TRUE
), TRUE
);
424 gc_update_color(COLOR_CODE_GET(colorcode
, FALSE
), FALSE
);
426 gc_ops
.paint_char(xx
, yy
, character
, attribute
, 0, 0);
428 gc_update_color(COLOR_CODE_GET(colorcodesave
, TRUE
), TRUE
);
429 gc_update_color(COLOR_CODE_GET(colorcodesave
, FALSE
), FALSE
);
433 simple_unlock(&gc_buffer_lock
);
436 gc_ops
.hide_cursor(xx
, yy
);
441 gc_initialize(struct vc_info
* info
)
443 if ( gc_initialized
== FALSE
)
446 simple_lock_init(&gc_buffer_lock
, 0);
448 gc_initialized
= TRUE
;
451 gc_ops
.initialize(info
);
458 gc_paint_char(int xx
, int yy
, unsigned char ch
, int attrs
)
463 simple_lock(&gc_buffer_lock
);
465 if ( xx
< gc_buffer_columns
&& yy
< gc_buffer_rows
)
467 unsigned long index
= (yy
* gc_buffer_columns
) + xx
;
469 gc_buffer_attributes
[index
] = attrs
;
470 gc_buffer_characters
[index
] = ch
;
471 gc_buffer_colorcodes
[index
] = gc_color_code
;
474 simple_unlock(&gc_buffer_lock
);
477 gc_ops
.paint_char(xx
, yy
, ch
, attrs
, 0, 0);
484 return; /* ignore null characters */
486 switch (gc_vt100state
) {
487 default:gc_vt100state
= ESnormal
; /* FALLTHROUGH */
507 gc_putc_charsizecmd(ch
);
510 gc_putc_charsetcmd(0, ch
);
513 gc_putc_charsetcmd(1, ch
);
517 if (gc_x
>= vinfo
.v_columns
) {
518 gc_x
= vinfo
.v_columns
- 1;
523 if (gc_y
>= vinfo
.v_rows
) {
524 gc_y
= vinfo
.v_rows
- 1;
533 gc_putc_askcmd(unsigned char ch
)
535 if (ch
>= '0' && ch
<= '9') {
536 gc_par
[gc_numpars
] = (10*gc_par
[gc_numpars
]) + (ch
-'0');
539 gc_vt100state
= ESnormal
;
543 gc_relative_origin
= ch
== 'h';
545 case 7: /* wrap around mode h=1, l=0*/
546 gc_wrap_mode
= ch
== 'h';
555 gc_putc_charsetcmd(int charset
, unsigned char ch
)
557 gc_vt100state
= ESnormal
;
563 gc_charset
[charset
] = 0;
565 case '0' : /* Graphic characters */
567 gc_charset
[charset
] = 0x21;
574 gc_putc_charsizecmd(unsigned char ch
)
576 gc_vt100state
= ESnormal
;
584 case '8' : /* fill 'E's */
587 for (yy
= 0; yy
< vinfo
.v_rows
; yy
++)
588 for (xx
= 0; xx
< vinfo
.v_columns
; xx
++)
589 gc_paint_char(xx
, yy
, 'E', ATTR_NONE
);
597 gc_putc_esc(unsigned char ch
)
599 gc_vt100state
= ESnormal
;
603 gc_vt100state
= ESsquare
;
605 case 'c': /* Reset terminal */
607 gc_clear_screen(gc_x
, gc_y
, 0, vinfo
.v_rows
, 2);
610 case 'D': /* Line feed */
612 if (gc_y
>= gc_scrreg_bottom
-1) {
613 gc_scroll_up(1, gc_scrreg_top
, gc_scrreg_bottom
);
614 gc_y
= gc_scrreg_bottom
- 1;
618 if (ch
== 'E') gc_x
= 0;
620 case 'H': /* Set tab stop */
621 gc_tab_stops
[gc_x
] = 1;
623 case 'M': /* Cursor up */
624 if (gc_y
<= gc_scrreg_top
) {
625 gc_scroll_down(1, gc_scrreg_top
, gc_scrreg_bottom
);
626 gc_y
= gc_scrreg_top
;
634 case '7': /* Save cursor */
637 gc_saveattr
= gc_attr
;
638 gc_save_charset_s
= gc_charset_select
;
639 gc_charset_save
[0] = gc_charset
[0];
640 gc_charset_save
[1] = gc_charset
[1];
642 case '8': /* Restore cursor */
645 gc_attr
= gc_saveattr
;
646 gc_charset_select
= gc_save_charset_s
;
647 gc_charset
[0] = gc_charset_save
[0];
648 gc_charset
[1] = gc_charset_save
[1];
650 case 'Z': /* return terminal ID */
652 case '#': /* change characters height */
653 gc_vt100state
= EScharsize
;
656 gc_vt100state
= ESsetG0
;
658 case ')': /* character set sequence */
659 gc_vt100state
= ESsetG1
;
664 /* Rest not supported */
671 gc_putc_getpars(unsigned char ch
)
674 gc_vt100state
= ESask
;
678 gc_vt100state
= ESnormal
;
682 if (ch
== ';' && gc_numpars
< MAXPARS
- 1) {
685 if (ch
>= '0' && ch
<= '9') {
686 gc_par
[gc_numpars
] *= 10;
687 gc_par
[gc_numpars
] += ch
- '0';
690 gc_vt100state
= ESgotpars
;
696 gc_putc_gotpars(unsigned char ch
)
701 /* special case for vttest for handling cursor
702 movement in escape sequences */
704 gc_vt100state
= ESgotpars
;
707 gc_vt100state
= ESnormal
;
710 gc_y
-= gc_par
[0] ? gc_par
[0] : 1;
711 if (gc_y
< gc_scrreg_top
)
712 gc_y
= gc_scrreg_top
;
715 gc_y
+= gc_par
[0] ? gc_par
[0] : 1;
716 if (gc_y
>= gc_scrreg_bottom
)
717 gc_y
= gc_scrreg_bottom
- 1;
719 case 'C': /* Right */
720 gc_x
+= gc_par
[0] ? gc_par
[0] : 1;
721 if (gc_x
>= vinfo
.v_columns
)
722 gc_x
= vinfo
.v_columns
-1;
725 gc_x
-= gc_par
[0] ? gc_par
[0] : 1;
729 case 'H': /* Set cursor position */
731 gc_x
= gc_par
[1] ? gc_par
[1] - 1 : 0;
732 gc_y
= gc_par
[0] ? gc_par
[0] - 1 : 0;
733 if (gc_relative_origin
)
734 gc_y
+= gc_scrreg_top
;
735 gc_hanging_cursor
= 0;
737 case 'X': /* clear p1 characters */
740 for (i
= gc_x
; i
< gc_x
+ gc_par
[0]; i
++)
741 gc_paint_char(i
, gc_y
, ' ', ATTR_NONE
);
744 case 'J': /* Clear part of screen */
745 gc_clear_screen(gc_x
, gc_y
, 0, vinfo
.v_rows
, gc_par
[0]);
747 case 'K': /* Clear part of line */
748 gc_clear_line(gc_x
, gc_y
, gc_par
[0]);
750 case 'g': /* tab stops */
753 case 2: /* reset tab stops */
754 /* gc_reset_tabs(); */
756 case 3: /* Clear every tabs */
760 for (i
= 0; i
<= vinfo
.v_columns
; i
++)
765 gc_tab_stops
[gc_x
] = 0;
769 case 'm': /* Set attribute */
770 for (i
= 0; i
< gc_numpars
; i
++) {
774 gc_update_color(COLOR_BACKGROUND
, FALSE
);
775 gc_update_color(COLOR_FOREGROUND
, TRUE
);
778 gc_attr
|= ATTR_BOLD
;
781 gc_attr
|= ATTR_UNDER
;
784 gc_attr
|= ATTR_REVERSE
;
787 gc_attr
&= ~ATTR_BOLD
;
790 gc_attr
&= ~ATTR_UNDER
;
793 gc_attr
&= ~ATTR_REVERSE
;
796 case 25: /* blink/no blink */
799 if (gc_par
[i
] >= 30 && gc_par
[i
] <= 37)
800 gc_update_color(gc_par
[i
] - 30, TRUE
);
801 if (gc_par
[i
] >= 40 && gc_par
[i
] <= 47)
802 gc_update_color(gc_par
[i
] - 40, FALSE
);
807 case 'r': /* Set scroll region */
809 /* ensure top < bottom, and both within limits */
810 if ((gc_numpars
> 0) && (gc_par
[0] < vinfo
.v_rows
)) {
811 gc_scrreg_top
= gc_par
[0] ? gc_par
[0] - 1 : 0;
812 if (gc_scrreg_top
< 0)
817 if ((gc_numpars
> 1) && (gc_par
[1] <= vinfo
.v_rows
) && (gc_par
[1] > gc_par
[0])) {
818 gc_scrreg_bottom
= gc_par
[1];
819 if (gc_scrreg_bottom
> vinfo
.v_rows
)
820 gc_scrreg_bottom
= vinfo
.v_rows
;
822 gc_scrreg_bottom
= vinfo
.v_rows
;
824 if (gc_relative_origin
)
825 gc_y
= gc_scrreg_top
;
832 gc_putc_normal(unsigned char ch
)
835 case '\a': /* Beep */
837 case 127: /* Delete */
838 case '\b': /* Backspace */
839 if (gc_hanging_cursor
) {
840 gc_hanging_cursor
= 0;
847 while (gc_x
< vinfo
.v_columns
&& !gc_tab_stops
[++gc_x
]);
848 if (gc_x
>= vinfo
.v_columns
)
849 gc_x
= vinfo
.v_columns
-1;
853 case '\n': /* Line feed */
854 if (gc_y
>= gc_scrreg_bottom
-1 ) {
855 gc_scroll_up(1, gc_scrreg_top
, gc_scrreg_bottom
);
856 gc_y
= gc_scrreg_bottom
- 1;
861 case '\r': /* Carriage return */
863 gc_hanging_cursor
= 0;
865 case 0x0e: /* Select G1 charset (Control-N) */
866 gc_charset_select
= 1;
868 case 0x0f: /* Select G0 charset (Control-O) */
869 gc_charset_select
= 0;
871 case 0x18 : /* CAN : cancel */
872 case 0x1A : /* like cancel */
873 /* well, i do nothing here, may be later */
875 case '\033': /* Escape */
876 gc_vt100state
= ESesc
;
877 gc_hanging_cursor
= 0;
881 if (gc_hanging_cursor
) {
883 if (gc_y
>= gc_scrreg_bottom
-1 ) {
884 gc_scroll_up(1, gc_scrreg_top
, gc_scrreg_bottom
);
885 gc_y
= gc_scrreg_bottom
- 1;
889 gc_hanging_cursor
= 0;
891 gc_paint_char(gc_x
, gc_y
, (ch
>= 0x60 && ch
<= 0x7f) ? ch
+ gc_charset
[gc_charset_select
]
893 if (gc_x
== vinfo
.v_columns
- 1) {
894 gc_hanging_cursor
= gc_wrap_mode
;
905 gc_putc_square(unsigned char ch
)
909 for (i
= 0; i
< MAXPARS
; i
++) {
914 gc_vt100state
= ESgetpars
;
921 gc_refresh_screen(void)
926 simple_lock(&gc_buffer_lock
);
928 if ( gc_buffer_size
)
930 unsigned char colorcodesave
= gc_color_code
;
931 unsigned long column
, row
;
934 for ( index
= 0, row
= 0 ; row
< gc_buffer_rows
; row
++ )
936 for ( column
= 0 ; column
< gc_buffer_columns
; index
++, column
++ )
938 if ( gc_buffer_colorcodes
[index
] != gc_color_code
)
940 gc_update_color(COLOR_CODE_GET(gc_buffer_colorcodes
[index
], TRUE
), TRUE
);
941 gc_update_color(COLOR_CODE_GET(gc_buffer_colorcodes
[index
], FALSE
), FALSE
);
944 gc_ops
.paint_char(column
, row
, gc_buffer_characters
[index
], gc_buffer_attributes
[index
], 0, 0);
948 if ( colorcodesave
!= gc_color_code
)
950 gc_update_color(COLOR_CODE_GET(colorcodesave
, TRUE
), TRUE
);
951 gc_update_color(COLOR_CODE_GET(colorcodesave
, FALSE
), FALSE
);
955 simple_unlock(&gc_buffer_lock
);
960 gc_reset_screen(void)
962 gc_hide_cursor(gc_x
, gc_y
);
965 gc_clear_screen(gc_x
, gc_y
, 0, vinfo
.v_rows
, 2);
966 gc_show_cursor(gc_x
, gc_y
);
974 for (i
= 0; i
<= vinfo
.v_columns
; i
++) {
975 gc_tab_stops
[i
] = ((i
% 8) == 0);
985 gc_scrreg_bottom
= vinfo
.v_rows
;
987 gc_charset
[0] = gc_charset
[1] = 0;
988 gc_charset_select
= 0;
990 gc_relative_origin
= 0;
991 gc_update_color(COLOR_BACKGROUND
, FALSE
);
992 gc_update_color(COLOR_FOREGROUND
, TRUE
);
996 gc_scroll_down(int num
, int top
, int bottom
)
1000 if (!gc_buffer_size
) return;
1003 simple_lock(&gc_buffer_lock
);
1005 if ( bottom
<= gc_buffer_rows
)
1007 unsigned char colorcodesave
= gc_color_code
;
1008 unsigned long column
, row
;
1009 unsigned long index
, jump
;
1011 jump
= num
* gc_buffer_columns
;
1013 for ( row
= bottom
- 1 ; row
>= top
+ num
; row
-- )
1015 index
= row
* gc_buffer_columns
;
1017 for ( column
= 0 ; column
< gc_buffer_columns
; index
++, column
++ )
1019 if ( gc_buffer_attributes
[index
] != gc_buffer_attributes
[index
- jump
] ||
1020 gc_buffer_characters
[index
] != gc_buffer_characters
[index
- jump
] ||
1021 gc_buffer_colorcodes
[index
] != gc_buffer_colorcodes
[index
- jump
] )
1023 if ( gc_color_code
!= gc_buffer_colorcodes
[index
- jump
] )
1025 gc_update_color(COLOR_CODE_GET(gc_buffer_colorcodes
[index
- jump
], TRUE
), TRUE
);
1026 gc_update_color(COLOR_CODE_GET(gc_buffer_colorcodes
[index
- jump
], FALSE
), FALSE
);
1029 if ( gc_buffer_colorcodes
[index
] != gc_buffer_colorcodes
[index
- jump
] )
1031 gc_ops
.paint_char( /* xx */ column
,
1033 /* ch */ gc_buffer_characters
[index
- jump
],
1034 /* attrs */ gc_buffer_attributes
[index
- jump
],
1035 /* ch_previous */ 0,
1036 /* attrs_previous */ 0 );
1040 gc_ops
.paint_char( /* xx */ column
,
1042 /* ch */ gc_buffer_characters
[index
- jump
],
1043 /* attrs */ gc_buffer_attributes
[index
- jump
],
1044 /* ch_previous */ gc_buffer_characters
[index
],
1045 /* attrs_previous */ gc_buffer_attributes
[index
] );
1048 gc_buffer_attributes
[index
] = gc_buffer_attributes
[index
- jump
];
1049 gc_buffer_characters
[index
] = gc_buffer_characters
[index
- jump
];
1050 gc_buffer_colorcodes
[index
] = gc_buffer_colorcodes
[index
- jump
];
1055 if ( colorcodesave
!= gc_color_code
)
1057 gc_update_color(COLOR_CODE_GET(colorcodesave
, TRUE
), TRUE
);
1058 gc_update_color(COLOR_CODE_GET(colorcodesave
, FALSE
), FALSE
);
1061 simple_unlock(&gc_buffer_lock
);
1066 simple_unlock(&gc_buffer_lock
);
1069 gc_ops
.scroll_down(num
, top
, bottom
);
1072 /* Now set the freed up lines to the background colour */
1074 gc_clear_screen(vinfo
.v_columns
- 1, top
+ num
- 1, top
, bottom
, 1);
1078 gc_scroll_up(int num
, int top
, int bottom
)
1082 if (!gc_buffer_size
) return;
1085 simple_lock(&gc_buffer_lock
);
1087 if ( bottom
<= gc_buffer_rows
)
1089 unsigned char colorcodesave
= gc_color_code
;
1090 unsigned long column
, row
;
1091 unsigned long index
, jump
;
1093 jump
= num
* gc_buffer_columns
;
1095 for ( row
= top
; row
< bottom
- num
; row
++ )
1097 index
= row
* gc_buffer_columns
;
1099 for ( column
= 0 ; column
< gc_buffer_columns
; index
++, column
++ )
1101 if ( gc_buffer_attributes
[index
] != gc_buffer_attributes
[index
+ jump
] ||
1102 gc_buffer_characters
[index
] != gc_buffer_characters
[index
+ jump
] ||
1103 gc_buffer_colorcodes
[index
] != gc_buffer_colorcodes
[index
+ jump
] )
1105 if ( gc_color_code
!= gc_buffer_colorcodes
[index
+ jump
] )
1107 gc_update_color(COLOR_CODE_GET(gc_buffer_colorcodes
[index
+ jump
], TRUE
), TRUE
);
1108 gc_update_color(COLOR_CODE_GET(gc_buffer_colorcodes
[index
+ jump
], FALSE
), FALSE
);
1111 if ( gc_buffer_colorcodes
[index
] != gc_buffer_colorcodes
[index
+ jump
] )
1113 gc_ops
.paint_char( /* xx */ column
,
1115 /* ch */ gc_buffer_characters
[index
+ jump
],
1116 /* attrs */ gc_buffer_attributes
[index
+ jump
],
1117 /* ch_previous */ 0,
1118 /* attrs_previous */ 0 );
1122 gc_ops
.paint_char( /* xx */ column
,
1124 /* ch */ gc_buffer_characters
[index
+ jump
],
1125 /* attrs */ gc_buffer_attributes
[index
+ jump
],
1126 /* ch_previous */ gc_buffer_characters
[index
],
1127 /* attrs_previous */ gc_buffer_attributes
[index
] );
1130 gc_buffer_attributes
[index
] = gc_buffer_attributes
[index
+ jump
];
1131 gc_buffer_characters
[index
] = gc_buffer_characters
[index
+ jump
];
1132 gc_buffer_colorcodes
[index
] = gc_buffer_colorcodes
[index
+ jump
];
1138 if ( colorcodesave
!= gc_color_code
)
1140 gc_update_color(COLOR_CODE_GET(colorcodesave
, TRUE
), TRUE
);
1141 gc_update_color(COLOR_CODE_GET(colorcodesave
, FALSE
), FALSE
);
1144 simple_unlock(&gc_buffer_lock
);
1149 simple_unlock(&gc_buffer_lock
);
1152 gc_ops
.scroll_up(num
, top
, bottom
);
1155 /* Now set the freed up lines to the background colour */
1157 gc_clear_screen(0, bottom
- num
, top
, bottom
, 0);
1161 gc_show_cursor(int xx
, int yy
)
1166 simple_lock(&gc_buffer_lock
);
1168 if ( xx
< gc_buffer_columns
&& yy
< gc_buffer_rows
)
1170 unsigned long index
= (yy
* gc_buffer_columns
) + xx
;
1171 unsigned char attribute
= gc_buffer_attributes
[index
];
1172 unsigned char character
= gc_buffer_characters
[index
];
1173 unsigned char colorcode
= gc_buffer_colorcodes
[index
];
1174 unsigned char colorcodesave
= gc_color_code
;
1176 simple_unlock(&gc_buffer_lock
);
1179 gc_update_color(COLOR_CODE_GET(colorcode
, FALSE
), TRUE
);
1180 gc_update_color(COLOR_CODE_GET(colorcode
, TRUE
), FALSE
);
1182 gc_ops
.paint_char(xx
, yy
, character
, attribute
, 0, 0);
1184 gc_update_color(COLOR_CODE_GET(colorcodesave
, TRUE
), TRUE
);
1185 gc_update_color(COLOR_CODE_GET(colorcodesave
, FALSE
), FALSE
);
1189 simple_unlock(&gc_buffer_lock
);
1192 gc_ops
.show_cursor(xx
, yy
);
1197 gc_update_color(int color
, boolean_t fore
)
1199 gc_color_code
= COLOR_CODE_SET(gc_color_code
, color
, fore
);
1200 gc_ops
.update_color(color
, fore
);
1204 vcputc(int l
, int u
, int c
)
1206 if ( gc_enabled
|| debug_mode
)
1208 gc_hide_cursor(gc_x
, gc_y
);
1210 gc_show_cursor(gc_x
, gc_y
);
1217 * Video Console (Back-End)
1218 * ------------------------
1222 * For the color support (Michel Pollet)
1224 static unsigned char vc_color_index_table
[33] =
1225 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1226 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2 };
1228 static unsigned long vc_colors
[8][3] = {
1229 { 0xFFFFFFFF, 0x00000000, 0x00000000 }, /* black */
1230 { 0x23232323, 0x7C007C00, 0x00FF0000 }, /* red */
1231 { 0xb9b9b9b9, 0x03e003e0, 0x0000FF00 }, /* green */
1232 { 0x05050505, 0x7FE07FE0, 0x00FFFF00 }, /* yellow */
1233 { 0xd2d2d2d2, 0x001f001f, 0x000000FF}, /* blue */
1234 // { 0x80808080, 0x31933193, 0x00666699 }, /* blue */
1235 { 0x18181818, 0x7C1F7C1F, 0x00FF00FF }, /* magenta */
1236 { 0xb4b4b4b4, 0x03FF03FF, 0x0000FFFF }, /* cyan */
1237 { 0x00000000, 0x7FFF7FFF, 0x00FFFFFF } /* white */
1240 static unsigned long vc_color_fore
= 0;
1241 static unsigned long vc_color_back
= 0;
1244 * New Rendering code from Michel Pollet
1247 /* Rendered Font Buffer */
1248 static unsigned char *vc_rendered_font
= NULL
;
1250 /* Rendered Font Size */
1251 static unsigned long vc_rendered_font_size
= 0;
1253 /* Size of a character in the table (bytes) */
1254 static int vc_rendered_char_size
= 0;
1256 #define REN_MAX_DEPTH 32
1257 static unsigned char vc_rendered_char
[ISO_CHAR_HEIGHT
* ((REN_MAX_DEPTH
/ 8) * ISO_CHAR_WIDTH
)];
1259 static void vc_clear_screen(int xx
, int yy
, int scrreg_top
, int scrreg_bottom
, int which
);
1260 static void vc_enable(boolean_t enable
);
1261 static void vc_initialize(struct vc_info
* vinfo_p
);
1262 static void vc_paint_char(int xx
, int yy
, unsigned char ch
, int attrs
, unsigned char ch_previous
, int attrs_previous
);
1263 static void vc_paint_char_8(int xx
, int yy
, unsigned char ch
, int attrs
, unsigned char ch_previous
, int attrs_previous
);
1264 static void vc_paint_char_16(int xx
, int yy
, unsigned char ch
, int attrs
, unsigned char ch_previous
, int attrs_previous
);
1265 static void vc_paint_char_32(int xx
, int yy
, unsigned char ch
, int attrs
, unsigned char ch_previous
, int attrs_previous
);
1266 static void vc_render_char(unsigned char ch
, unsigned char *renderptr
, short newdepth
);
1267 static void vc_render_font(short newdepth
);
1268 static void vc_reverse_cursor(int xx
, int yy
);
1269 static void vc_scroll_down(int num
, int scrreg_top
, int scrreg_bottom
);
1270 static void vc_scroll_up(int num
, int scrreg_top
, int scrreg_bottom
);
1271 static void vc_update_color(int color
, boolean_t fore
);
1274 vc_clear_screen(int xx
, int yy
, int scrreg_top
, int scrreg_bottom
, int which
)
1276 unsigned long *p
, *endp
, *row
;
1278 int rowline
, rowlongs
;
1283 linelongs
= vinfo
.v_rowbytes
* (ISO_CHAR_HEIGHT
>> 2);
1284 rowline
= vinfo
.v_rowscanbytes
>> 2;
1285 rowlongs
= vinfo
.v_rowbytes
>> 2;
1287 p
= (unsigned long*) vinfo
.v_baseaddr
;
1288 endp
= (unsigned long*) vinfo
.v_baseaddr
;
1291 case 0: /* To end of screen */
1292 gc_clear_line(xx
, yy
, 0);
1293 if (yy
< scrreg_bottom
- 1) {
1294 p
+= (yy
+ 1) * linelongs
;
1295 endp
+= scrreg_bottom
* linelongs
;
1298 case 1: /* To start of screen */
1299 gc_clear_line(xx
, yy
, 1);
1300 if (yy
> scrreg_top
) {
1301 p
+= scrreg_top
* linelongs
;
1302 endp
+= yy
* linelongs
;
1305 case 2: /* Whole screen */
1306 p
+= scrreg_top
* linelongs
;
1307 if (scrreg_bottom
== vinfo
.v_rows
) {
1308 endp
+= rowlongs
* vinfo
.v_height
;
1310 endp
+= scrreg_bottom
* linelongs
;
1315 for (row
= p
; row
< endp
; row
+= rowlongs
) {
1316 for (col
= 0; col
< rowline
; col
++)
1317 *(row
+col
) = vc_color_back
;
1322 vc_enable(boolean_t enable
)
1326 vc_render_font(vinfo
.v_depth
);
1331 vc_initialize(struct vc_info
* vinfo_p
)
1333 vinfo
.v_rows
= vinfo
.v_height
/ ISO_CHAR_HEIGHT
;
1334 vinfo
.v_columns
= vinfo
.v_width
/ ISO_CHAR_WIDTH
;
1335 vinfo
.v_rowscanbytes
= (vinfo
.v_depth
/ 8) * vinfo
.v_width
;
1339 vc_paint_char(int xx
, int yy
, unsigned char ch
, int attrs
, unsigned char ch_previous
, int attrs_previous
)
1344 switch( vinfo
.v_depth
) {
1346 vc_paint_char_8(xx
, yy
, ch
, attrs
, ch_previous
, attrs_previous
);
1349 vc_paint_char_16(xx
, yy
, ch
, attrs
, ch_previous
, attrs_previous
);
1352 vc_paint_char_32(xx
, yy
, ch
, attrs
, ch_previous
, attrs_previous
);
1358 vc_paint_char_8(int xx
, int yy
, unsigned char ch
, int attrs
, unsigned char ch_previous
, int attrs_previous
)
1360 unsigned long *theChar
;
1361 unsigned long *where
;
1364 if (vc_rendered_font
) {
1365 theChar
= (unsigned long*)(vc_rendered_font
+ (ch
* vc_rendered_char_size
));
1367 vc_render_char(ch
, vc_rendered_char
, 8);
1368 theChar
= (unsigned long*)(vc_rendered_char
);
1370 where
= (unsigned long*)(vinfo
.v_baseaddr
+
1371 (yy
* ISO_CHAR_HEIGHT
* vinfo
.v_rowbytes
) +
1372 (xx
* ISO_CHAR_WIDTH
));
1374 if (!attrs
) for (i
= 0; i
< ISO_CHAR_HEIGHT
; i
++) { /* No attr? FLY !*/
1375 unsigned long *store
= where
;
1377 for (x
= 0; x
< 2; x
++) {
1378 unsigned long val
= *theChar
++;
1379 val
= (vc_color_back
& ~val
) | (vc_color_fore
& val
);
1383 where
= (unsigned long*)(((unsigned char*)where
)+vinfo
.v_rowbytes
);
1384 } else for (i
= 0; i
< ISO_CHAR_HEIGHT
; i
++) { /* a little slower */
1385 unsigned long *store
= where
, lastpixel
= 0;
1387 for (x
= 0 ; x
< 2; x
++) {
1388 unsigned long val
= *theChar
++, save
= val
;
1389 if (attrs
& ATTR_BOLD
) { /* bold support */
1390 if (lastpixel
&& !(save
& 0xFF000000))
1392 if ((save
& 0xFFFF0000) == 0xFF000000)
1394 if ((save
& 0x00FFFF00) == 0x00FF0000)
1396 if ((save
& 0x0000FFFF) == 0x0000FF00)
1399 if (attrs
& ATTR_REVERSE
) val
= ~val
;
1400 if (attrs
& ATTR_UNDER
&& i
== ISO_CHAR_HEIGHT
-1) val
= ~val
;
1402 val
= (vc_color_back
& ~val
) | (vc_color_fore
& val
);
1404 lastpixel
= save
& 0xff;
1407 where
= (unsigned long*)(((unsigned char*)where
)+vinfo
.v_rowbytes
);
1413 vc_paint_char_16(int xx
, int yy
, unsigned char ch
, int attrs
, unsigned char ch_previous
, int attrs_previous
)
1415 unsigned long *theChar
;
1416 unsigned long *where
;
1419 if (vc_rendered_font
) {
1420 theChar
= (unsigned long*)(vc_rendered_font
+ (ch
* vc_rendered_char_size
));
1422 vc_render_char(ch
, vc_rendered_char
, 16);
1423 theChar
= (unsigned long*)(vc_rendered_char
);
1425 where
= (unsigned long*)(vinfo
.v_baseaddr
+
1426 (yy
* ISO_CHAR_HEIGHT
* vinfo
.v_rowbytes
) +
1427 (xx
* ISO_CHAR_WIDTH
* 2));
1429 if (!attrs
) for (i
= 0; i
< ISO_CHAR_HEIGHT
; i
++) { /* No attrs ? FLY ! */
1430 unsigned long *store
= where
;
1432 for (x
= 0; x
< 4; x
++) {
1433 unsigned long val
= *theChar
++;
1434 val
= (vc_color_back
& ~val
) | (vc_color_fore
& val
);
1438 where
= (unsigned long*)(((unsigned char*)where
)+vinfo
.v_rowbytes
);
1439 } else for (i
= 0; i
< ISO_CHAR_HEIGHT
; i
++) { /* a little bit slower */
1440 unsigned long *store
= where
, lastpixel
= 0;
1442 for (x
= 0 ; x
< 4; x
++) {
1443 unsigned long val
= *theChar
++, save
= val
;
1444 if (attrs
& ATTR_BOLD
) { /* bold support */
1445 if (save
== 0xFFFF0000) val
|= 0xFFFF;
1446 else if (lastpixel
&& !(save
& 0xFFFF0000))
1449 if (attrs
& ATTR_REVERSE
) val
= ~val
;
1450 if (attrs
& ATTR_UNDER
&& i
== ISO_CHAR_HEIGHT
-1) val
= ~val
;
1452 val
= (vc_color_back
& ~val
) | (vc_color_fore
& val
);
1455 lastpixel
= save
& 0x7fff;
1458 where
= (unsigned long*)(((unsigned char*)where
)+vinfo
.v_rowbytes
);
1464 vc_paint_char_32(int xx
, int yy
, unsigned char ch
, int attrs
, unsigned char ch_previous
, int attrs_previous
)
1466 unsigned long *theChar
;
1467 unsigned long *theCharPrevious
;
1468 unsigned long *where
;
1471 if (vc_rendered_font
) {
1472 theChar
= (unsigned long*)(vc_rendered_font
+ (ch
* vc_rendered_char_size
));
1473 theCharPrevious
= (unsigned long*)(vc_rendered_font
+ (ch_previous
* vc_rendered_char_size
));
1475 vc_render_char(ch
, vc_rendered_char
, 32);
1476 theChar
= (unsigned long*)(vc_rendered_char
);
1477 theCharPrevious
= NULL
;
1480 theCharPrevious
= NULL
;
1482 if (attrs_previous
) {
1483 theCharPrevious
= NULL
;
1485 where
= (unsigned long*)(vinfo
.v_baseaddr
+
1486 (yy
* ISO_CHAR_HEIGHT
* vinfo
.v_rowbytes
) +
1487 (xx
* ISO_CHAR_WIDTH
* 4));
1489 if (!attrs
) for (i
= 0; i
< ISO_CHAR_HEIGHT
; i
++) { /* No attrs ? FLY ! */
1490 unsigned long *store
= where
;
1492 for (x
= 0; x
< 8; x
++) {
1493 unsigned long val
= *theChar
++;
1494 if (theCharPrevious
== NULL
|| val
!= *theCharPrevious
++ ) {
1495 val
= (vc_color_back
& ~val
) | (vc_color_fore
& val
);
1502 where
= (unsigned long*)(((unsigned char*)where
)+vinfo
.v_rowbytes
);
1503 } else for (i
= 0; i
< ISO_CHAR_HEIGHT
; i
++) { /* a little slower */
1504 unsigned long *store
= where
, lastpixel
= 0;
1506 for (x
= 0 ; x
< 8; x
++) {
1507 unsigned long val
= *theChar
++, save
= val
;
1508 if (attrs
& ATTR_BOLD
) { /* bold support */
1509 if (lastpixel
&& !save
)
1512 if (attrs
& ATTR_REVERSE
) val
= ~val
;
1513 if (attrs
& ATTR_UNDER
&& i
== ISO_CHAR_HEIGHT
-1) val
= ~val
;
1515 val
= (vc_color_back
& ~val
) | (vc_color_fore
& val
);
1520 where
= (unsigned long*)(((unsigned char*)where
)+vinfo
.v_rowbytes
);
1526 vc_render_char(unsigned char ch
, unsigned char *renderptr
, short newdepth
)
1529 unsigned char *charptr
;
1530 unsigned short *shortptr
;
1531 unsigned long *longptr
;
1532 } current
; /* current place in rendered font, multiple types. */
1534 unsigned char *theChar
; /* current char in iso_font */
1538 current
.charptr
= renderptr
;
1539 theChar
= iso_font
+ (ch
* ISO_CHAR_HEIGHT
);
1541 for (line
= 0; line
< ISO_CHAR_HEIGHT
; line
++) {
1542 unsigned char mask
= 1;
1546 *current
.charptr
++ = (*theChar
& mask
) ? 0xFF : 0;
1549 *current
.shortptr
++ = (*theChar
& mask
) ? 0xFFFF : 0;
1553 *current
.longptr
++ = (*theChar
& mask
) ? 0xFFFFFFFF : 0;
1557 } while (mask
); /* while the single bit drops to the right */
1563 vc_render_font(short newdepth
)
1565 static short olddepth
= 0;
1567 int charindex
; /* index in ISO font */
1569 if (vm_initialized
== FALSE
) {
1570 return; /* nothing to do */
1572 if (olddepth
== newdepth
&& vc_rendered_font
) {
1573 return; /* nothing to do */
1575 if (vc_rendered_font
) {
1576 kfree(vc_rendered_font
, vc_rendered_font_size
);
1579 vc_rendered_char_size
= ISO_CHAR_HEIGHT
* ((newdepth
/ 8) * ISO_CHAR_WIDTH
);
1580 vc_rendered_font_size
= (ISO_CHAR_MAX
-ISO_CHAR_MIN
+1) * vc_rendered_char_size
;
1581 vc_rendered_font
= (unsigned char *) kalloc(vc_rendered_font_size
);
1583 if (vc_rendered_font
== NULL
) {
1584 vc_rendered_font_size
= 0;
1588 for (charindex
= ISO_CHAR_MIN
; charindex
<= ISO_CHAR_MAX
; charindex
++) {
1589 vc_render_char(charindex
, vc_rendered_font
+ (charindex
* vc_rendered_char_size
), newdepth
);
1592 olddepth
= newdepth
;
1596 vc_reverse_cursor(int xx
, int yy
)
1598 unsigned long *where
;
1604 where
= (unsigned long*)(vinfo
.v_baseaddr
+
1605 (yy
* ISO_CHAR_HEIGHT
* vinfo
.v_rowbytes
) +
1606 (xx
/** ISO_CHAR_WIDTH*/ * vinfo
.v_depth
));
1607 for (line
= 0; line
< ISO_CHAR_HEIGHT
; line
++) {
1608 switch (vinfo
.v_depth
) {
1610 where
[0] = ~where
[0];
1611 where
[1] = ~where
[1];
1614 for (col
= 0; col
< 4; col
++)
1615 where
[col
] = ~where
[col
];
1618 for (col
= 0; col
< 8; col
++)
1619 where
[col
] = ~where
[col
];
1622 where
= (unsigned long*)(((unsigned char*)where
)+vinfo
.v_rowbytes
);
1627 vc_scroll_down(int num
, int scrreg_top
, int scrreg_bottom
)
1629 unsigned long *from
, *to
, linelongs
, i
, line
, rowline
, rowscanline
;
1634 linelongs
= vinfo
.v_rowbytes
* (ISO_CHAR_HEIGHT
>> 2);
1635 rowline
= vinfo
.v_rowbytes
>> 2;
1636 rowscanline
= vinfo
.v_rowscanbytes
>> 2;
1638 to
= (unsigned long *) vinfo
.v_baseaddr
+ (linelongs
* scrreg_bottom
)
1639 - (rowline
- rowscanline
);
1640 from
= to
- (linelongs
* num
); /* handle multiple line scroll (Michel Pollet) */
1642 i
= (scrreg_bottom
- scrreg_top
) - num
;
1645 for (line
= 0; line
< ISO_CHAR_HEIGHT
; line
++) {
1647 * Only copy what is displayed
1649 video_scroll_down((unsigned int) from
,
1650 (unsigned int) (from
-(vinfo
.v_rowscanbytes
>> 2)),
1660 vc_scroll_up(int num
, int scrreg_top
, int scrreg_bottom
)
1662 unsigned long *from
, *to
, linelongs
, i
, line
, rowline
, rowscanline
;
1667 linelongs
= vinfo
.v_rowbytes
* (ISO_CHAR_HEIGHT
>> 2);
1668 rowline
= vinfo
.v_rowbytes
>> 2;
1669 rowscanline
= vinfo
.v_rowscanbytes
>> 2;
1671 to
= (unsigned long *) vinfo
.v_baseaddr
+ (scrreg_top
* linelongs
);
1672 from
= to
+ (linelongs
* num
); /* handle multiple line scroll (Michel Pollet) */
1674 i
= (scrreg_bottom
- scrreg_top
) - num
;
1677 for (line
= 0; line
< ISO_CHAR_HEIGHT
; line
++) {
1679 * Only copy what is displayed
1681 video_scroll_up((unsigned int) from
,
1682 (unsigned int) (from
+(vinfo
.v_rowscanbytes
>> 2)),
1692 vc_update_color(int color
, boolean_t fore
)
1697 vc_color_fore
= vc_colors
[color
][vc_color_index_table
[vinfo
.v_depth
]];
1699 vc_color_back
= vc_colors
[color
][vc_color_index_table
[vinfo
.v_depth
]];
1704 * Video Console (Back-End): Icon Control
1705 * --------------------------------------
1708 struct vc_progress_element
{
1709 unsigned int version
;
1712 unsigned char count
;
1713 unsigned char res
[3];
1719 unsigned int res2
[3];
1720 unsigned char data
[0];
1722 typedef struct vc_progress_element vc_progress_element
;
1724 static vc_progress_element
* vc_progress
;
1725 static const unsigned char * vc_progress_data
;
1726 static const unsigned char * vc_progress_alpha
;
1727 static boolean_t vc_progress_enable
;
1728 static const unsigned char * vc_clut
;
1729 static const unsigned char * vc_clut8
;
1730 static unsigned char vc_revclut8
[256];
1731 static uint32_t vc_progress_interval
;
1732 static uint64_t vc_progress_deadline
;
1733 static thread_call_data_t vc_progress_call
;
1734 static boolean_t vc_needsave
;
1735 static void * vc_saveunder
;
1736 static vm_size_t vc_saveunder_len
;
1737 decl_simple_lock_data(,vc_progress_lock
)
1739 static void vc_blit_rect( int x
, int y
, int width
, int height
,
1740 const unsigned char * dataPtr
, const unsigned char * alphaPtr
,
1741 void * backBuffer
, boolean_t save
, boolean_t static_alpha
);
1742 static void vc_blit_rect_8( int x
, int y
, int width
, int height
,
1743 const unsigned char * dataPtr
, const unsigned char * alphaPtr
,
1744 unsigned char * backBuffer
, boolean_t save
, boolean_t static_alpha
);
1745 static void vc_blit_rect_16( int x
, int y
, int width
, int height
,
1746 const unsigned char * dataPtr
, const unsigned char * alphaPtr
,
1747 unsigned short * backBuffer
, boolean_t save
, boolean_t static_alpha
);
1748 static void vc_blit_rect_32( int x
, int y
, int width
, int height
,
1749 const unsigned char * dataPtr
, const unsigned char * alphaPtr
,
1750 unsigned int * backBuffer
, boolean_t save
, boolean_t static_alpha
);
1751 extern void vc_display_icon( vc_progress_element
* desc
, const unsigned char * data
);
1752 extern void vc_progress_initialize( vc_progress_element
* desc
, const unsigned char * data
, const unsigned char * clut
);
1753 static void vc_progress_set( boolean_t enable
, uint32_t delay
);
1754 static void vc_progress_task( void * arg0
, void * arg
);
1756 static void vc_blit_rect( int x
, int y
,
1757 int width
, int height
,
1758 const unsigned char * dataPtr
,
1759 const unsigned char * alphaPtr
,
1761 boolean_t save
, boolean_t static_alpha
)
1766 switch( vinfo
.v_depth
) {
1768 if( vc_clut8
== vc_clut
)
1769 vc_blit_rect_8( x
, y
, width
, height
, dataPtr
, alphaPtr
, (unsigned char *) backBuffer
, save
, static_alpha
);
1772 vc_blit_rect_16( x
, y
, width
, height
, dataPtr
, alphaPtr
, (unsigned short *) backBuffer
, save
, static_alpha
);
1775 vc_blit_rect_32( x
, y
, width
, height
, dataPtr
, alphaPtr
, (unsigned int *) backBuffer
, save
, static_alpha
);
1780 static void vc_blit_rect_8( int x
, int y
,
1781 int width
, int height
,
1782 const unsigned char * dataPtr
,
1783 const unsigned char * alphaPtr
,
1784 unsigned char * backPtr
,
1785 boolean_t save
, boolean_t static_alpha
)
1787 volatile unsigned char * dst
;
1791 dst
= (unsigned char *)(vinfo
.v_baseaddr
+
1792 (y
* vinfo
.v_rowbytes
) +
1795 for( line
= 0; line
< height
; line
++) {
1796 for( col
= 0; col
< width
; col
++) {
1798 if( dataPtr
!= 0) data
= *dataPtr
++;
1799 else if( alphaPtr
!= 0) data
= vc_revclut8
[*alphaPtr
++];
1800 *(dst
+ col
) = data
;
1802 dst
= (volatile unsigned char *) (((int)dst
) + vinfo
.v_rowbytes
);
1806 static void vc_blit_rect_16( int x
, int y
,
1807 int width
, int height
,
1808 const unsigned char * dataPtr
,
1809 const unsigned char * alphaPtr
,
1810 unsigned short * backPtr
,
1811 boolean_t save
, boolean_t static_alpha
)
1813 volatile unsigned short * dst
;
1815 unsigned int data
, index
, alpha
, back
;
1817 dst
= (volatile unsigned short *)(vinfo
.v_baseaddr
+
1818 (y
* vinfo
.v_rowbytes
) +
1821 for( line
= 0; line
< height
; line
++) {
1822 for( col
= 0; col
< width
; col
++) {
1828 if( alphaPtr
&& backPtr
) {
1830 alpha
= *alphaPtr
++;
1833 if( vc_clut
[index
+ 0] > alpha
)
1834 data
|= (((vc_clut
[index
+ 0] - alpha
) & 0xf8) << 7);
1835 if( vc_clut
[index
+ 1] > alpha
)
1836 data
|= (((vc_clut
[index
+ 1] - alpha
) & 0xf8) << 2);
1837 if( vc_clut
[index
+ 2] > alpha
)
1838 data
|= (((vc_clut
[index
+ 2] - alpha
) & 0xf8) >> 3);
1842 back
= *(dst
+ col
);
1845 back
= (((((back
& 0x7c00) * alpha
) + 0x3fc00) >> 8) & 0x7c00)
1846 | (((((back
& 0x03e0) * alpha
) + 0x01fe0) >> 8) & 0x03e0)
1847 | (((((back
& 0x001f) * alpha
) + 0x000ff) >> 8) & 0x001f);
1852 if ( !static_alpha
) {
1853 back
= (((((back
& 0x7c00) * alpha
) + 0x3fc00) >> 8) & 0x7c00)
1854 | (((((back
& 0x03e0) * alpha
) + 0x01fe0) >> 8) & 0x03e0)
1855 | (((((back
& 0x001f) * alpha
) + 0x000ff) >> 8) & 0x001f);
1863 data
= ( (0xf8 & (vc_clut
[index
+ 0])) << 7)
1864 | ( (0xf8 & (vc_clut
[index
+ 1])) << 2)
1865 | ( (0xf8 & (vc_clut
[index
+ 2])) >> 3);
1868 *(dst
+ col
) = data
;
1870 dst
= (volatile unsigned short *) (((int)dst
) + vinfo
.v_rowbytes
);
1874 static void vc_blit_rect_32( int x
, int y
,
1875 int width
, int height
,
1876 const unsigned char * dataPtr
,
1877 const unsigned char * alphaPtr
,
1878 unsigned int * backPtr
,
1879 boolean_t save
, boolean_t static_alpha
)
1881 volatile unsigned int * dst
;
1883 unsigned int data
, index
, alpha
, back
;
1885 dst
= (volatile unsigned int *) (vinfo
.v_baseaddr
+
1886 (y
* vinfo
.v_rowbytes
) +
1889 for( line
= 0; line
< height
; line
++) {
1890 for( col
= 0; col
< width
; col
++) {
1896 if( alphaPtr
&& backPtr
) {
1898 alpha
= *alphaPtr
++;
1901 if( vc_clut
[index
+ 0] > alpha
)
1902 data
|= ((vc_clut
[index
+ 0] - alpha
) << 16);
1903 if( vc_clut
[index
+ 1] > alpha
)
1904 data
|= ((vc_clut
[index
+ 1] - alpha
) << 8);
1905 if( vc_clut
[index
+ 2] > alpha
)
1906 data
|= ((vc_clut
[index
+ 2] - alpha
));
1910 back
= *(dst
+ col
);
1913 back
= (((((back
& 0x00ff00ff) * alpha
) + 0x00ff00ff) >> 8) & 0x00ff00ff)
1914 | (((((back
& 0x0000ff00) * alpha
) + 0x0000ff00) >> 8) & 0x0000ff00);
1919 if ( !static_alpha
) {
1920 back
= (((((back
& 0x00ff00ff) * alpha
) + 0x00ff00ff) >> 8) & 0x00ff00ff)
1921 | (((((back
& 0x0000ff00) * alpha
) + 0x0000ff00) >> 8) & 0x0000ff00);
1929 data
= (vc_clut
[index
+ 0] << 16)
1930 | (vc_clut
[index
+ 1] << 8)
1931 | (vc_clut
[index
+ 2]);
1934 *(dst
+ col
) = data
;
1936 dst
= (volatile unsigned int *) (((int)dst
) + vinfo
.v_rowbytes
);
1940 void vc_display_icon( vc_progress_element
* desc
,
1941 const unsigned char * data
)
1943 int x
, y
, width
, height
;
1945 if( vc_progress_enable
&& vc_clut
) {
1947 width
= desc
->width
;
1948 height
= desc
->height
;
1951 if( 1 & desc
->flags
) {
1952 x
+= ((vinfo
.v_width
- width
) / 2);
1953 y
+= ((vinfo
.v_height
- height
) / 2);
1955 vc_blit_rect( x
, y
, width
, height
, data
, NULL
, NULL
, FALSE
, TRUE
);
1960 vc_progress_initialize( vc_progress_element
* desc
,
1961 const unsigned char * data
,
1962 const unsigned char * clut
)
1966 if( (!clut
) || (!desc
) || (!data
))
1972 vc_progress_data
= data
;
1973 if( 2 & vc_progress
->flags
)
1974 vc_progress_alpha
= vc_progress_data
1975 + vc_progress
->count
* vc_progress
->width
* vc_progress
->height
;
1977 vc_progress_alpha
= NULL
;
1979 thread_call_setup(&vc_progress_call
, vc_progress_task
, NULL
);
1981 clock_interval_to_absolutetime_interval(vc_progress
->time
, 1000 * 1000, &abstime
);
1982 vc_progress_interval
= abstime
;
1984 simple_lock_init(&vc_progress_lock
, 0);
1988 vc_progress_set( boolean_t enable
, uint32_t delay
)
1992 vm_size_t saveLen
= 0;
1995 unsigned char pdata8
;
1996 unsigned short pdata16
;
1997 unsigned short * buf16
;
1998 unsigned int pdata32
;
1999 unsigned int * buf32
;
2005 saveLen
= vc_progress
->width
* vc_progress
->height
* vinfo
.v_depth
/ 8;
2006 saveBuf
= kalloc( saveLen
);
2008 switch( vinfo
.v_depth
) {
2010 for( count
= 0; count
< 256; count
++) {
2011 vc_revclut8
[count
] = vc_clut
[0x01 * 3];
2012 pdata8
= (vc_clut
[0x01 * 3] * count
+ 0x0ff) >> 8;
2013 for( index
= 0; index
< 256; index
++) {
2014 if( (pdata8
== vc_clut
[index
* 3 + 0]) &&
2015 (pdata8
== vc_clut
[index
* 3 + 1]) &&
2016 (pdata8
== vc_clut
[index
* 3 + 2])) {
2017 vc_revclut8
[count
] = index
;
2022 memset( saveBuf
, 0x01, saveLen
);
2026 buf16
= (unsigned short *) saveBuf
;
2027 pdata16
= ((vc_clut
[0x01 * 3 + 0] & 0xf8) << 7)
2028 | ((vc_clut
[0x01 * 3 + 0] & 0xf8) << 2)
2029 | ((vc_clut
[0x01 * 3 + 0] & 0xf8) >> 3);
2030 for( count
= 0; count
< saveLen
/ 2; count
++)
2031 buf16
[count
] = pdata16
;
2035 buf32
= (unsigned int *) saveBuf
;
2036 pdata32
= ((vc_clut
[0x01 * 3 + 0] & 0xff) << 16)
2037 | ((vc_clut
[0x01 * 3 + 1] & 0xff) << 8)
2038 | ((vc_clut
[0x01 * 3 + 2] & 0xff) << 0);
2039 for( count
= 0; count
< saveLen
/ 4; count
++)
2040 buf32
[count
] = pdata32
;
2046 simple_lock(&vc_progress_lock
);
2048 if( vc_progress_enable
!= enable
) {
2049 vc_progress_enable
= enable
;
2052 vc_saveunder
= saveBuf
;
2053 vc_saveunder_len
= saveLen
;
2057 clock_interval_to_deadline(delay
, 1000 * 1000 * 1000 /*second scale*/, &vc_progress_deadline
);
2058 thread_call_enter_delayed(&vc_progress_call
, vc_progress_deadline
);
2062 saveBuf
= vc_saveunder
;
2063 saveLen
= vc_saveunder_len
;
2065 vc_saveunder_len
= 0;
2068 thread_call_cancel(&vc_progress_call
);
2072 simple_unlock(&vc_progress_lock
);
2076 kfree( saveBuf
, saveLen
);
2079 static void vc_progress_task( void * arg0
, void * arg
)
2082 int count
= (int) arg
;
2083 int x
, y
, width
, height
;
2084 const unsigned char * data
;
2087 simple_lock(&vc_progress_lock
);
2089 if( vc_progress_enable
) {
2092 if( count
>= vc_progress
->count
)
2095 width
= vc_progress
->width
;
2096 height
= vc_progress
->height
;
2097 x
= vc_progress
->dx
;
2098 y
= vc_progress
->dy
;
2099 data
= vc_progress_data
;
2100 data
+= count
* width
* height
;
2101 if( 1 & vc_progress
->flags
) {
2102 x
+= ((vinfo
.v_width
- width
) / 2);
2103 y
+= ((vinfo
.v_height
- height
) / 2);
2105 vc_blit_rect( x
, y
, width
, height
,
2106 NULL
, data
, vc_saveunder
,
2107 vc_needsave
, (0 == (4 & vc_progress
->flags
)) );
2108 vc_needsave
= FALSE
;
2110 clock_deadline_for_periodic_event(vc_progress_interval
, mach_absolute_time(), &vc_progress_deadline
);
2111 thread_call_enter1_delayed(&vc_progress_call
, (void *)count
, vc_progress_deadline
);
2113 simple_unlock(&vc_progress_lock
);
2118 * Generic Console (Front-End): Master Control
2119 * -------------------------------------------
2123 #include <console/i386/text_console.h>
2124 #include <pexpert/i386/boot.h>
2125 #endif /* __i386__ */
2127 static boolean_t gc_acquired
= FALSE
;
2128 static boolean_t gc_graphics_boot
= FALSE
;
2130 static unsigned int lastVideoPhys
= 0;
2131 static unsigned int lastVideoVirt
= 0;
2132 static unsigned int lastVideoSize
= 0;
2133 static boolean_t lastVideoMapped
= FALSE
;
2136 initialize_screen(Boot_Video
* boot_vinfo
, unsigned int op
)
2138 unsigned int fbsize
;
2139 unsigned int newVideoVirt
;
2144 // bcopy((const void *)boot_vinfo, (void *)&boot_video_info, sizeof(boot_video_info));
2147 * First, check if we are changing the size and/or location of the framebuffer
2149 vinfo
.v_name
[0] = 0;
2150 vinfo
.v_width
= boot_vinfo
->v_width
;
2151 vinfo
.v_height
= boot_vinfo
->v_height
;
2152 vinfo
.v_depth
= boot_vinfo
->v_depth
;
2153 vinfo
.v_rowbytes
= boot_vinfo
->v_rowBytes
;
2154 vinfo
.v_physaddr
= boot_vinfo
->v_baseAddr
; /* Get the physical address */
2156 vinfo
.v_type
= boot_vinfo
->v_display
;
2162 kprintf("initialize_screen: b=%08X, w=%08X, h=%08X, r=%08X, d=%08X\n", /* (BRINGUP) */
2163 vinfo
.v_physaddr
, vinfo
.v_width
, vinfo
.v_height
, vinfo
.v_rowbytes
, vinfo
.v_type
); /* (BRINGUP) */
2166 if ( (vinfo
.v_type
== VGA_TEXT_MODE
) )
2168 if (vinfo
.v_physaddr
== 0) {
2169 vinfo
.v_physaddr
= 0xb8000;
2171 vinfo
.v_height
= 25;
2173 vinfo
.v_rowbytes
= 0x8000;
2176 #endif /* __i386__ */
2178 if (!vinfo
.v_physaddr
) /* Check to see if we have a framebuffer */
2180 kprintf("initialize_screen: No video - forcing serial mode\n"); /* (BRINGUP) */
2181 vinfo
.v_depth
= 0; /* vc routines are nop */
2182 (void)switch_to_serial_console(); /* Switch into serial mode */
2183 gc_graphics_boot
= FALSE
; /* Say we are not in graphics mode */
2184 disableConsoleOutput
= FALSE
; /* Allow printfs to happen */
2190 * Note that for the first time only, boot_vinfo->v_baseAddr is physical.
2193 if (kernel_map
!= VM_MAP_NULL
) /* If VM is up, we are given a virtual address */
2195 fbppage
= pmap_find_phys(kernel_pmap
, (addr64_t
)boot_vinfo
->v_baseAddr
); /* Get the physical address of frame buffer */
2196 if(!fbppage
) /* Did we find it? */
2198 panic("initialize_screen: Strange framebuffer - addr = %08X\n", boot_vinfo
->v_baseAddr
);
2200 vinfo
.v_physaddr
= (fbppage
<< 12) | (boot_vinfo
->v_baseAddr
& PAGE_MASK
); /* Get the physical address */
2203 fbsize
= round_page_32(vinfo
.v_height
* vinfo
.v_rowbytes
); /* Remember size */
2205 if ((lastVideoPhys
!= vinfo
.v_physaddr
) || (fbsize
> lastVideoSize
)) /* Did framebuffer change location or get bigger? */
2209 flags
= (vinfo
.v_type
== VGA_TEXT_MODE
) ? VM_WIMG_IO
: VM_WIMG_WCOMB
;
2213 newVideoVirt
= io_map_spec((vm_offset_t
)vinfo
.v_physaddr
, fbsize
, flags
); /* Allocate address space for framebuffer */
2215 if (lastVideoVirt
) /* Was the framebuffer mapped before? */
2218 if(lastVideoMapped
) /* Was this not a special pre-VM mapping? */
2221 pmap_remove(kernel_pmap
, trunc_page_64(lastVideoVirt
),
2222 round_page_64(lastVideoVirt
+ lastVideoSize
)); /* Toss mappings */
2224 if(lastVideoMapped
) /* Was this not a special pre-VM mapping? */
2226 kmem_free(kernel_map
, lastVideoVirt
, lastVideoSize
); /* Toss kernel addresses */
2229 lastVideoPhys
= vinfo
.v_physaddr
; /* Remember the framebuffer address */
2230 lastVideoSize
= fbsize
; /* Remember the size */
2231 lastVideoVirt
= newVideoVirt
; /* Remember the virtual framebuffer address */
2232 lastVideoMapped
= (NULL
!= kernel_map
);
2236 vinfo
.v_baseaddr
= lastVideoVirt
; /* Set the new framebuffer address */
2239 if ( (vinfo
.v_type
== VGA_TEXT_MODE
) )
2241 // Text mode setup by the booter.
2243 gc_ops
.initialize
= tc_initialize
;
2244 gc_ops
.enable
= tc_enable
;
2245 gc_ops
.paint_char
= tc_paint_char
;
2246 gc_ops
.clear_screen
= tc_clear_screen
;
2247 gc_ops
.scroll_down
= tc_scroll_down
;
2248 gc_ops
.scroll_up
= tc_scroll_up
;
2249 gc_ops
.hide_cursor
= tc_hide_cursor
;
2250 gc_ops
.show_cursor
= tc_show_cursor
;
2251 gc_ops
.update_color
= tc_update_color
;
2254 #endif /* __i386__ */
2256 // Graphics mode setup by the booter.
2258 gc_ops
.initialize
= vc_initialize
;
2259 gc_ops
.enable
= vc_enable
;
2260 gc_ops
.paint_char
= vc_paint_char
;
2261 gc_ops
.scroll_down
= vc_scroll_down
;
2262 gc_ops
.scroll_up
= vc_scroll_up
;
2263 gc_ops
.clear_screen
= vc_clear_screen
;
2264 gc_ops
.hide_cursor
= vc_reverse_cursor
;
2265 gc_ops
.show_cursor
= vc_reverse_cursor
;
2266 gc_ops
.update_color
= vc_update_color
;
2269 gc_initialize(&vinfo
);
2271 #ifdef GRATEFULDEBUGGER
2272 GratefulDebInit((bootBumbleC
*)boot_vinfo
); /* Re-initialize GratefulDeb */
2273 #endif /* GRATEFULDEBUGGER */
2278 case kPEGraphicsMode
:
2279 panicDialogDesired
= TRUE
;
2280 gc_graphics_boot
= TRUE
;
2284 panicDialogDesired
= FALSE
;
2285 gc_graphics_boot
= FALSE
;
2288 case kPEAcquireScreen
:
2289 if ( gc_acquired
) break;
2291 vc_progress_set( gc_graphics_boot
, kProgressAcquireDelay
);
2292 gc_enable( !gc_graphics_boot
);
2296 case kPEEnableScreen
:
2301 panicDialogDesired
= FALSE
;
2302 if ( gc_acquired
== FALSE
) break;
2303 if ( gc_graphics_boot
== FALSE
) break;
2305 vc_progress_set( FALSE
, 0 );
2309 case kPEDisableScreen
:
2313 case kPEReleaseScreen
:
2314 gc_acquired
= FALSE
;
2316 vc_progress_set( FALSE
, 0 );
2319 #ifdef GRATEFULDEBUGGER
2320 GratefulDebInit(0); /* Stop grateful debugger */
2321 #endif /* GRATEFULDEBUGGER */
2324 #ifdef GRATEFULDEBUGGER
2325 if ( boot_vinfo
) GratefulDebInit((bootBumbleC
*)boot_vinfo
); /* Re initialize GratefulDeb */
2326 #endif /* GRATEFULDEBUGGER */
2330 refresh_screen(void)
2334 gc_refresh_screen();
2335 gc_show_cursor(gc_x
, gc_y
);
2342 extern struct { long msg_magic
; long msg_bufx
; long msg_bufr
; char msg_bufc
[]; } * msgbufp
;
2344 vm_initialized
= TRUE
;
2346 if ( gc_graphics_boot
== FALSE
)
2352 initialize_screen( 0, kPEReleaseScreen
);
2355 initialize_screen( 0, kPEAcquireScreen
);
2357 for ( index
= 0 ; index
< msgbufp
->msg_bufx
; index
++ )
2359 vcputc( 0, 0, msgbufp
->msg_bufc
[index
] );
2361 if ( msgbufp
->msg_bufc
[index
] == '\n' )
2363 vcputc( 0, 0,'\r' );