小编SKZ*_*KZI的帖子

为什么我的代码不能在屏幕上绘制白色像素?

我正在制作一个运行 Snake 的操作系统,并且我处于 32 位保护模式,但我无法在屏幕上绘制像素。我在实模式下切换到模式 0x13 (320x200x256),屏幕一片空白。进入保护模式后,内核运行并且我正在绘制的像素不会出现。

我从这篇OSDev 文章中汲取灵感,该文章切换到保护模式并将像素绘制到视频显示上。

这是kernel.c

#include "display.h"    // Include Display Drivers
#include "constants.h" // Include constants that C doesn't have included
#include "keyboard.h" // Include the custom keyboard driver

void _start(){} // Remove LD Warning

DisplayDetails globalDisplayDetails; // The display details.

int main(){
    // Init the display details
    DisplayDetails details = display_init();
    globalDisplayDetails = details;
    bool running = true;
    
    while(running){
        // This is the OS loop
        putpixel(100, 100, 0x00FFFFFF);
    } …
Run Code Online (Sandbox Code Playgroud)

x86 assembly gcc nasm osdev

1
推荐指数
1
解决办法
168
查看次数

标签 统计

assembly ×1

gcc ×1

nasm ×1

osdev ×1

x86 ×1