// output a character to the console static void cons_putc_color(int font_color, int bg_color, int c) { const char *esc_seq_font = color_entries[font_color].esc_seq_font; const char *esc_seq_bg = color_entries[bg_color].esc_seq_bg; uint8_t attr = 0; if (font_color < 0 || font_color >= COLOR_MAX || bg_color < 0 || bg_color >= COLOR_MAX) panic("invalid color specifier\n"); // define NO_COLOR flag in order to keep grading scripts happy; // python's regexes have problems with ansi escape sequences; // it is easier to pass flag and disable colors for grading rather than // discarding sequences in every grading regex; #ifndef NO_COLOR output_esc_seq(esc_seq_font); output_esc_seq(esc_seq_bg); #endif serial_putc(c); attr = ((bg_color & 0x7) << 4) | (font_color & 0xf); c |= (attr << 8); lpt_putc(c); cga_putc(c); }
// output a character to the console static void cons_putc(int c) { serial_putc(c); lpt_putc(c); cga_putc(c); }
void cga_puts(const char *s) { int i = 0; while (s[i]) { cga_putc(s[i]); i++; } }
/* cons_putc - print a single character @c to console devices */ void cons_putc(int c) { unsigned long intr_flag; local_irq_save(intr_flag); { lpt_putc(c); cga_putc(c); serial_putc(c); } local_irq_restore(intr_flag); }
/* cons_putc - print a single character @c to console devices */ void cons_putc(int c) { bool intr_flag; local_intr_save(intr_flag); { lpt_putc(c); cga_putc(c); serial_putc(c); } local_intr_restore(intr_flag); }
void cons_putc(int c) { if(panicked) { cli(); for(;;) ; } lpt_putc(c); cga_putc(c); }
// output a character to the console void cons_putc(int c) { lpt_putc(c); cga_putc(c); }
extern void console_putc(int c) { cga_putc(c); }
static void cga_putc(int c) { #if CRT_SAVEROWS > 0 // unscroll if necessary if (crtsave_backscroll > 0) { cga_savebuf_copy(crtsave_pos + crtsave_size, 1); crtsave_backscroll = 0; } #endif // if no attribute given, then use light gray on black if (!(c & ~0xFF)) c |= 0x0700; switch (c & 0xff) { case '\b': if (crt_pos > 0) { crt_pos--; crt_buf[crt_pos] = (c & ~0xff) | ' '; } break; case '\n': crt_pos += CRT_COLS; /* fallthru */ case '\r': crt_pos -= (crt_pos % CRT_COLS); break; case '\t': cga_putc(' '); cga_putc(' '); cga_putc(' '); cga_putc(' '); break; default: crt_buf[crt_pos++] = c; /* write the character */ break; } // What is the purpose of this? if (crt_pos >= CRT_SIZE) { int i; #if CRT_SAVEROWS > 0 // Save the scrolled-back row if (crtsave_size == CRT_SAVEROWS - CRT_ROWS) crtsave_pos = (crtsave_pos + 1) % CRT_SAVEROWS; else crtsave_size++; memcpy(crtsave_buf + ((crtsave_pos + crtsave_size - 1) % CRT_SAVEROWS) * CRT_COLS, crt_buf, CRT_COLS * sizeof(uint16_t)); #endif memcpy(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) * sizeof(uint16_t)); for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i++) crt_buf[i] = 0x0700 | ' '; crt_pos -= CRT_COLS; } /* move that little blinky thing */ outb(addr_6845, 14); outb(addr_6845 + 1, crt_pos >> 8); outb(addr_6845, 15); outb(addr_6845 + 1, crt_pos); }
// output a character to the console void cons_putc(int c) { cga_putc(c); }//cons_putc()