簡體   English   中英

我自定義操作系統內核中的VGA顯示問題

[英]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終端屏幕的端口,如下圖所示:

一只忙碌的貓

但我想,整個終端都是綠色的。 顯示器應使用整個終端。 任何幫助都非常感謝。 謝謝

我附上了我的代碼要點。

VGA.c

更改:

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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM