Deleted Added
full compact
vidconsole.c (54086) vidconsole.c (68358)
1/*
2 * Copyright (c) 1998 Michael Smith (msmith@freebsd.org)
3 * Copyright (c) 1997 Kazutaka YOKOTA (yokota@zodiac.mech.utsunomiya-u.ac.jp)
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * From Id: probe_keyboard.c,v 1.13 1997/06/09 05:10:55 bde Exp
28 *
1/*
2 * Copyright (c) 1998 Michael Smith (msmith@freebsd.org)
3 * Copyright (c) 1997 Kazutaka YOKOTA (yokota@zodiac.mech.utsunomiya-u.ac.jp)
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * From Id: probe_keyboard.c,v 1.13 1997/06/09 05:10:55 bde Exp
28 *
29 * $FreeBSD: head/sys/boot/pc98/libpc98/vidconsole.c 54086 1999-12-03 13:20:55Z nyan $
29 * $FreeBSD: head/sys/boot/pc98/libpc98/vidconsole.c 68358 2000-11-05 12:35:41Z nyan $
30 */
31
32#include <stand.h>
33#include <bootstrap.h>
34#include <btxv86.h>
35#include <machine/psl.h>
30 */
31
32#include <stand.h>
33#include <bootstrap.h>
34#include <btxv86.h>
35#include <machine/psl.h>
36#include "libi386.h"
37#ifdef PC98
38#include <machine/cpufunc.h>
39#endif
36#ifdef PC98
37#include <machine/cpufunc.h>
38#endif
39#include "libi386.h"
40
41#if KEYBOARD_PROBE
42#include <machine/cpufunc.h>
43
44static int probe_keyboard(void);
45#endif
46static void vidc_probe(struct console *cp);
47static int vidc_init(int arg);
48static void vidc_putchar(int c);
49static int vidc_getchar(void);
50static int vidc_ischar(void);
51
52static int vidc_started;
53
54#ifdef TERM_EMU
40
41#if KEYBOARD_PROBE
42#include <machine/cpufunc.h>
43
44static int probe_keyboard(void);
45#endif
46static void vidc_probe(struct console *cp);
47static int vidc_init(int arg);
48static void vidc_putchar(int c);
49static int vidc_getchar(void);
50static int vidc_ischar(void);
51
52static int vidc_started;
53
54#ifdef TERM_EMU
55void end_term();
55void end_term(void);
56void bail_out(int c);
57void vidc_term_emu(int c);
58void get_pos(void);
59void curs_move(int x, int y);
60void write_char(int c, int fg, int bg);
61void scroll_up(int rows, int fg, int bg);
56void bail_out(int c);
57void vidc_term_emu(int c);
58void get_pos(void);
59void curs_move(int x, int y);
60void write_char(int c, int fg, int bg);
61void scroll_up(int rows, int fg, int bg);
62int pow10(int i);
62void AB(void);
63void AF(void);
64void CD(void);
65void CM(void);
66void HO(void);
67void ME(void);
68
69static int args[2],argc,br;

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

