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
Your outb function has port and value in the wrong places. Instead of:
asm volatile ( "outb %0, %1" : : "a"(value), "Nd"(port) );
Try:
asm volatile ("outb %1, %0" : : "dN" (port), "a" (value));
Hope it helps :)
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
.