Bootloader 4 tutorial problem

If you are new to OS Development, plan on spending some time here first before going into the other forums.

Moderator:Moderators

Post Reply
kweicht
Posts:6
Joined:Sun Oct 05, 2008 7:09 am
Bootloader 4 tutorial problem

Post by kweicht » Sun Oct 05, 2008 7:15 am

I am having a problem getting tutorial 4 to work. This is the batch file I am using to build and set up the floppy:

Code: Select all

nasm\nasm.exe -f bin boot.asm -o boot.bin

partcopy boot.bin 0 200 -f0

nasm\nasm.exe -f bin stage2.asm -o stage2.sys

copy stage2.sys a:\stage2.sys

pause
This works fine, but it doesnt run correctly. I keep getting the "ERROR: Press any key to reboot" ...error. Even using Crypter's code does the same thing. Then I looked at his downloadable demo. His batch file uses

Code: Select all

PARTCOPY Boot1.bin 0 3 -f0 0 
PARTCOPY Boot1.bin 3E 1C2 -f0 3E 
That doesnt work for me. Partcopy complains that it cant write to dest offset. So I have two questions. 1. Why is he doing this anyway? I thought just copying the 512 bytes to the root was the solution. and 2. How can I fix it. Thank's a lot for any help.

Andyhhp
Moderator
Posts:387
Joined:Tue Oct 23, 2007 10:05 am
Location:127.0.0.1
Contact:

Post by Andyhhp » Sun Oct 05, 2008 11:08 am

hi,

There is no advantage to doing

Code: Select all

PARTCOPY Boot1.bin 0 3 -f0 0
PARTCOPY Boot1.bin 3E 1C2 -f0 3E 
over

Code: Select all

partcopy boot.bin 0 200 -f0 
so I would suggest you don't bother

As for the error, I assume thats an error from the bootloader and not from the BIOS. As Mike's code is doing this as well, it probably means there is something strange about the way your bios sets your computer up.

Can you post the specs please?

Andrew
Image

kweicht
Posts:6
Joined:Sun Oct 05, 2008 7:09 am

Post by kweicht » Sun Oct 05, 2008 7:44 pm

Well I am using the bochs emulator, but the specs of my machine are as follows:

Intel Core 2 Quad Q9550
DFI X48-T3RS MB
4GB DDR3
9800GX2
Windows XP SP3

Also, I'm using a virtual floppy drive.

User avatar
Mike
Site Admin
Posts:465
Joined:Sat Oct 20, 2007 7:58 pm
Contact:

Post by Mike » Sun Oct 05, 2008 8:10 pm

Code: Select all

partcopy boot.bin 0 200 -f0
This is what you should be using. The other PartCopy code is outdated and should not be used. It must have gotten skipped over by the last series revision. It doesnt really matter what you use, though.

The difference between the above and this:

Code: Select all

PARTCOPY Boot1.bin 0 3 -f0 0
PARTCOPY Boot1.bin 3E 1C2 -f0 3E 
...Is that the first method overwrite the Bios Parameter Block on disk while the second method does not.

You mentioned this is tutorial 4, but tutorial 4's demo does not include that error string (Nor has stage 2). Are you sure it was from tutorial 4?

kweicht
Posts:6
Joined:Sun Oct 05, 2008 7:09 am

Post by kweicht » Sun Oct 05, 2008 8:56 pm

I'm sorry. Bootloader 4. Tutorial 6.

User avatar
Mike
Site Admin
Posts:465
Joined:Sat Oct 20, 2007 7:58 pm
Contact:

Post by Mike » Sun Oct 05, 2008 10:13 pm

I'm sorry. Bootloader 4. Tutorial 6.
No worries :) I may need to create a better naming convention for the demos :D

In Stage1 the default image name to load is "KRNLDR.SYS", however you are using "Stage2.sys".

If you want to use Stage2.sys, you need to update this line with the new image name in Boot1.asm (Insure it is 11 characters):

Code: Select all

ImageName   db "KRNLDR  SYS"
...Or, just rename your output file from Stage2.sys to KRNLDR.SYS and it should work fine.

kweicht
Posts:6
Joined:Sun Oct 05, 2008 7:09 am

Post by kweicht » Sun Oct 05, 2008 11:23 pm

Wow, I feel dumb. Oh well, easy thing to miss. Thanks. :-)

Post Reply