|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1995-1994 The University of Utah and ! 3: * the Computer Systems Laboratory at the University of Utah (CSL). ! 4: * All rights reserved. ! 5: * ! 6: * Permission to use, copy, modify and distribute this software is hereby ! 7: * granted provided that (1) source code retains these copyright, permission, ! 8: * and disclaimer notices, and (2) redistributions including binaries ! 9: * reproduce the notices in supporting documentation, and (3) all advertising ! 10: * materials mentioning features or use of this software display the following ! 11: * acknowledgement: ``This product includes software developed by the ! 12: * Computer Systems Laboratory at the University of Utah.'' ! 13: * ! 14: * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS ! 15: * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF ! 16: * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ! 17: * ! 18: * CSL requests users of this software to return to [email protected] any ! 19: * improvements that they make and grant CSL redistribution rights. ! 20: * ! 21: * Author: Bryan Ford, University of Utah CSL ! 22: */ ! 23: ! 24: #include <mach/machine/eflags.h> ! 25: ! 26: #include "real.h" ! 27: ! 28: #ifndef ENABLE_IMMCONSOLE ! 29: ! 30: #include <rc.h> ! 31: int putchar(int c) ! 32: { ! 33: ! 34: if (c == '\n') ! 35: putchar('\r'); ! 36: ! 37: { ! 38: #if RCLINE >= 0 ! 39: static int serial_inited = 0; ! 40: if (! serial_inited) { ! 41: init_serial(); ! 42: serial_inited = 1; ! 43: } ! 44: serial_putc(c); ! 45: #else ! 46: struct real_call_data rcd; ! 47: rcd.eax = 0x0e00 | (c & 0xff); ! 48: rcd.ebx = 0x07; ! 49: rcd.flags = 0; ! 50: real_int(0x10, &rcd); ! 51: #endif ! 52: } ! 53: ! 54: return 0; ! 55: } ! 56: ! 57: #else ENABLE_IMMCONSOLE ! 58: ! 59: void ! 60: putchar(unsigned char c) ! 61: { ! 62: static int ofs = -1; ! 63: ! 64: if (ofs < 0) ! 65: { ! 66: ofs = 0; ! 67: putchar('\n'); ! 68: } ! 69: if (c == '\r') ! 70: { ! 71: ofs = 0; ! 72: } ! 73: else if (c == '\n') ! 74: { ! 75: bcopy(0xb8000+80*2, 0xb8000, 80*2*24); ! 76: bzero(0xb8000+80*2*24, 80*2); ! 77: ofs = 0; ! 78: } ! 79: else ! 80: { ! 81: volatile unsigned char *p; ! 82: ! 83: if (ofs >= 80) ! 84: { ! 85: putchar('\r'); ! 86: putchar('\n'); ! 87: } ! 88: ! 89: p = (void*)0xb8000 + 80*2*24 + ofs*2; ! 90: p[0] = c; ! 91: p[1] = 0x0f; ! 92: ofs++; ! 93: } ! 94: } ! 95: ! 96: #endif ENABLE_IMMCONSOLE
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.