hi.. a beginner need help

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
adeelmahmood1

hi.. a beginner need help

Post by adeelmahmood1 »

hi
i have just started working on OS dev and well actually i m not exactly sure where to start .. i know c and c++ and a little bit understanding of assembly ... so would some body plz help n tell me what should i do right now .. should i try to write some thing or better look for info ...
thanx for ur help
PlayOS

Re:hi.. a beginner need help

Post by PlayOS »

Hi,

I personally feel that you should write something simple first, at least at the same time as reading info, I done this and it helps with motivation, because when you see something actually work the way it should, it just makes you want to keep going.

It did for me anyway. :)

I just got a simple real mode boot sector done and that was enough for me, I wanted to keep going and going and I am still going.

Some people say that you should just use a pre made boot loader like GRUB or something, but I reckon that is cheating, because you wont know what is actually happening.

Anyway that is my opinion, however GRUB is a good tool to use, it just robs you of some knowledge.
dronkit

Re:hi.. a beginner need help

Post by dronkit »

it all depends on what you're looking for when doing your OS.

if you just want to learn and know everything you can start from scratch (that is, writing your own bootsector and all). You will need some assembly and pc internal knowledge. it is fun ;)

If you just want to test some ideas, you can start direcly writing in C or C++, using some other bootloader or grub to load your kernel.
adeelmahmood1

Re:hi.. a beginner need help

Post by adeelmahmood1 »

hi
thanx for ur help ..
ok right now i m looking for a book which could help me and i have found out some books .. well i was hoping that if someone could show me a very very very simple bootstrap loader ... so that i could get an idea whats actually going on ...
i wont use ur loader but i wanna check what is this all about ... but plz it should be a very simple one .. even if it doesnt have much features but i just need to know what should be my approach..
thanx
pskyboy

Re:hi.. a beginner need help

Post by pskyboy »

A very simple bootloader :)

Code: Select all

[BITS 16]      ;Set code generation to 16 bit mode
dw 0xAA55
Ozguxxx

Re:hi.. a beginner need help

Post by Ozguxxx »

Code: Select all

[BITS 16]      ;Set code generation to 16 bit mode
dw 0xAA55
Will this work as a bootloader? (Just wondering...) Because it is only two bytes of code which corresponds to 0xaa55 insturction(whatever it is) I mean bios will not recognize this as a bootloader and it will give a nonsystem disk error. ;)
dronkit

Re:hi.. a beginner need help

Post by dronkit »

Actually it lacks of the first 510 bytes. Even that way it will do nothing but get loaded by the bios.

see if this helps you.

[attachment deleted by admin]
adeelmahmood1

Re:hi.. a beginner need help

Post by adeelmahmood1 »

hey
well i just wanted to knew that can u use any other language than C in OS dev or what .... its just a question .. and also that i can understand the a bootstrap loader loads our kernel .. but how does the C code works at that time coz there is no C compiler in the computer at that time ...
thanx for ur help
dronkit

Re:hi.. a beginner need help

Post by dronkit »

I'm not sure what you asked :P

anyway, yes. you can code your os in whatever language you want. assembler, c, c++, java, even basic. All options will need for sure some assembly code sooner or later.

i posted the code in my last message because you wanted to see some actual code for an actual bootloader. it is heavy commented so you can have an idea of what is going on when your power your pc ;)

in this case, there's some assembly code that "bootstraps" the c code. it loads it into memory and then jumps to it, giving it the control of the execution thread.

it is all c code from then on ;)
adeelmahmood1

Re:hi.. a beginner need help

Post by adeelmahmood1 »

alright i m checking the code and i m working on it ...
catch u later
thanx for ur help
Whatever5k

Re:hi.. a beginner need help

Post by Whatever5k »

but how does the C code works at that time coz there is no C compiler in the computer at that time ...
Well, we build our kernel in a existing Operating System with an existing compiler. For example, many people program/compile/link their kernel in Windows. So we have binary code that is output - the CPU understands this...
Post Reply