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;
}
解决方案
推荐阅读
- sql - 通过 Proc SQL 语句将列添加到 SAS
- python - 具有多个 Python 依赖项的模板数据流
- asp.net - 命名空间“Microsoft”中不存在类型或命名空间名称“EntityFrameworkCore”
- java - DateTime 转换为 Xa6maSA 格式
- javascript - 如何在 undici 中使用经过身份验证的代理
- reporting-services - SSRS - 执行布尔 IFF 表达式时忽略 NULL
- java - 如何正确转换opencsv中的字段?
- bash - hiera(Puppet)yaml中的cronjob在一行中的几个命令
- python - 允许机器人命令(仅用于测试)
- javascript - TypeScript 遍历对象并从值创建类型