OS dev

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.
Post Reply
rafaelcor
Posts: 4
Joined: Mon Jan 20, 2014 5:11 pm

OS dev

Post by rafaelcor »

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
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: OS dev

Post by Love4Boobies »

Wouldn't it be a good exercise to do it yourself? And even if you aren't up to the task, it might be a good exercise for... knowing where to look. ;)
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
rafaelcor
Posts: 4
Joined: Mon Jan 20, 2014 5:11 pm

Re: OS dev

Post by rafaelcor »

I want, but it's very difficult found manuals and more of this subject.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: OS dev

Post by Love4Boobies »

They're easy to find but you need to learn how to use Web search engines, like Google or Bing. Or did you really mean that you found those? If you did, what are you having problems with? Ask a question and we will answer.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
rafaelcor
Posts: 4
Joined: Mon Jan 20, 2014 5:11 pm

Re: OS dev

Post by rafaelcor »

Thanks for make me the life harder.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: OS dev

Post by Brynet-Inc »

rafaelcor wrote:Thanks for make me the life harder.
This may be why you're having trouble using search engines.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
Bender
Member
Member
Posts: 449
Joined: Wed Aug 21, 2013 3:53 am
Libera.chat IRC: bender|
Location: Asia, Singapore

Re: OS dev

Post by Bender »

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
"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
(R3X Runtime VM)(CHIP8 Interpreter OS)
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: OS dev

Post by Love4Boobies »

You may not realize this but it's you who is making your life harder.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
greyOne
Member
Member
Posts: 58
Joined: Sun Feb 03, 2013 10:38 pm
Location: Canada

Re: OS dev

Post by greyOne »

rafaelcor wrote:Thanks for make me the life harder.
OSDeving is hard bro, there aren't very many programming related fields that are harder than it. If you want to succeed, first prepare to fail. A lot. If you want to find material to work from, I suggest the linux kernel or something of the like; it works, it accessible, and the inner workings are so terribly formatted you are bound to make something better (I'm quite serious, the code looks atrocious).

Assuming you working with learned knowledge and not a simple copy-paste, when setting up interrupts, expect them to not work on your first try, triple fault on round two, hang your system (not just the VM, your local machine as well) on the third attempt, not show up at all on attempt number 4, and only after the first four failed attempts will they work properly. On the plus side, you'll now have an excellent understanding of what does what and how to do the whole thing properly next time. Be prepared for the long haul and a lot of frustration. Coffee and a pen and paper helps, on occasion.

As an aside, while I do support the idea that people should do their own research first, and that many questions can be answered on the wiki, this should in no way prevent the resulting responses from being polite or productive.
SpireOSDevTeam
Posts: 4
Joined: Sun Jan 05, 2014 4:20 am

Re: OS dev

Post by SpireOSDevTeam »

What do you think the point of OSDeving is about? The good part about it is to write your own code. The OSDev Wiki is what we use for ideas and tutorials for our OS.
User avatar
Bender
Member
Member
Posts: 449
Joined: Wed Aug 21, 2013 3:53 am
Libera.chat IRC: bender|
Location: Asia, Singapore

Re: OS dev

Post by Bender »

What do you think the point of OSDeving is about?
Now THAT makes me cry. :cry:
Why do you think we are exploring the space, inventing new things, discovering new secrets of nature,
etc.?
It's because of one characteristic that separates the human brain from all other animals,
It's called thinking.
We humans are much more curious than other organisms, let's take an example.
Suppose there is a watch lying in middle of the woods.
If a lion comes across that watch it may simply kick it off it's way, or it may play with it
for a while but it wouldn't care much and there is a 99.99 percent chance it would not even
remember it the next day.
But when a human comes across the watch he/she may wonder : "How can a watch be in the middle of all this grass, where did it come from, who does it belong to...."
The next day his/her friend tells him/her that he had lost his watch while walking around the woods.
What is going to be his/her reaction?
In the same way when we look at machines, operating systems, programs we wonder, "How do they work?"
At least for me it works like that don't know about you guys.
"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
(R3X Runtime VM)(CHIP8 Interpreter OS)
Post Reply