VirtualMachine Ubuntu 18.04属性字节

时间:2019-02-04 12:21:20

标签: c

我正在尝试更改属性字节以允许白色文本和蓝色背景,目前我的黑色为0x07浅灰色。我可以得到蓝色背景,但不能得到白色文本。我尝试了1x15 1x15f,但都没有用。任何反馈或链接资源将不胜感激。

 void kmain(void)
 {
     const char *str = "my first kernel";
     char *vidptr = (char*)0xb8000;  //video mem begins     here.
     unsigned int i = 0;
     unsigned int j = 0;

   /* this loops clears the screen
  * there are 25 lines each of 80 columns; each element takes 2 bytes */
     while(j < 80 * 25 * 2) {
/* blank character */
         vidptr[j] = ' ';
/* attribute-byte - light grey on black screen */
         vidptr[j+1] = 0x07;         
          j = j + 2;
  }

0 个答案:

没有答案