Boot Loader Don't Boot

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.
User avatar
ehenkes
Member
Member
Posts: 124
Joined: Mon Mar 23, 2009 3:15 am
Location: Germany
Contact:

Re: Boot Loader Don't Boot

Post by ehenkes »

I'm learning Assembly and i'm trying to develop my own boot loader for my OS that is only a test to build something big ...
Programming bootloaders is not easy. Hence, you should use GRUB (an easy way) or look at some existing bootloaders. I have adapted the two stages of http://www.brokenthorn.com to my own OS:
http://www.henkessoft.de/OS_Dev/OS_Dev3 ... ocId119944
http://www.henkessoft.de/OS_Dev/OS_Dev3 ... ocId575832
User avatar
kop99
Member
Member
Posts: 120
Joined: Fri May 15, 2009 2:58 am

Re: Boot Loader Don't Boot

Post by kop99 »

Think of famous people like Bill Gates et al. (MS DOS, MS Windows), Linus Torvalds (Linux), Andrew Tanenbaum (Minix <== famous).
Does Bill Gates develop MS Windows????? :(
PatrickV
Member
Member
Posts: 151
Joined: Sun Jul 06, 2008 7:50 pm
Location: New Zealand
Contact:

Re: Boot Loader Don't Boot

Post by PatrickV »

Nathan wrote:

Code: Select all

> DEBUG os-test.asm
-w 100 0 0 1
-q
What i'm doing wrong?
Here is the problem. The bootloader is surpose to be on the first sector or something pointing 2 it. what you have written is -w 100 0 0 1 which is not the first sector. The first sector is address at -w 0 0 0 1. That might of been the proble which your booloader doesn't work

Patrick
User avatar
neon
Member
Member
Posts: 1568
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: Boot Loader Don't Boot

Post by neon »

Hello,
Here is the problem. The bootloader is surpose to be on the first sector or something pointing 2 it. what you have written is -w 100 0 0 1 which is not the first sector. The first sector is address at -w 0 0 0 1. That might of been the proble which your booloader doesn't work
w 100 0 0 1 is fine. Debug loads the program binary to offset 0x100 (typical of COM programs). w 100 0 0 1 tells debug to copy a sector from 0x100 (where the loaded file is) into disk 0 (floppy disk) sector 1 (bootsector).

Probably the bigger problem is that he has debug load os-test.asm as the "assembled" bootsector.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
User avatar
quanganht
Member
Member
Posts: 301
Joined: Fri May 16, 2008 7:13 pm
Location: Hanoi, Vietnam

Re: Boot Loader Don't Boot

Post by quanganht »

Nathan wrote:And here is the process to that i use to write in the floppy:

Code: Select all

> DEBUG os-test.asm
-w 100 0 0 1
-q
What i'm doing wrong?
I nearly had to shout: "OMFG! WTF ?". Can't you guys see an serious mistake here?

He have to compile that os-test.asm to something like os-test.bin and then

Code: Select all

> DEBUG os-test.bin
-w 100 0 0 1
-q
EDIT: Oh I forgot, and he must compile it to binary format (NASM default anyway)
"Programmers are tools for converting caffeine into code."
PatrickV
Member
Member
Posts: 151
Joined: Sun Jul 06, 2008 7:50 pm
Location: New Zealand
Contact:

Re: Boot Loader Don't Boot

Post by PatrickV »

Another thing that cause this if you don't write it correctly which i found out can be a problem. I personly copy the cmd program and put it in the code directory. When you write the code to the disk you should have something like this:

C:\CodeDir>
C:\CodeDir> DEBUG os-test.asm
-w 100 0 0 1
-q

You must have the cmd program inside the CodeDir or pointing to that which if don't do so my bootloaders or code won't be written to disk. Try that if it works problem solve if not, i don't know.
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: Boot Loader Don't Boot

Post by Troy Martin »

What the crap does having CMD.EXE in his directory have to do with that? He tried to write his unassembled source file to the bootsector, no more, no less.
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
Post Reply