Hello,
my friend and I are developing an OS and we need CODE examples(C and ASM) of configuring the GDT and the IDT correctly, and then using video and keyboard interrupts in the protected mode.
Thanks to all the forum.
Rafael Cordano
I admit that I've myself committed such mistakes and I was pointed to the beginner's mistakes page.
Well history repeats itself here you go :
http://wiki.osdev.org/Beginner_Mistakes
Believe me, there is no one that can give you something like this, what you're asking is somewhat like telling your friends do the homework for you.
Video and Keyboard Interrupts? Just like that?
A quote to make people understand :
One does not simply enable interrupts in Protected Mode.
It takes a bit more effort, at least more than writing a hello world application.
Writing to video memory is easy, you just need to write to 0xB8000, or 0xA0000 for VGA Graphic Modes. And this does NOT require interrupts.
I don't remember correctly but there is a formula to calculate the screen offset. If my memories are correct then it should be y * screen max y + screen max x + Video Memory location. So if you want to print 'A' at 6,9 on a 80x25 screen, it must be:
(9 * 25 + 6)decimal + 0xB8000.
If you write 'A' to this memory location it should print it at 6, 9.
For colored text, the high bits of any register should be the color (?), and the low bits should represent the character (?).
Something like :
Code: Select all
; AH should contain the color, green over white
mov ah, 0x2F
; AL should contain the character
mov al, 'A'
; Write to video memory
mov [0xB8000], ax
Not tested but it should work.
You can use variables, loops to make it print strings, move hardware cursor etc.
One more thing :
Thanks for make me the life harder.
OSDev is itself hard.
PS. The thread title is....
Hope this helps,
Bender/sid123