void video_putc(char ch) { switch(ch) { case '\n': cursor_col = 0; cursor_row += 1; break; case '\r': cursor_col = 0; break; case '\b': if (cursor_col) cursor_col--; else return; break; case '\t': cursor_col = (cursor_col/8+1)*8; break; default: video_write_char(ch); cursor_col++; if (cursor_col > VIDEO_COLS-1) { cursor_row++; cursor_col=0; } } if (cursor_row > VIDEO_ROWS-1) video_scroll(1); video_set_cursor(cursor_row, cursor_col); }
void vga_putc(unsigned char byte) { if (byte == '\n') { video_line++; video_col = 0; } else if (byte == '\r') { video_col = 0; } else if (byte == '\b') { video_col--; } else if (byte == '\t') { video_col += 4; } else if (byte == '\a') { //beep //beep(500); } else { vidmem[((video_col + (video_line *COLS)) * 2)] = byte; vidmem[((video_col + (video_line *COLS)) * 2) +1] = VGA_ATTR_CLR_WHT; video_col++; } if (video_col < 0) { video_col = 0; } if (video_col >= COLS) { video_line++; video_col = 0; } if (video_line >= LINES) { video_scroll(); video_line--; } // move the cursor write_crtc((video_col + (video_line *COLS)) >> 8, CRTC_CURSOR_HI); write_crtc((video_col + (video_line *COLS)) & 0x0ff, CRTC_CURSOR_LO); }