send console output to parallel port
This commit is contained in:
parent
8352b99801
commit
bf49aedbed
2 changed files with 22 additions and 0 deletions
3
Notes
3
Notes
|
@ -1,3 +1,6 @@
|
||||||
|
bochs 2.2.6:
|
||||||
|
./configure --enable-smp --enable-disasm --enable-debugger --enable-all-optimizations --enable-4meg-pages --enable-global-pages --enable-pae --disable-reset-on-triple-fault
|
||||||
|
|
||||||
bootmain.c doesn't work right if the ELF sections aren't
|
bootmain.c doesn't work right if the ELF sections aren't
|
||||||
sector-aligned. so you can't use ld -N. and the sections may also need
|
sector-aligned. so you can't use ld -N. and the sections may also need
|
||||||
to be non-zero length, only really matters for tiny "kernels".
|
to be non-zero length, only really matters for tiny "kernels".
|
||||||
|
|
19
console.c
19
console.c
|
@ -2,6 +2,23 @@
|
||||||
#include <x86.h>
|
#include <x86.h>
|
||||||
#include "defs.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
|
void
|
||||||
cons_putc(int c)
|
cons_putc(int c)
|
||||||
{
|
{
|
||||||
|
@ -9,6 +26,8 @@ cons_putc(int c)
|
||||||
unsigned short *crt = (unsigned short *) 0xB8000; // base of CGA memory
|
unsigned short *crt = (unsigned short *) 0xB8000; // base of CGA memory
|
||||||
int ind;
|
int ind;
|
||||||
|
|
||||||
|
lpt_putc(c);
|
||||||
|
|
||||||
// cursor position, 16 bits, col + 80*row
|
// cursor position, 16 bits, col + 80*row
|
||||||
outb(crtport, 14);
|
outb(crtport, 14);
|
||||||
ind = inb(crtport + 1) << 8;
|
ind = inb(crtport + 1) << 8;
|
||||||
|
|
Loading…
Reference in a new issue