Moving text mode cursor not working

后端 未结 2 995
故里飘歌
故里飘歌 2021-01-16 13:35

I have been working on moving the text mode cursor in the operating system I am currently developing. I am having trouble getting it to show up at all. Here is the code that

2条回答
  •  盖世英雄少女心
    2021-01-16 14:24

    You select wrong VGA registers. You have to use 0x0F for low and 0x0E for high (you have 0x0A for both).

    Edit: In case your cursor is disabled, this is how to enable it:

    void enable_cursor() {
        outb(0x3D4, 0x0A);
        char curstart = inb(0x3D5) & 0x1F; // get cursor scanline start
    
        outb(0x3D4, 0x0A);
        outb(0x3D5, curstart | 0x20); // set enable bit
    }
    

    Also check this link for list of register numbers and usages.

    Edit2: Your cursor location variable is not wide enough to store the cursor location. unsigned char cursor_loc should be unsigned short cursor_loc.

提交回复
热议问题