void print_kernel_version() {
//
extern tty_t *const default_tty;
- tty_write_at(default_tty, 0, 0, version, (size_t)strlen(version));
+ tty_t *const tty = default_tty;
+
+ int len = strlen(version);
+
+ for (int i = 0; i < tty->max_x; i++) {
+ char c = i < len ? version[i] : ' ';
+ c = c != '\n' ? c : ' ';
+ c = c != '\t' ? c : ' ';
+
+ //
+ uint32_t fg_color = tty->fg_color;
+ uint32_t bg_color = tty->bg_color;
+
+ fg_color = TTY_WHITE | TTY_FG_HIGHLIGHT;
+ bg_color = TTY_CYAN;
+
+ //
+ char *dst = (char *)tty->base_addr;
+
+ //
+ dst[i * 2 + 0] = c;
+ dst[i * 2 + 1] = ((bg_color) << 4) | (fg_color);
+ }
//
printk(version);
tty->fg_color = TTY_FG_HIGHLIGHT | TTY_GREEN; // 高亮
tty->bg_color = TTY_BLACK; // 不闪
+ tty->max_x = MAX_X;
+ tty->max_y = MAX_Y;
+
tty->base_addr = base;
for (int i = 0; i < TTY_VRAM_SIZE; i += 2) {