* This function will write a character to cga * * @param c the char to write */
| 72 | * @param c the char to write |
| 73 | */ |
| 74 | static void rt_cga_putc(int c) |
| 75 | { |
| 76 | /* if no attribute given, then use black on white */ |
| 77 | if (!(c & ~0xff)) c |= 0x0700; |
| 78 | |
| 79 | switch (c & 0xff) |
| 80 | { |
| 81 | case '\b': |
| 82 | if (crt_pos > 0) |
| 83 | { |
| 84 | crt_pos--; |
| 85 | crt_buf[crt_pos] = (c&~0xff) | ' '; |
| 86 | } |
| 87 | break; |
| 88 | case '\n': |
| 89 | crt_pos += CRT_COLS; |
| 90 | /* cascade */ |
| 91 | case '\r': |
| 92 | crt_pos -= (crt_pos % CRT_COLS); |
| 93 | break; |
| 94 | case '\t': |
| 95 | rt_console_putc(' '); |
| 96 | rt_console_putc(' '); |
| 97 | rt_console_putc(' '); |
| 98 | rt_console_putc(' '); |
| 99 | rt_console_putc(' '); |
| 100 | break; |
| 101 | default: |
| 102 | crt_buf[crt_pos++] = c; /* write the character */ |
| 103 | break; |
| 104 | } |
| 105 | |
| 106 | if (crt_pos >= CRT_SIZE) |
| 107 | { |
| 108 | rt_int32_t i; |
| 109 | rt_memcpy(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) << 1); |
| 110 | for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i++) |
| 111 | crt_buf[i] = 0x0700 | ' '; |
| 112 | crt_pos -= CRT_COLS; |
| 113 | } |
| 114 | |
| 115 | outb(addr_6845, 14); |
| 116 | outb(addr_6845+1, crt_pos >> 8); |
| 117 | outb(addr_6845, 15); |
| 118 | outb(addr_6845+1, crt_pos); |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * This function will write a character to serial an cga |
no test coverage detected