[英]VGA Display problem in my custom OS kernel
我正在開發一個操作系統作為業余愛好項目。 我使用地址0xB8000連接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終端屏幕的端口,如下圖所示:
但我想,整個終端都是綠色的。 顯示器應使用整個終端。 任何幫助都非常感謝。 謝謝
我附上了我的代碼要點。
更改:
uint8_t index = (VGA_COLS * iter_i) + iter_j;
至:
uint16_t index = (VGA_COLS * iter_i) + iter_j;
uint8_t
不足以保存索引的計算,因此它被截斷,導致僅部分顯示被擦除。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.