112vidc_init(int arg)
113{
114 int i;
115#ifdef PC98
116 int hw_cursor;
117#endif
118
119 if (vidc_started && arg == 0)
63void AB(void);
64void AF(void);
65void CD(void);
66void CM(void);
67void HO(void);
68void ME(void);
69
70static int args[2],argc,br;

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

113vidc_init(int arg)
114{
115 int i;
116#ifdef PC98
117 int hw_cursor;
118#endif
119
120 if (vidc_started && arg == 0)
120 return;
121 return(0);
121 vidc_started = 1;
122#ifdef PC98
123 Crtat = (unsigned short *)PTOV(0xA0000);
124 while((inb(0x60) & 0x04) == 0);
125 outb(0x62, 0xe0);
126 while((inb(0x60) & 0x01) == 0);
127 hw_cursor = inb(0x62);
128 hw_cursor |= (inb(0x62) << 8);

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

336#endif
337}
338
339/* Scroll up the whole window by a number of rows. If rows==0,
340 * clear the window. fg and bg are attributes for the new lines
341 * inserted in the window.
342 */
343void
122 vidc_started = 1;
123#ifdef PC98
124 Crtat = (unsigned short *)PTOV(0xA0000);
125 while((inb(0x60) & 0x04) == 0);
126 outb(0x62, 0xe0);
127 while((inb(0x60) & 0x01) == 0);
128 hw_cursor = inb(0x62);
129 hw_cursor |= (inb(0x62) << 8);

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

337#endif
338}
339
340/* Scroll up the whole window by a number of rows. If rows==0,
341 * clear the window. fg and bg are attributes for the new lines
342 * inserted in the window.
343 */
344void
344scroll_up(int rows, int fg, int bg)
345scroll_up(int rows, int fgcol, int bgcol)
345{
346#ifdef PC98
347 unsigned short *cp;
348 int i;
349
350 if(rows==0) rows=25;
351 cp = Crtat;
352 for (i = rows ; i < row; i++) {
353 bcopy((void *)(cp+col), (void *)cp, col*2);
354 cp += col;
355 }
356 for (i = 0; i < col; i++) {
346{
347#ifdef PC98
348 unsigned short *cp;
349 int i;
350
351 if(rows==0) rows=25;
352 cp = Crtat;
353 for (i = rows ; i < row; i++) {
354 bcopy((void *)(cp+col), (void *)cp, col*2);
355 cp += col;
356 }
357 for (i = 0; i < col; i++) {
357 *(cp + 0x1000) = at2pc98(fg, bg);
358 *(cp + 0x1000) = at2pc98(fgcol, bgcol);
358 *cp++ = ' ';
359 }
360#else
361 if(rows==0) rows=25;
362 v86.ctl = 0;
363 v86.addr = 0x10;
364 v86.eax = 0x0600+(0x00ff & rows);
359 *cp++ = ' ';
360 }
361#else
362 if(rows==0) rows=25;
363 v86.ctl = 0;
364 v86.addr = 0x10;
365 v86.eax = 0x0600+(0x00ff & rows);
365 v86.ebx = (bg<<12)+(fg<<8);
366 v86.ebx = (bgcol<<12)+(fgcol<<8);
366 v86.ecx = 0x0;
367 v86.edx = 0x184f;
368 v86int();
369#endif
370}
371
372/* Write character and attribute at cursor position. */
373void
367 v86.ecx = 0x0;
368 v86.edx = 0x184f;
369 v86int();
370#endif
371}
372
373/* Write character and attribute at cursor position. */
374void
374write_char(int c, int fg, int bg)
375write_char(int c, int fgcol, int bgcol)
375{
376#ifdef PC98
377 *crtat = (c == 0x5c ? 0xfc : c);
376{
377#ifdef PC98
378 *crtat = (c == 0x5c ? 0xfc : c);
378 *(crtat + 0x1000) = at2pc98(fg, bg);
379 *(crtat + 0x1000) = at2pc98(fgcol, bgcol);
379#else
380 v86.ctl=0;
381 v86.addr = 0x10;
382 v86.eax = 0x0900+(0x00ff & c);
380#else
381 v86.ctl=0;
382 v86.addr = 0x10;
383 v86.eax = 0x0900+(0x00ff & c);
383 v86.ebx = (bg<<4)+fg;
384 v86.ebx = (bgcol<<4)+fgcol;
384 v86.ecx = 0x1;
385 v86int();
386#endif
387}
388
389/* Calculate power of 10 */
390int
391pow10(int i)

--- 426 unchanged lines hidden ---
385 v86.ecx = 0x1;
386 v86int();
387#endif
388}
389
390/* Calculate power of 10 */
391int
392pow10(int i)

--- 426 unchanged lines hidden ---