1.1 --- a/examples/vga/main.c Thu Nov 08 23:40:26 2018 +0100
1.2 +++ b/examples/vga/main.c Thu Nov 08 23:49:36 2018 +0100
1.3 @@ -339,6 +339,7 @@
1.4
1.5 static void write_chars(void)
1.6 {
1.7 + const int line_height = 9;
1.8 int x = 0, y = 0;
1.9 char c;
1.10
1.11 @@ -347,16 +348,21 @@
1.12 font_config.base = fontbase;
1.13 font_config.limit = fontlimit;
1.14
1.15 - while (y < display_config.line_count)
1.16 + while (y + line_height < display_config.line_count)
1.17 + {
1.18 for (c = (char) font_config.base; c < (char) font_config.limit; c++)
1.19 {
1.20 - x = write_char(&display_config, &font_config, c, x, y, 0xff);
1.21 -
1.22 - if (x > display_config.line_length)
1.23 + if (x + get_char_definition(&font_config, c)->width > display_config.line_length)
1.24 {
1.25 - x = 0; y += 9;
1.26 + x = 0; y += line_height;
1.27 }
1.28 +
1.29 + if (y + line_height >= display_config.line_count)
1.30 + break;
1.31 +
1.32 + x = write_char(&display_config, &font_config, c, x, y, 0xff);
1.33 }
1.34 + }
1.35 }
1.36
1.37 /* Set up a background. */