Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Make sure that at the X/Y position of the cursor is a color attribute even if not a character. The cursor needs an attribute just like any character to appear.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
omarrx024 wrote:Make sure that at the X/Y position of the cursor is a color attribute even if not a character. The cursor needs an attribute just like any character to appear.
Wait wait wait... A color attribute, so cursor is not an unique structure it is like a character. How can I implement that? Do I need to draw a character at cursor position + 1?
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
It's fine, but what is color depth? BTW, you are calculating the pointer to the character twice, which is going to decrease performance. In text modes, I guess the color depth is always 1 byte.
No, you don't need to draw a character at cursor position. You just need to have an attribute at the X/Y position of the cursor as if there was a character. Try clearing your screen but putting character 0x20 (space) in all character fields, and attribute 0x70 (just random color for testing) in all attribute fields. Then run this code:
You should see a cursor at the top-left corner. If not, then you need to tweak the VGA registers to make the cursor visible. I'll dig up the docs; I have them somewhere but haven't used them for a long time.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
omarrx024 wrote:It's fine, but what is color depth? BTW, you are calculating the pointer to the character twice, which is going to decrease performance. In text modes, I guess the color depth is always 1 byte.
No, you don't need to draw a character at cursor position. You just need to have an attribute at the X/Y position of the cursor as if there was a character. Try clearing your screen but putting character 0x20 (space) in all character fields, and attribute 0x70 (just random color for testing) in all attribute fields. Then run this code:
You should see a cursor at the top-left corner. If not, then you need to tweak the VGA registers to make the cursor visible. I'll dig up the docs; I have them somewhere but haven't used them for a long time.
Color depth is two. I did it all exactly as you told me to do:
outb(0x3D4, 0x09); // set maximum scan line register to 15
outb(0x3D5, 0x0F);
outb(0x3D4, 0x0B); // set the cursor end line to 15
outb(0x3D5, 0x0F);
outb(0x3D4, 0x0A); // set the cursor start line to 14 and enable cursor visibility
outb(0x3D5, 0x0E);
EDIT: Fixed a tiny mistake in the end of the code.
Last edited by BrightLight on Sat Dec 31, 2016 2:04 pm, edited 1 time in total.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
outb(0x3D4, 0x09); // set maximum scan line register to 15
outb(0x3D5, 0x0F);
outb(0x3D4, 0x0B); // set the cursor end line to 15
outb(0x3D5, 0x0F);
outb(0x3D4, 0x0A); // set the cursor start line to 14 and enable cursor visibility
outb(0x3D5, 0x2E);