+
+ vga_misc_output = inb(0x3CC);
+ if (vga_misc_output & 0x1 == 0) {
+ crtc_port = 0x3B4;
+ } else {
+ crtc_port = 0x3D4;
+ }
+
+ outb(crtc_port, 0xE);
+ outb(crtc_port + 1, (cursor_y * VGA_WIDTH + cursor_x) >> 8);
+ outb(crtc_port, 0xF);
+ outb(crtc_port + 1, (cursor_y * VGA_WIDTH + cursor_x) & 0xFF);
+}
+
+void kprintc(const char character, uint8_t color)
+{
+ uint8_t vga_misc_output;
+ uint16_t crtc_port;
+
+ if ( character == '\n') { cursor_x = 0; cursor_y++; }
+ else { video_memory[(cursor_y * VGA_WIDTH + cursor_x) * 2] = character; video_memory[((cursor_y * VGA_WIDTH + cursor_x++) * 2)+ 1] = color != 0 ? color : VGA_COLOR_LIGHT_GRAY; }
+ if ( cursor_x >= VGA_WIDTH ) { cursor_x = 0; cursor_y++; }
+ if ( cursor_y >= VGA_HEIGHT ) { scroll_up(); }
+
+ vga_misc_output = inb(0x3CC);
+ if (vga_misc_output & 0x1 == 0) {
+ crtc_port = 0x3B4;
+ } else {
+ crtc_port = 0x3D4;
+ }
+
+ outb(crtc_port, 0xE);
+ outb(crtc_port + 1, (cursor_y * VGA_WIDTH + cursor_x) >> 8);
+ outb(crtc_port, 0xF);
+ outb(crtc_port + 1, (cursor_y * VGA_WIDTH + cursor_x) & 0xFF);
+
+}
+
+void kprintb(uint8_t byte)
+{
+ uint8_t temp;
+ temp = byte >> 4;
+ kprint("0x", VGA_COLOR_LIGHT_GRAY);
+ kprintc(hex_chars[temp], VGA_COLOR_LIGHT_GRAY);
+ temp = byte & 0xF;
+ kprintc(hex_chars[temp], VGA_COLOR_LIGHT_GRAY);
+}
+
+void kprintw(uint16_t word)
+{
+ uint8_t temp;
+ temp = word >> 12;
+ kprint("0x", VGA_COLOR_LIGHT_GRAY);
+ kprintc(hex_chars[temp], VGA_COLOR_LIGHT_GRAY);
+ temp = (word >> 8) & 0xF;
+ kprintc(hex_chars[temp], VGA_COLOR_LIGHT_GRAY);
+ temp = (word >> 4) & 0xF;
+ kprintc(hex_chars[temp], VGA_COLOR_LIGHT_GRAY);
+ temp = word & 0xF;
+ kprintc(hex_chars[temp], VGA_COLOR_LIGHT_GRAY);
+}
+
+void kprintd(uint32_t dword)
+{
+ uint8_t temp;
+ temp = dword >> 28;
+ kprint("0x", VGA_COLOR_LIGHT_GRAY);
+ kprintc(hex_chars[temp], VGA_COLOR_LIGHT_GRAY);
+ temp = (dword >> 24) & 0xF;
+ kprintc(hex_chars[temp], VGA_COLOR_LIGHT_GRAY);
+ temp = (dword >> 20) & 0xF;
+ kprintc(hex_chars[temp], VGA_COLOR_LIGHT_GRAY);
+ temp = (dword >> 16) & 0xF;
+ kprintc(hex_chars[temp], VGA_COLOR_LIGHT_GRAY);
+ temp = (dword >> 12) & 0xF;
+ kprintc(hex_chars[temp], VGA_COLOR_LIGHT_GRAY);
+ temp = (dword >> 8) & 0xF;
+ kprintc(hex_chars[temp], VGA_COLOR_LIGHT_GRAY);
+ temp = (dword >> 4) & 0xF;
+ kprintc(hex_chars[temp], VGA_COLOR_LIGHT_GRAY);
+ temp = dword & 0xF;
+ kprintc(hex_chars[temp], VGA_COLOR_LIGHT_GRAY);