Deleted Added
full compact
syscons.c (39287) syscons.c (39591)
1/*-
2 * Copyright (c) 1992-1998 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
1/*-
2 * Copyright (c) 1992-1998 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $Id$
28 * $Id: syscons.c,v 1.278 1998/09/15 18:16:37 sos Exp $
29 */
30
31#include "sc.h"
32#include "apm.h"
33#include "opt_ddb.h"
34#include "opt_devfs.h"
35#include "opt_vesa.h"
36#include "opt_vm86.h"

--- 79 unchanged lines hidden (view full) ---

116 union {
117 struct old_mouse_data data;
118 struct mouse_mode mode;
119 } u;
120} old_mouse_info_t;
121
122/* XXX use sc_bcopy where video memory is concerned */
123extern void generic_bcopy(const void *, void *, size_t);
29 */
30
31#include "sc.h"
32#include "apm.h"
33#include "opt_ddb.h"
34#include "opt_devfs.h"
35#include "opt_vesa.h"
36#include "opt_vm86.h"

--- 79 unchanged lines hidden (view full) ---

116 union {
117 struct old_mouse_data data;
118 struct mouse_mode mode;
119 } u;
120} old_mouse_info_t;
121
122/* XXX use sc_bcopy where video memory is concerned */
123extern void generic_bcopy(const void *, void *, size_t);
124extern void generic_bzero(void *, size_t);
124
125static default_attr user_default = {
126 (FG_LIGHTGREY | BG_BLACK) << 8,
127 (FG_BLACK | BG_LIGHTGREY) << 8
128};
129
130static default_attr kernel_default = {
131 (FG_WHITE | BG_BLACK) << 8,

--- 156 unchanged lines hidden (view full) ---

288static void draw_mouse_image(scr_stat *scp);
289static void remove_mouse_image(scr_stat *scp);
290static void draw_cutmarking(scr_stat *scp);
291static void remove_cutmarking(scr_stat *scp);
292static void do_bell(scr_stat *scp, int pitch, int duration);
293static timeout_t blink_screen;
294#ifdef SC_SPLASH_SCREEN
295static void scsplash_init(scr_stat *scp);
125
126static default_attr user_default = {
127 (FG_LIGHTGREY | BG_BLACK) << 8,
128 (FG_BLACK | BG_LIGHTGREY) << 8
129};
130
131static default_attr kernel_default = {
132 (FG_WHITE | BG_BLACK) << 8,

--- 156 unchanged lines hidden (view full) ---

289static void draw_mouse_image(scr_stat *scp);
290static void remove_mouse_image(scr_stat *scp);
291static void draw_cutmarking(scr_stat *scp);
292static void remove_cutmarking(scr_stat *scp);
293static void do_bell(scr_stat *scp, int pitch, int duration);
294static timeout_t blink_screen;
295#ifdef SC_SPLASH_SCREEN
296static void scsplash_init(scr_stat *scp);
297static void scsplash_term(scr_stat *scp);
296static void scsplash_saver(int show);
297#define scsplash_stick(stick) (sticky_splash = (stick))
298#else
299#define scsplash_stick(stick)
300#endif
301
302struct isa_driver scdriver = {
303 scprobe, scattach, "sc", 1

--- 17 unchanged lines hidden (view full) ---

321};
322
323/*
324 * These functions need to be before calls to them so they can be inlined.
325 */
326static void
327draw_cursor_image(scr_stat *scp)
328{
298static void scsplash_saver(int show);
299#define scsplash_stick(stick) (sticky_splash = (stick))
300#else
301#define scsplash_stick(stick)
302#endif
303
304struct isa_driver scdriver = {
305 scprobe, scattach, "sc", 1

--- 17 unchanged lines hidden (view full) ---

323};
324
325/*
326 * These functions need to be before calls to them so they can be inlined.
327 */
328static void
329draw_cursor_image(scr_stat *scp)
330{
329 u_short cursor_image, *ptr = Crtat + (scp->cursor_pos - scp->scr_buf);
331 u_short cursor_image;
332 u_short *ptr;
330 u_short prev_image;
331
332 if (ISPIXELSC(scp)) {
333 sc_bcopy(scp, scp->scr_buf, scp->cursor_pos - scp->scr_buf,
334 scp->cursor_pos - scp->scr_buf, 1);
335 return;
336 }
337
333 u_short prev_image;
334
335 if (ISPIXELSC(scp)) {
336 sc_bcopy(scp, scp->scr_buf, scp->cursor_pos - scp->scr_buf,
337 scp->cursor_pos - scp->scr_buf, 1);
338 return;
339 }
340
341 ptr = (u_short *)(get_adapter(scp)->va_window)
342 + (scp->cursor_pos - scp->scr_buf);
343
338 /* do we have a destructive cursor ? */
339 if (flags & CHAR_CURSOR) {
340 prev_image = scp->cursor_saveunder;
341 cursor_image = *ptr & 0x00ff;
342 if (cursor_image == DEAD_CHAR)
343 cursor_image = prev_image & 0x00ff;
344 cursor_image |= *(scp->cursor_pos) & 0xff00;
345 scp->cursor_saveunder = cursor_image;

--- 32 unchanged lines hidden (view full) ---

378 *ptr = cursor_image;
379}
380
381static void
382remove_cursor_image(scr_stat *scp)
383{
384 if (ISPIXELSC(scp))
385 sc_bcopy(scp, scp->scr_buf, scp->cursor_oldpos - scp->scr_buf,
344 /* do we have a destructive cursor ? */
345 if (flags & CHAR_CURSOR) {
346 prev_image = scp->cursor_saveunder;
347 cursor_image = *ptr & 0x00ff;
348 if (cursor_image == DEAD_CHAR)
349 cursor_image = prev_image & 0x00ff;
350 cursor_image |= *(scp->cursor_pos) & 0xff00;
351 scp->cursor_saveunder = cursor_image;

--- 32 unchanged lines hidden (view full) ---

384 *ptr = cursor_image;
385}
386
387static void
388remove_cursor_image(scr_stat *scp)
389{
390 if (ISPIXELSC(scp))
391 sc_bcopy(scp, scp->scr_buf, scp->cursor_oldpos - scp->scr_buf,
386 scp->cursor_oldpos - scp->scr_buf, 0);
392 scp->cursor_oldpos - scp->scr_buf, 0);
387 else
393 else
388 *(Crtat + (scp->cursor_oldpos - scp->scr_buf)) = scp->cursor_saveunder;
394 *((u_short *)(get_adapter(scp)->va_window)
395 + (scp->cursor_oldpos - scp->scr_buf))
396 = scp->cursor_saveunder;
389}
390
391static void
392move_crsr(scr_stat *scp, int x, int y)
393{
394 if (x < 0)
395 x = 0;
396 if (y < 0)

--- 10 unchanged lines hidden (view full) ---

407static int
408scprobe(struct isa_device *dev)
409{
410 if (!scvidprobe(dev->id_unit, dev->id_flags)) {
411 if (bootverbose)
412 printf("sc%d: no video adapter is found.\n", dev->id_unit);
413 return (0);
414 }
397}
398
399static void
400move_crsr(scr_stat *scp, int x, int y)
401{
402 if (x < 0)
403 x = 0;
404 if (y < 0)

--- 10 unchanged lines hidden (view full) ---

415static int
416scprobe(struct isa_device *dev)
417{
418 if (!scvidprobe(dev->id_unit, dev->id_flags)) {
419 if (bootverbose)
420 printf("sc%d: no video adapter is found.\n", dev->id_unit);
421 return (0);
422 }
415 (*biosvidsw.diag)(bootverbose);
423
416#if defined(VESA) && defined(VM86)
417 if (vesa_load())
418 return FALSE;
424#if defined(VESA) && defined(VM86)
425 if (vesa_load())
426 return FALSE;
419 (*biosvidsw.diag)(bootverbose);
420#endif
421
427#endif
428
429 (*biosvidsw.diag)(bootverbose);
430
422 sc_port = dev->id_iobase;
423 if (sckbdprobe(dev->id_unit, dev->id_flags))
424 return (IO_KBDSIZE);
425 else
426 return ((dev->id_flags & DETECT_KBD) ? 0 : IO_KBDSIZE);
427}
428
429/* probe video adapters, return TRUE if found */

--- 228 unchanged lines hidden (view full) ---

658 sc_alloc_cut_buffer(scp, FALSE);
659
660 /* initialize history buffer & pointers */
661 sc_alloc_history_buffer(scp, sc_history_size, 0, FALSE);
662
663#if defined(VESA) && defined(VM86)
664 if ((flags & VESA800X600)
665 && ((*biosvidsw.get_info)(scp->adp, M_VESA_800x600, &info) == 0)) {
431 sc_port = dev->id_iobase;
432 if (sckbdprobe(dev->id_unit, dev->id_flags))
433 return (IO_KBDSIZE);
434 else
435 return ((dev->id_flags & DETECT_KBD) ? 0 : IO_KBDSIZE);
436}
437
438/* probe video adapters, return TRUE if found */

--- 228 unchanged lines hidden (view full) ---

667 sc_alloc_cut_buffer(scp, FALSE);
668
669 /* initialize history buffer & pointers */
670 sc_alloc_history_buffer(scp, sc_history_size, 0, FALSE);
671
672#if defined(VESA) && defined(VM86)
673 if ((flags & VESA800X600)
674 && ((*biosvidsw.get_info)(scp->adp, M_VESA_800x600, &info) == 0)) {
675#ifdef SC_SPLASH_SCREEN
676 scsplash_term(scp);
677#endif
666 sc_set_graphics_mode(scp, NULL, M_VESA_800x600);
667 sc_set_pixel_mode(scp, NULL, COL, ROW, 16);
668 initial_video_mode = M_VESA_800x600;
678 sc_set_graphics_mode(scp, NULL, M_VESA_800x600);
679 sc_set_pixel_mode(scp, NULL, COL, ROW, 16);
680 initial_video_mode = M_VESA_800x600;
681#ifdef SC_SPLASH_SCREEN
682 scsplash_init(scp);
683#endif
669 }
670#endif /* VESA && VM86 */
671
672 /* initialize cursor stuff */
673 if (!ISGRAPHSC(scp))
674 draw_cursor_image(scp);
675
676 /* get screen update going */

--- 1628 unchanged lines hidden (view full) ---

2305 return 0;
2306}
2307
2308static void
2309exchange_scr(void)
2310{
2311 move_crsr(old_scp, old_scp->xpos, old_scp->ypos);
2312 cur_console = new_scp;
684 }
685#endif /* VESA && VM86 */
686
687 /* initialize cursor stuff */
688 if (!ISGRAPHSC(scp))
689 draw_cursor_image(scp);
690
691 /* get screen update going */

--- 1628 unchanged lines hidden (view full) ---

2320 return 0;
2321}
2322
2323static void
2324exchange_scr(void)
2325{
2326 move_crsr(old_scp, old_scp->xpos, old_scp->ypos);
2327 cur_console = new_scp;
2313 if (old_scp->mode != new_scp->mode || ISUNKNOWNSC(old_scp)) {
2314 if (adp_flags & V_ADP_MODECHANGE)
2315 set_mode(new_scp);
2316 }
2328 if (old_scp->mode != new_scp->mode || ISUNKNOWNSC(old_scp))
2329 set_mode(new_scp);
2317 move_crsr(new_scp, new_scp->xpos, new_scp->ypos);
2318 if (ISTEXTSC(new_scp) && (flags & CHAR_CURSOR))
2319 set_destructive_cursor(new_scp);
2320 if (ISGRAPHSC(old_scp))
2321 load_palette(new_scp, palette);
2322 if (old_scp->status & KBD_RAW_MODE || new_scp->status & KBD_RAW_MODE ||
2323 old_scp->status & KBD_CODE_MODE || new_scp->status & KBD_CODE_MODE)
2324 shfts = ctls = alts = agrs = metas = accents = 0;
2325 set_border(new_scp, new_scp->border);
2326 update_leds(new_scp->status);
2327 delayed_next_scr = FALSE;
2328 mark_all(new_scp);
2330 move_crsr(new_scp, new_scp->xpos, new_scp->ypos);
2331 if (ISTEXTSC(new_scp) && (flags & CHAR_CURSOR))
2332 set_destructive_cursor(new_scp);
2333 if (ISGRAPHSC(old_scp))
2334 load_palette(new_scp, palette);
2335 if (old_scp->status & KBD_RAW_MODE || new_scp->status & KBD_RAW_MODE ||
2336 old_scp->status & KBD_CODE_MODE || new_scp->status & KBD_CODE_MODE)
2337 shfts = ctls = alts = agrs = metas = accents = 0;
2338 set_border(new_scp, new_scp->border);
2339 update_leds(new_scp->status);
2340 delayed_next_scr = FALSE;
2341 mark_all(new_scp);
2329
2330 /* FIXME: the screen size may be larger than a 64K segment. */
2331 if (ISPIXELSC(new_scp))
2332 bzero(Crtat, new_scp->xpixel*new_scp->ypixel/8);
2333}
2334
2335static void
2336scan_esc(scr_stat *scp, u_char c)
2337{
2338 static u_char ansi_col[16] =
2339 {0, 4, 2, 6, 1, 5, 3, 7, 8, 12, 10, 14, 9, 13, 11, 15};
2340 int i, n;

--- 150 unchanged lines hidden (view full) ---

2491 n = scp->term.param[0];
2492 switch (n) {
2493 case 0: /* clear form cursor to end of line */
2494 fillw(scp->term.cur_color | scr_map[0x20],
2495 scp->cursor_pos,
2496 scp->xsize - scp->xpos);
2497 mark_for_update(scp, scp->cursor_pos - scp->scr_buf);
2498 mark_for_update(scp, scp->cursor_pos - scp->scr_buf +
2342}
2343
2344static void
2345scan_esc(scr_stat *scp, u_char c)
2346{
2347 static u_char ansi_col[16] =
2348 {0, 4, 2, 6, 1, 5, 3, 7, 8, 12, 10, 14, 9, 13, 11, 15};
2349 int i, n;

--- 150 unchanged lines hidden (view full) ---

2500 n = scp->term.param[0];
2501 switch (n) {
2502 case 0: /* clear form cursor to end of line */
2503 fillw(scp->term.cur_color | scr_map[0x20],
2504 scp->cursor_pos,
2505 scp->xsize - scp->xpos);
2506 mark_for_update(scp, scp->cursor_pos - scp->scr_buf);
2507 mark_for_update(scp, scp->cursor_pos - scp->scr_buf +
2499 scp->xsize - scp->xpos);
2508 scp->xsize - 1 - scp->xpos);
2500 break;
2501 case 1: /* clear from beginning of line to cursor */
2502 fillw(scp->term.cur_color | scr_map[0x20],
2503 scp->cursor_pos - scp->xpos,
2504 scp->xpos + 1);
2505 mark_for_update(scp, scp->ypos * scp->xsize);
2506 mark_for_update(scp, scp->cursor_pos - scp->scr_buf);
2507 break;
2508 case 2: /* clear entire line */
2509 fillw(scp->term.cur_color | scr_map[0x20],
2510 scp->cursor_pos - scp->xpos,
2511 scp->xsize);
2512 mark_for_update(scp, scp->ypos * scp->xsize);
2509 break;
2510 case 1: /* clear from beginning of line to cursor */
2511 fillw(scp->term.cur_color | scr_map[0x20],
2512 scp->cursor_pos - scp->xpos,
2513 scp->xpos + 1);
2514 mark_for_update(scp, scp->ypos * scp->xsize);
2515 mark_for_update(scp, scp->cursor_pos - scp->scr_buf);
2516 break;
2517 case 2: /* clear entire line */
2518 fillw(scp->term.cur_color | scr_map[0x20],
2519 scp->cursor_pos - scp->xpos,
2520 scp->xsize);
2521 mark_for_update(scp, scp->ypos * scp->xsize);
2513 mark_for_update(scp, (scp->ypos + 1) * scp->xsize);
2522 mark_for_update(scp, (scp->ypos + 1) * scp->xsize - 1);
2514 break;
2515 }
2516 break;
2517
2518 case 'L': /* Insert n lines */
2519 n = scp->term.param[0]; if (n < 1) n = 1;
2520 if (n > scp->ysize - scp->ypos)
2521 n = scp->ysize - scp->ypos;

--- 28 unchanged lines hidden (view full) ---

2550 n = scp->xsize - scp->xpos;
2551 dst = scp->cursor_pos;
2552 src = dst + n;
2553 count = scp->xsize - (scp->xpos + n);
2554 bcopy(src, dst, count * sizeof(u_short));
2555 src = dst + count;
2556 fillw(scp->term.cur_color | scr_map[0x20], src, n);
2557 mark_for_update(scp, scp->cursor_pos - scp->scr_buf);
2523 break;
2524 }
2525 break;
2526
2527 case 'L': /* Insert n lines */
2528 n = scp->term.param[0]; if (n < 1) n = 1;
2529 if (n > scp->ysize - scp->ypos)
2530 n = scp->ysize - scp->ypos;

--- 28 unchanged lines hidden (view full) ---

2559 n = scp->xsize - scp->xpos;
2560 dst = scp->cursor_pos;
2561 src = dst + n;
2562 count = scp->xsize - (scp->xpos + n);
2563 bcopy(src, dst, count * sizeof(u_short));
2564 src = dst + count;
2565 fillw(scp->term.cur_color | scr_map[0x20], src, n);
2566 mark_for_update(scp, scp->cursor_pos - scp->scr_buf);
2558 mark_for_update(scp, scp->cursor_pos - scp->scr_buf + n + count);
2567 mark_for_update(scp, scp->cursor_pos - scp->scr_buf + n + count - 1);
2559 break;
2560
2561 case '@': /* Insert n chars */
2562 n = scp->term.param[0]; if (n < 1) n = 1;
2563 if (n > scp->xsize - scp->xpos)
2564 n = scp->xsize - scp->xpos;
2565 src = scp->cursor_pos;
2566 dst = src + n;
2567 count = scp->xsize - (scp->xpos + n);
2568 bcopy(src, dst, count * sizeof(u_short));
2569 fillw(scp->term.cur_color | scr_map[0x20], src, n);
2570 mark_for_update(scp, scp->cursor_pos - scp->scr_buf);
2568 break;
2569
2570 case '@': /* Insert n chars */
2571 n = scp->term.param[0]; if (n < 1) n = 1;
2572 if (n > scp->xsize - scp->xpos)
2573 n = scp->xsize - scp->xpos;
2574 src = scp->cursor_pos;
2575 dst = src + n;
2576 count = scp->xsize - (scp->xpos + n);
2577 bcopy(src, dst, count * sizeof(u_short));
2578 fillw(scp->term.cur_color | scr_map[0x20], src, n);
2579 mark_for_update(scp, scp->cursor_pos - scp->scr_buf);
2571 mark_for_update(scp, scp->cursor_pos - scp->scr_buf + n + count);
2580 mark_for_update(scp, scp->cursor_pos - scp->scr_buf + n + count - 1);
2572 break;
2573
2574 case 'S': /* scroll up n lines */
2575 n = scp->term.param[0]; if (n < 1) n = 1;
2576 if (n > scp->ysize)
2577 n = scp->ysize;
2578 bcopy(scp->scr_buf + (scp->xsize * n),
2579 scp->scr_buf,

--- 19 unchanged lines hidden (view full) ---

2599
2600 case 'X': /* erase n characters in line */
2601 n = scp->term.param[0]; if (n < 1) n = 1;
2602 if (n > scp->xsize - scp->xpos)
2603 n = scp->xsize - scp->xpos;
2604 fillw(scp->term.cur_color | scr_map[0x20],
2605 scp->cursor_pos, n);
2606 mark_for_update(scp, scp->cursor_pos - scp->scr_buf);
2581 break;
2582
2583 case 'S': /* scroll up n lines */
2584 n = scp->term.param[0]; if (n < 1) n = 1;
2585 if (n > scp->ysize)
2586 n = scp->ysize;
2587 bcopy(scp->scr_buf + (scp->xsize * n),
2588 scp->scr_buf,

--- 19 unchanged lines hidden (view full) ---

2608
2609 case 'X': /* erase n characters in line */
2610 n = scp->term.param[0]; if (n < 1) n = 1;
2611 if (n > scp->xsize - scp->xpos)
2612 n = scp->xsize - scp->xpos;
2613 fillw(scp->term.cur_color | scr_map[0x20],
2614 scp->cursor_pos, n);
2615 mark_for_update(scp, scp->cursor_pos - scp->scr_buf);
2607 mark_for_update(scp, scp->cursor_pos - scp->scr_buf + n);
2616 mark_for_update(scp, scp->cursor_pos - scp->scr_buf + n - 1);
2608 break;
2609
2610 case 'Z': /* move n tabs backwards */
2611 n = scp->term.param[0]; if (n < 1) n = 1;
2612 if ((i = scp->xpos & 0xf8) == scp->xpos)
2613 i -= 8*n;
2614 else
2615 i -= 8*(n-1);

--- 402 unchanged lines hidden (view full) ---

3018 /* set up the first console */
3019 current_default = &user_default;
3020 console[0] = &main_console;
3021 init_scp(console[0]);
3022 cur_console = console[0];
3023
3024 /* copy screen to temporary buffer */
3025 if (ISTEXTSC(console[0]))
2617 break;
2618
2619 case 'Z': /* move n tabs backwards */
2620 n = scp->term.param[0]; if (n < 1) n = 1;
2621 if ((i = scp->xpos & 0xf8) == scp->xpos)
2622 i -= 8*n;
2623 else
2624 i -= 8*(n-1);

--- 402 unchanged lines hidden (view full) ---

3027 /* set up the first console */
3028 current_default = &user_default;
3029 console[0] = &main_console;
3030 init_scp(console[0]);
3031 cur_console = console[0];
3032
3033 /* copy screen to temporary buffer */
3034 if (ISTEXTSC(console[0]))
3026 generic_bcopy(Crtat, sc_buffer,
3027 console[0]->xsize * console[0]->ysize * sizeof(u_short));
3035 generic_bcopy((ushort *)(get_adapter(console[0])->va_window), sc_buffer,
3036 console[0]->xsize * console[0]->ysize * sizeof(u_short));
3028
3029 console[0]->scr_buf = console[0]->mouse_pos = console[0]->mouse_oldpos
3030 = sc_buffer;
3031 if (col >= console[0]->xsize)
3032 col = 0;
3033 if (row >= console[0]->ysize)
3034 row = console[0]->ysize - 1;
3035 console[0]->xpos = col;

--- 952 unchanged lines hidden (view full) ---

3988 * Always use the font page #0 on the video plane 2.
3989 * Somehow we cannot show the font in other font pages on
3990 * some video cards... XXX
3991 */
3992 (*biosvidsw.show_font)(scp->adp, 0);
3993 }
3994 mark_all(scp);
3995 }
3037
3038 console[0]->scr_buf = console[0]->mouse_pos = console[0]->mouse_oldpos
3039 = sc_buffer;
3040 if (col >= console[0]->xsize)
3041 col = 0;
3042 if (row >= console[0]->ysize)
3043 row = console[0]->ysize - 1;
3044 console[0]->xpos = col;

--- 952 unchanged lines hidden (view full) ---

3997 * Always use the font page #0 on the video plane 2.
3998 * Somehow we cannot show the font in other font pages on
3999 * some video cards... XXX
4000 */
4001 (*biosvidsw.show_font)(scp->adp, 0);
4002 }
4003 mark_all(scp);
4004 }
4005
4006 if (scp->status & PIXEL_MODE)
4007 generic_bzero((u_char *)(adp->va_window), scp->xpixel*scp->ypixel/8);
3996 set_border(scp, scp->border);
3997
3998 /* move hardware cursor out of the way */
3999 (*biosvidsw.set_hw_cursor)(scp->adp, -1, -1);
4000
4001 return 0;
4002}
4003
4004void
4008 set_border(scp, scp->border);
4009
4010 /* move hardware cursor out of the way */
4011 (*biosvidsw.set_hw_cursor)(scp->adp, -1, -1);
4012
4013 return 0;
4014}
4015
4016void
4017set_border(scr_stat *scp, int color)
4018{
4019 u_char *p;
4020 int xoff;
4021 int yoff;
4022 int xlen;
4023 int ylen;
4024 int i;
4025
4026 (*biosvidsw.set_border)(scp->adp, color);
4027
4028 if (scp->status & PIXEL_MODE) {
4029 outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */
4030 outw(GDCIDX, 0x0003); /* data rotate/function select */
4031 outw(GDCIDX, 0x0f01); /* set/reset enable */
4032 outw(GDCIDX, 0xff08); /* bit mask */
4033 outw(GDCIDX, (color << 8) | 0x00); /* set/reset */
4034 p = (u_char *)(get_adapter(scp)->va_window);
4035 xoff = scp->xoff;
4036 yoff = scp->yoff*scp->font_size;
4037 xlen = scp->xpixel/8;
4038 ylen = scp->ysize*scp->font_size;
4039 if (yoff > 0) {
4040 generic_bzero(p, xlen*yoff);
4041 generic_bzero(p + xlen*(yoff + ylen),
4042 xlen*scp->ypixel - xlen*(yoff + ylen));
4043 }
4044 if (xoff > 0) {
4045 for (i = 0; i < ylen; ++i) {
4046 generic_bzero(p + xlen*(yoff + i), xoff);
4047 generic_bzero(p + xlen*(yoff + i) + xoff + scp->xsize,
4048 xlen - xoff - scp->xsize);
4049 }
4050 }
4051 outw(GDCIDX, 0x0000); /* set/reset */
4052 outw(GDCIDX, 0x0001); /* set/reset enable */
4053 }
4054}
4055
4056void
4005copy_font(scr_stat *scp, int operation, int font_size, u_char *buf)
4006{
4007 /*
4008 * FONT KLUDGE:
4009 * This is an interim kludge to display correct font.
4010 * Always use the font page #0 on the video plane 2.
4011 * Somehow we cannot show the font in other font pages on
4012 * some video cards... XXX

--- 304 unchanged lines hidden (view full) ---

4317 }
4318}
4319
4320static void
4321draw_mouse_image(scr_stat *scp)
4322{
4323 u_short buffer[32];
4324 u_short xoffset, yoffset;
4057copy_font(scr_stat *scp, int operation, int font_size, u_char *buf)
4058{
4059 /*
4060 * FONT KLUDGE:
4061 * This is an interim kludge to display correct font.
4062 * Always use the font page #0 on the video plane 2.
4063 * Somehow we cannot show the font in other font pages on
4064 * some video cards... XXX

--- 304 unchanged lines hidden (view full) ---

4369 }
4370}
4371
4372static void
4373draw_mouse_image(scr_stat *scp)
4374{
4375 u_short buffer[32];
4376 u_short xoffset, yoffset;
4325 u_short *crt_pos = Crtat + (scp->mouse_pos - scp->scr_buf);
4377 u_short *crt_pos = (u_short *)(get_adapter(scp)->va_window)
4378 + (scp->mouse_pos - scp->scr_buf);
4326 u_char *font_buffer;
4327 int font_size;
4328 int i;
4329
4330 if (scp->font_size < 14) {
4331 font_buffer = font_8;
4332 font_size = 8;
4333 } else if (scp->font_size >= 16) {

--- 55 unchanged lines hidden (view full) ---

4389 }
4390 mark_for_update(scp, scp->mouse_pos - scp->scr_buf);
4391 mark_for_update(scp, scp->mouse_pos + scp->xsize + 1 - scp->scr_buf);
4392}
4393
4394static void
4395remove_mouse_image(scr_stat *scp)
4396{
4379 u_char *font_buffer;
4380 int font_size;
4381 int i;
4382
4383 if (scp->font_size < 14) {
4384 font_buffer = font_8;
4385 font_size = 8;
4386 } else if (scp->font_size >= 16) {

--- 55 unchanged lines hidden (view full) ---

4442 }
4443 mark_for_update(scp, scp->mouse_pos - scp->scr_buf);
4444 mark_for_update(scp, scp->mouse_pos + scp->xsize + 1 - scp->scr_buf);
4445}
4446
4447static void
4448remove_mouse_image(scr_stat *scp)
4449{
4397 u_short *crt_pos = Crtat + (scp->mouse_oldpos - scp->scr_buf);
4450 u_short *crt_pos;
4398
4399 if (!ISTEXTSC(scp))
4400 return;
4451
4452 if (!ISTEXTSC(scp))
4453 return;
4454
4455 crt_pos = (u_short *)(get_adapter(scp)->va_window)
4456 + (scp->mouse_oldpos - scp->scr_buf);
4401 *(crt_pos) = *(scp->mouse_oldpos);
4402 *(crt_pos+1) = *(scp->mouse_oldpos+1);
4403 *(crt_pos+scp->xsize) = *(scp->mouse_oldpos+scp->xsize);
4404 *(crt_pos+scp->xsize+1) = *(scp->mouse_oldpos+scp->xsize+1);
4405 mark_for_update(scp, scp->mouse_oldpos - scp->scr_buf);
4406 mark_for_update(scp, scp->mouse_oldpos + scp->xsize + 1 - scp->scr_buf);
4407}
4408
4409static void
4410draw_cutmarking(scr_stat *scp)
4411{
4457 *(crt_pos) = *(scp->mouse_oldpos);
4458 *(crt_pos+1) = *(scp->mouse_oldpos+1);
4459 *(crt_pos+scp->xsize) = *(scp->mouse_oldpos+scp->xsize);
4460 *(crt_pos+scp->xsize+1) = *(scp->mouse_oldpos+scp->xsize+1);
4461 mark_for_update(scp, scp->mouse_oldpos - scp->scr_buf);
4462 mark_for_update(scp, scp->mouse_oldpos + scp->xsize + 1 - scp->scr_buf);
4463}
4464
4465static void
4466draw_cutmarking(scr_stat *scp)
4467{
4468 u_short *crt_pos;
4412 u_short *ptr;
4413 u_short och, nch;
4414
4469 u_short *ptr;
4470 u_short och, nch;
4471
4472 crt_pos = (u_short *)(get_adapter(scp)->va_window);
4415 for (ptr=scp->scr_buf; ptr<=(scp->scr_buf+(scp->xsize*scp->ysize)); ptr++) {
4473 for (ptr=scp->scr_buf; ptr<=(scp->scr_buf+(scp->xsize*scp->ysize)); ptr++) {
4416 nch = och = *(Crtat + (ptr - scp->scr_buf));
4474 nch = och = *(crt_pos + (ptr - scp->scr_buf));
4417 /* are we outside the selected area ? */
4418 if ( ptr < (scp->mouse_cut_start > scp->mouse_cut_end ?
4419 scp->mouse_cut_end : scp->mouse_cut_start) ||
4420 ptr >= (scp->mouse_cut_start > scp->mouse_cut_end ?
4421 scp->mouse_cut_start : scp->mouse_cut_end)) {
4422 if (ptr != scp->cursor_pos)
4423 nch = (och & 0xff) | (*ptr & 0xff00);
4424 }

--- 5 unchanged lines hidden (view full) ---

4430 if (flags & CHAR_CURSOR)
4431 nch = (och & 0x88ff)|(*ptr & 0x7000)>>4|(*ptr & 0x0700)<<4;
4432 else
4433 if (!(flags & BLINK_CURSOR))
4434 nch = (och & 0xff) | (*ptr & 0xff00);
4435 }
4436 }
4437 if (nch != och)
4475 /* are we outside the selected area ? */
4476 if ( ptr < (scp->mouse_cut_start > scp->mouse_cut_end ?
4477 scp->mouse_cut_end : scp->mouse_cut_start) ||
4478 ptr >= (scp->mouse_cut_start > scp->mouse_cut_end ?
4479 scp->mouse_cut_start : scp->mouse_cut_end)) {
4480 if (ptr != scp->cursor_pos)
4481 nch = (och & 0xff) | (*ptr & 0xff00);
4482 }

--- 5 unchanged lines hidden (view full) ---

4488 if (flags & CHAR_CURSOR)
4489 nch = (och & 0x88ff)|(*ptr & 0x7000)>>4|(*ptr & 0x0700)<<4;
4490 else
4491 if (!(flags & BLINK_CURSOR))
4492 nch = (och & 0xff) | (*ptr & 0xff00);
4493 }
4494 }
4495 if (nch != och)
4438 *(Crtat + (ptr - scp->scr_buf)) = nch;
4496 *(crt_pos + (ptr - scp->scr_buf)) = nch;
4439 }
4440}
4441
4442static void
4443remove_cutmarking(scr_stat *scp)
4444{
4445 scp->mouse_cut_start = scp->mouse_cut_end = NULL;
4446 scp->status &= ~MOUSE_CUTTING;

--- 32 unchanged lines hidden (view full) ---

4479 blink_in_progress = FALSE;
4480 mark_all(scp);
4481 if (delayed_next_scr)
4482 switch_scr(scp, delayed_next_scr - 1);
4483 }
4484 else {
4485 if (blink_in_progress & 1)
4486 fillw(kernel_default.std_color | scr_map[0x20],
4497 }
4498}
4499
4500static void
4501remove_cutmarking(scr_stat *scp)
4502{
4503 scp->mouse_cut_start = scp->mouse_cut_end = NULL;
4504 scp->status &= ~MOUSE_CUTTING;

--- 32 unchanged lines hidden (view full) ---

4537 blink_in_progress = FALSE;
4538 mark_all(scp);
4539 if (delayed_next_scr)
4540 switch_scr(scp, delayed_next_scr - 1);
4541 }
4542 else {
4543 if (blink_in_progress & 1)
4544 fillw(kernel_default.std_color | scr_map[0x20],
4487 Crtat, scp->xsize * scp->ysize);
4545 (u_short *)(get_adapter(scp)->va_window),
4546 scp->xsize * scp->ysize);
4488 else
4489 fillw(kernel_default.rev_color | scr_map[0x20],
4547 else
4548 fillw(kernel_default.rev_color | scr_map[0x20],
4490 Crtat, scp->xsize * scp->ysize);
4549 (u_short *)(get_adapter(scp)->va_window),
4550 scp->xsize * scp->ysize);
4491 blink_in_progress--;
4492 timeout(blink_screen, scp, hz / 10);
4493 }
4494}
4495
4496void
4497sc_bcopy(scr_stat *scp, u_short *p, int from, int to, int mark)
4498{
4499 u_char *font;
4551 blink_in_progress--;
4552 timeout(blink_screen, scp, hz / 10);
4553 }
4554}
4555
4556void
4557sc_bcopy(scr_stat *scp, u_short *p, int from, int to, int mark)
4558{
4559 u_char *font;
4500 u_char *d, *e;
4560 u_char volatile *d;
4561 u_char *e;
4501 u_char *f;
4502 int font_size;
4503 int line_length;
4504 int xsize;
4562 u_char *f;
4563 int font_size;
4564 int line_length;
4565 int xsize;
4566 u_short bg;
4505 int i, j;
4567 int i, j;
4568 u_char c;
4506
4507 if (ISTEXTSC(scp)) {
4569
4570 if (ISTEXTSC(scp)) {
4508 generic_bcopy(p+from, Crtat+from, (to-from+1)*sizeof (u_short));
4571 generic_bcopy(p + from, (u_short *)(get_adapter(scp)->va_window) + from,
4572 (to - from + 1)*sizeof(u_short));
4509 } else /* if ISPIXELSC(scp) */ {
4510 if (mark)
4511 mark = 255;
4512 font_size = scp->font_size;
4513 if (font_size < 14)
4514 font = font_8;
4515 else if (font_size >= 16)
4516 font = font_16;
4517 else
4518 font = font_14;
4519 line_length = scp->xpixel/8;
4520 xsize = scp->xsize;
4573 } else /* if ISPIXELSC(scp) */ {
4574 if (mark)
4575 mark = 255;
4576 font_size = scp->font_size;
4577 if (font_size < 14)
4578 font = font_8;
4579 else if (font_size >= 16)
4580 font = font_16;
4581 else
4582 font = font_14;
4583 line_length = scp->xpixel/8;
4584 xsize = scp->xsize;
4521 d = (u_char *)Crtat
4585 d = (u_char *)(get_adapter(scp)->va_window)
4522 + scp->xoff + scp->yoff*font_size*line_length
4523 + (from%xsize) + font_size*line_length*(from/xsize);
4586 + scp->xoff + scp->yoff*font_size*line_length
4587 + (from%xsize) + font_size*line_length*(from/xsize);
4588
4589 outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */
4590 outw(GDCIDX, 0x0003); /* data rotate/function select */
4591 outw(GDCIDX, 0x0f01); /* set/reset enable */
4592 bg = -1;
4524 for (i = from ; i <= to ; i++) {
4593 for (i = from ; i <= to ; i++) {
4525 e = d;
4594 /* set background color in EGA/VGA latch */
4595 if (bg != (p[i] & 0xf000)) {
4596 bg = (p[i] & 0xf000);
4597 outw(GDCIDX, (bg >> 4) | 0x00); /* set/reset */
4598 outw(GDCIDX, 0xff08); /* bit mask */
4599 *d = 0;
4600 c = *d; /* set the background color in the latch */
4601 }
4602 /* foreground color */
4603 outw(GDCIDX, (p[i] & 0x0f00) | 0x00); /* set/reset */
4604 e = (u_char *)d;
4526 f = &font[(p[i] & 0x00ff)*font_size];
4527 for (j = 0 ; j < font_size; j++, f++) {
4605 f = &font[(p[i] & 0x00ff)*font_size];
4606 for (j = 0 ; j < font_size; j++, f++) {
4528 *e = mark^*f;
4607 outw(GDCIDX, ((*f^mark) << 8) | 0x08); /* bit mask */
4608 *e = 0;
4529 e += line_length;
4530 }
4531 d++;
4532 if ((i % xsize) == xsize - 1)
4533 d += scp->xoff*2 + (font_size - 1)*line_length;
4534 }
4609 e += line_length;
4610 }
4611 d++;
4612 if ((i % xsize) == xsize - 1)
4613 d += scp->xoff*2 + (font_size - 1)*line_length;
4614 }
4615 outw(GDCIDX, 0x0000); /* set/reset */
4616 outw(GDCIDX, 0x0001); /* set/reset enable */
4617 outw(GDCIDX, 0xff08); /* bit mask */
4618
4619#if 0 /* VGA only */
4620 outw(GDCIDX, 0x0305); /* read mode 0, write mode 3 */
4621 outw(GDCIDX, 0x0003); /* data rotate/function select */
4622 outw(GDCIDX, 0x0f01); /* set/reset enable */
4623 outw(GDCIDX, 0xff08); /* bit mask */
4624 bg = -1;
4625 for (i = from ; i <= to ; i++) {
4626 /* set background color in EGA/VGA latch */
4627 if (bg != (p[i] & 0xf000)) {
4628 bg = (p[i] & 0xf000);
4629 outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */
4630 outw(GDCIDX, (bg >> 4) | 0x00); /* set/reset */
4631 *d = 0;
4632 c = *d; /* set the background color in the latch */
4633 outw(GDCIDX, 0x0305); /* read mode 0, write mode 3 */
4634 }
4635 /* foreground color */
4636 outw(GDCIDX, (p[i] & 0x0f00) | 0x00); /* set/reset */
4637 e = (u_char *)d;
4638 f = &font[(p[i] & 0x00ff)*font_size];
4639 for (j = 0 ; j < font_size; j++, f++) {
4640 *e = *f^mark;
4641 e += line_length;
4642 }
4643 d++;
4644 if ((i % xsize) == xsize - 1)
4645 d += scp->xoff*2 + (font_size - 1)*line_length;
4646 }
4647 outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */
4648 outw(GDCIDX, 0x0000); /* set/reset */
4649 outw(GDCIDX, 0x0001); /* set/reset enable */
4650#endif /* 0 */
4535 }
4536}
4537
4538#ifdef SC_SPLASH_SCREEN
4539
4540static void
4541scsplash_init(scr_stat *scp)
4542{
4543 video_info_t info;
4544
4651 }
4652}
4653
4654#ifdef SC_SPLASH_SCREEN
4655
4656static void
4657scsplash_init(scr_stat *scp)
4658{
4659 video_info_t info;
4660
4545 /*
4546 * We currently assume the splash screen always use
4547 * VGA_CG320 mode and abort installation if this mode is not
4548 * supported with this video card. XXX
4549 */
4550 if ((*biosvidsw.get_info)(scp->adp, M_VGA_CG320, &info))
4551 return;
4552
4553 if (scsplash_load(scp) == 0 && add_scrn_saver(scsplash_saver) == 0) {
4554 default_saver = scsplash_saver;
4555 scrn_blank_time = DEFAULT_BLANKTIME;
4556 run_scrn_saver = TRUE;
4557 if (!(boothowto & (RB_VERBOSE | RB_CONFIG))) {
4558 scsplash_stick(TRUE);
4559 scsplash_saver(TRUE);
4560 }
4561 }
4562}
4563
4564static void
4661 if (scsplash_load(scp) == 0 && add_scrn_saver(scsplash_saver) == 0) {
4662 default_saver = scsplash_saver;
4663 scrn_blank_time = DEFAULT_BLANKTIME;
4664 run_scrn_saver = TRUE;
4665 if (!(boothowto & (RB_VERBOSE | RB_CONFIG))) {
4666 scsplash_stick(TRUE);
4667 scsplash_saver(TRUE);
4668 }
4669 }
4670}
4671
4672static void
4673scsplash_term(scr_stat *scp)
4674{
4675 default_saver = none_saver;
4676 scsplash_stick(FALSE);
4677 remove_scrn_saver(scsplash_saver);
4678 scsplash_unload(scp);
4679}
4680
4681static void
4565scsplash_saver(int show)
4566{
4567 if (show)
4568 scsplash(TRUE);
4569 else if (!sticky_splash)
4570 scsplash(FALSE);
4571}
4572
4573#endif /* SC_SPLASH_SCREEN */
4574
4575#endif /* NSC */
4682scsplash_saver(int show)
4683{
4684 if (show)
4685 scsplash(TRUE);
4686 else if (!sticky_splash)
4687 scsplash(FALSE);
4688}
4689
4690#endif /* SC_SPLASH_SCREEN */
4691
4692#endif /* NSC */