Page 1 of 1

hi.. a beginner need help

Posted: Wed Oct 16, 2002 7:23 pm
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

Re:hi.. a beginner need help

Posted: Wed Oct 16, 2002 8:07 pm
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.

Re:hi.. a beginner need help

Posted: Thu Oct 17, 2002 10:52 am
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.

Re:hi.. a beginner need help

Posted: Thu Oct 17, 2002 12:54 pm
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

Re:hi.. a beginner need help

Posted: Thu Oct 17, 2002 2:07 pm
by pskyboy
A very simple bootloader :)

Code: Select all

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

Re:hi.. a beginner need help

Posted: Thu Oct 17, 2002 2:24 pm
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. ;)

Re:hi.. a beginner need help

Posted: Thu Oct 17, 2002 2:26 pm
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]

Re:hi.. a beginner need help

Posted: Thu Oct 17, 2002 3:10 pm
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

Re:hi.. a beginner need help

Posted: Thu Oct 17, 2002 3:33 pm
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 ;)

Re:hi.. a beginner need help

Posted: Thu Oct 17, 2002 3:50 pm
by adeelmahmood1
alright i m checking the code and i m working on it ...
catch u later
thanx for ur help

Re:hi.. a beginner need help

Posted: Fri Oct 18, 2002 7:23 am
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...