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.
i've started coding a minimal kernel in hla (http://webster.cs.ucr.edu/)..i have a routine to write to the screen (in pm, i.e. writing to video memory) and i also have a cursor varibale to track the position of the next character to be printed to screen. now i was trying to write the move_cursor procedure and found that it doesnt work:
but no matter how often i call this routine, the cursor always stays at the same position. before switching to pm i made a teletype output with an interrupt which left the cursor somewhere in the middle of the display so i can clearly see it, but my procedure doesnt make any changes to that position? is there a trick? (the cursor is NOT blinking..might that mean it is frozen or something and needs activating via some special port first???)
By the way, the 'blinking cursor' is dependent on the computer you run it on. Most PCs will use a blinking cursor, Bochs won't blink, Virtual PC blinks, QEMU doesn't blink (uses same BIOS as Bochs).
Here's my cursor move routine (I'm sure it should be simple to convert to assembly):
/// Moves the cursor to the x and y member values
void Console::MoveCursor()
{
// offset
short offset = m_x + ( m_y * 80 );
// make sure that the cursor shows up as white (change the '7' to any other number under 0xF for a trippy cursor)
*(unsigned short*) ( 0xB8000 + ( offset * 2 ) ) = ( 0x07 << 8 ) | ' ';
// cursor offset, low byte to vga index reg
outportb( 0x3D4, 0x0F );
outportb( 0x3D5, (unsigned char) offset & 0xFF );
// cursor offset, high byte to vga index reg
outportb( 0x3D4, 0x0E );
outportb( 0x3D5, (unsigned char) ( offset >> 8 ) & 0xFF );
}
honestly i dont see the problem, as far as i see, my routine does exactly the same as yours..except i forget to set the attribute of the cursor..but the very fact that the cursor STAYS at the same position tells me that this is not the problem!
edit: SpooK, i just converted your routine into hla and it works...dont know whats the problem with mine though
looks like this now:
edit: SpooK, i just converted your routine into hla and it works...dont know whats the problem with mine though
Well for starters in your code you write EAX(32 bits) to the outport while spooks code write AL(8 bits) and only the latter is the correct version. If you write to ports use the bitdepth they specify otherwise you possibly overwrite the next port.