Deleted Added
full compact
1c1
< /*
---
> /*-
31c31
< __FBSDID("$FreeBSD: head/sys/boot/pc98/libpc98/vidconsole.c 145069 2005-04-14 14:12:54Z nyan $");
---
> __FBSDID("$FreeBSD: head/sys/boot/pc98/libpc98/vidconsole.c 146011 2005-05-08 14:17:28Z nyan $");
37d36
< #ifdef PC98
39d37
< #endif
76d73
< #ifdef PC98
117d113
< #endif /* PC98 */
150,153c146
< int i;
< #ifdef PC98
< int hw_cursor;
< #endif
---
> int i, hw_cursor;
158d150
< #ifdef PC98
171d162
< #endif
185d175
< #ifdef PC98
194d183
< #endif
200d188
< #ifdef PC98
241,248d228
< #else
<
< v86.ctl = 0;
< v86.addr = 0x10;
< v86.eax = 0xe00 | (c & 0xff);
< v86.ebx = 0x7;
< v86int();
< #endif
262,264d241
< #if !defined(TERM_EMU) && !defined(PC98)
< vidc_biosputchar(c);
< #else
268d244
< #ifdef PC98
270,272d245
< #else
< vidc_biosputchar(c);
< #endif
309d281
< #endif
321d292
< #ifdef PC98
326,335d296
< #else
<
< v86.ctl = 0;
< v86.addr = 0x10;
< v86.eax = 0x0300;
< v86.ebx = 0x0;
< v86int();
< curx = v86.edx & 0x00ff;
< cury = (v86.edx & 0xff00) >> 8;
< #endif
342d302
< #ifdef PC98
358,380d317
< #else
<
< v86.ctl = 0;
< v86.addr = 0x10;
< v86.eax = 0x0200;
< v86.ebx = 0x0;
< v86.edx = ((0x00ff & y) << 8) + (0x00ff & x);
< v86int();
< curx = x;
< cury = y;
< /* If there is ctrl char at this position, cursor would be invisible.
< * Make it a space instead.
< */
< v86.ctl = 0;
< v86.addr = 0x10;
< v86.eax = 0x0800;
< v86.ebx = 0x0;
< v86int();
< #define isvisible(c) (((c) >= 32) && ((c) < 255))
< if (!isvisible(v86.eax & 0x00ff)) {
< write_char(' ', fg_c, bg_c);
< }
< #endif
390d326
< #ifdef PC98
405,416d340
< #else
<
< if (rows == 0)
< rows = 25;
< v86.ctl = 0;
< v86.addr = 0x10;
< v86.eax = 0x0600 + (0x00ff & rows);
< v86.ebx = (bgcol << 12) + (fgcol << 8);
< v86.ecx = 0x0;
< v86.edx = 0x184f;
< v86int();
< #endif
424d347
< #ifdef PC98
427,434d349
< #else
< v86.ctl = 0;
< v86.addr = 0x10;
< v86.eax = 0x0900 + (0x00ff & c);
< v86.ebx = (bgcol << 4) + fgcol;
< v86.ecx = 0x1;
< v86int();
< #endif
448d362
< #ifdef PC98
457,481d370
< #else
<
< get_pos();
< if (curx > 0) {
< v86.ctl = 0;
< v86.addr = 0x10;
< v86.eax = 0x0600;
< v86.ebx = (bg_c << 4) + fg_c;
< v86.ecx = (cury << 8) + curx;
< v86.edx = (cury << 8) + 79;
< v86int();
< if (++cury > 24) {
< end_term();
< return;
< }
< }
< v86.ctl = 0;
< v86.addr = 0x10;
< v86.eax = 0x0600;
< v86.ebx = (bg_c << 4) + fg_c;
< v86.ecx = (cury << 8) + 0;
< v86.edx = (24 << 8) + 79;
< v86int();
< end_term();
< #endif
682d570
< #ifdef PC98
684,686d571
< #else
< v86.addr = 0x16;
< #endif
699d583
< #ifdef PC98
705,711d588
< #else
< v86.ctl = V86_FLAGS;
< v86.addr = 0x16;
< v86.eax = 0x100;
< v86int();
< return (!(v86.efl & PSL_Z));
< #endif
715,716d591
<
< #ifdef PC98
722,831d596
< #else /* PC98 */
< #define PROBE_MAXRETRY 5
< #define PROBE_MAXWAIT 400
< #define IO_DUMMY 0x84
< #define IO_KBD 0x060 /* 8042 Keyboard */
<
< /* selected defines from kbdio.h */
< #define KBD_STATUS_PORT 4 /* status port, read */
< #define KBD_DATA_PORT 0 /* data port, read/write
< * also used as keyboard command
< * and mouse command port
< */
< #define KBDC_ECHO 0x00ee
< #define KBDS_ANY_BUFFER_FULL 0x0001
< #define KBDS_INPUT_BUFFER_FULL 0x0002
< #define KBD_ECHO 0x00ee
<
< /* 7 microsec delay necessary for some keyboard controllers */
< static void
< delay7(void)
< {
< /*
< * I know this is broken, but no timer is available yet at this stage...
< * See also comments in `delay1ms()'.
< */
< inb(IO_DUMMY); inb(IO_DUMMY);
< inb(IO_DUMMY); inb(IO_DUMMY);
< inb(IO_DUMMY); inb(IO_DUMMY);
< }
<
< /*
< * This routine uses an inb to an unused port, the time to execute that
< * inb is approximately 1.25uS. This value is pretty constant across
< * all CPU's and all buses, with the exception of some PCI implentations
< * that do not forward this I/O address to the ISA bus as they know it
< * is not a valid ISA bus address, those machines execute this inb in
< * 60 nS :-(.
< *
< */
< static void
< delay1ms(void)
< {
< int i = 800;
< while (--i >= 0)
< (void)inb(0x84);
< }
<
< /*
< * We use the presence/absence of a keyboard to determine whether the internal
< * console can be used for input.
< *
< * Perform a simple test on the keyboard; issue the ECHO command and see
< * if the right answer is returned. We don't do anything as drastic as
< * full keyboard reset; it will be too troublesome and take too much time.
< */
< static int
< probe_keyboard(void)
< {
< int retry = PROBE_MAXRETRY;
< int wait;
< int i;
<
< while (--retry >= 0) {
< /* flush any noise */
< while (inb(IO_KBD + KBD_STATUS_PORT) & KBDS_ANY_BUFFER_FULL) {
< delay7();
< inb(IO_KBD + KBD_DATA_PORT);
< delay1ms();
< }
<
< /* wait until the controller can accept a command */
< for (wait = PROBE_MAXWAIT; wait > 0; --wait) {
< if (((i = inb(IO_KBD + KBD_STATUS_PORT))
< & (KBDS_INPUT_BUFFER_FULL | KBDS_ANY_BUFFER_FULL)) == 0)
< break;
< if (i & KBDS_ANY_BUFFER_FULL) {
< delay7();
< inb(IO_KBD + KBD_DATA_PORT);
< }
< delay1ms();
< }
< if (wait <= 0)
< continue;
<
< /* send the ECHO command */
< outb(IO_KBD + KBD_DATA_PORT, KBDC_ECHO);
<
< /* wait for a response */
< for (wait = PROBE_MAXWAIT; wait > 0; --wait) {
< if (inb(IO_KBD + KBD_STATUS_PORT) & KBDS_ANY_BUFFER_FULL)
< break;
< delay1ms();
< }
< if (wait <= 0)
< continue;
<
< delay7();
< i = inb(IO_KBD + KBD_DATA_PORT);
< #ifdef PROBE_KBD_BEBUG
< printf("probe_keyboard: got 0x%x.\n", i);
< #endif
< if (i == KBD_ECHO) {
< /* got the right answer */
< return (0);
< }
< }
<
< return (1);
< }
< #endif /* PC98 */