summaryrefslogtreecommitdiff
path: root/console.c
diff options
context:
space:
mode:
Diffstat (limited to 'console.c')
-rw-r--r--console.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/console.c b/console.c
index 2035611..e6203e2 100644
--- a/console.c
+++ b/console.c
@@ -2,6 +2,23 @@
#include <x86.h>
#include "defs.h"
+/*
+ * copy console output to parallel port, which you can tell
+ * .bochsrc to copy to the stdout:
+ * parport1: enabled=1, file="/dev/stdout"
+ */
+static void
+lpt_putc(int c)
+{
+ int i;
+
+ for (i = 0; !(inb(0x378+1) & 0x80) && i < 12800; i++)
+ ;
+ outb(0x378+0, c);
+ outb(0x378+2, 0x08|0x04|0x01);
+ outb(0x378+2, 0x08);
+}
+
void
cons_putc(int c)
{
@@ -9,6 +26,8 @@ cons_putc(int c)
unsigned short *crt = (unsigned short *) 0xB8000; // base of CGA memory
int ind;
+ lpt_putc(c);
+
// cursor position, 16 bits, col + 80*row
outb(crtport, 14);
ind = inb(crtport + 1) << 8;