【发布时间】:2014-08-15 05:22:39
【问题描述】:
我一直致力于在我目前正在开发的操作系统中移动文本模式光标。我根本无法让它出现。这是我用来更新光标的代码:
void update_cursor()
{
unsigned char cursor_loc = (y_pos*Cols)+x_pos;
// cursor LOW port to vga INDEX register
outb(0x3D4, 0x0F);
outb(0x3D5, (unsigned char)(cursor_loc));
// cursor HIGH port to vga INDEX register
outb(0x3D4, 0x0E);
outb(0x3D5, (unsigned char)((cursor_loc>>8)));
}
static inline void outb(unsigned short port, unsigned char value)
{
asm volatile ( "outb %0, %1" : : "a"(value), "Nd"(port) );
}
static inline unsigned char inb(unsigned short port)
{
unsigned char ret;
asm volatile ( "inb %1, %0" : "=a"(ret) : "Nd"(port) );
return ret;
}
我使用 gcc 版本 4.8.3 (GCC) 来编译我的主文件。我完全迷失了。有人对这可能是什么问题有任何建议吗? 如果您想查看完整的源代码,请点击此处:https://github.com/AnonymousUser1337/Anmu/blob/master/Kernel/kernel.cpp
编辑:我正在使用 Virtual box 来运行它
提前致谢。
【问题讨论】: