我正在开发一个操作系统作为一个业余项目。我使用address 0xB 8000接口VGA显示,行数设置为25,列设置为80。我使用了以下清晰的屏幕功能:
void vga_init(void) {
// Initialise the VGA variables and clear the screen : :
vga_buffer_pointer = (uint16_t *) VGA_MEMORY_LOCATION;
//start clear using 2 pass loop :
uint8_t iter_i = 0;
uint8_t iter_j = 0;
for(iter_i = 0; iter_i < VGA_ROWS; iter_i ++) {
for(iter_j = 0; iter_j < VGA_COLS; iter_j++) {
uint8_t index = (VGA_COLS * iter_i) + iter_j;
vga_buffer_pointer[index] = ((uint16_t)color << 8) | ' ';
}
}
enable_cursor(14,15);
} 我正在用绿色初始化屏幕。该显示器只占用qemu终端屏幕的移植,如下所示:

但我希望整个航站楼都是绿色的。显示器应该使用整个终端。任何帮助都是非常感谢的。谢谢
我附上了我的密码要点。
发布于 2019-02-03 07:20:10
更改:
uint8_t index = (VGA_COLS * iter_i) + iter_j; 至:
uint16_t index = (VGA_COLS * iter_i) + iter_j; uint8_t不足以容纳索引的计算,因此它被截断,导致显示的一部分被擦除。
https://stackoverflow.com/questions/54500636
复制相似问题