Lost and Confuse

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
NokouT

Lost and Confuse

Post by NokouT »

Imagine crossing more than ten sites and dont have a minium ideia how to code a boot, the dealing is: I use some code for example of the boot but one of them work, i make the .asm to bin by nasm then format a: copy boot.bin to there and shutdown the system, turn on the computer and:
Non system disk...
I am relling frekyng so...
(1) Can i make in other language (not asm) a boot?
(2) If not can anyone put a code that with nasm i make him and in the code i just have to put the file that loads my SO?A very simple thing really...

Tks for all
Nice having a forum about SO  ;D
im_VLAVI

Re: Lost and Confuse

Post by im_VLAVI »

...just one thing: why do you format a: before coping bootsector?... the boot sector have to be in the first sector of the floppy ... maybe not, but if your are coping the bootsector using a floppy with filesystem you DON't PUT IT IN THE RIGHT PLACE!
you could use rawrite (WINDOWS) or dd in linux (dd if=file.bin of=/dev/fd0

...maybe this isn't your problem...
VLAVI

Re: Lost and Confuse

Post by VLAVI »

...and about making a bootsector: I think you must use ASM...
BLoggins02

Re: Lost and Confuse

Post by BLoggins02 »

Several things here:

1) (and I just can't believe no one has caught this yet), you CAN'T just copy boot.bin a: and expect it to work. ?Why? ?Because you need to copy boot.bin DIRECTLY to logical sector 1 (first physical sector on the disk). ?The copy command starts after that sector because it is reserved for the boot code/FAT signature. ?So: take your image and use rawrite or dd (on Unix) to make sure your boot code is copied where it's supposed to go.

2) Your bootsector must be EXACTLY 512 bytes, with the last two bytes being 0xaa55 for the boot signature. ?When the bios reads the first sector off the disk and finds this signature, it will load your boot code into memory and execute it. ?From there you can execute any code you want and utilize all of the BIOS services until such time as you want to jump into protected mode.

3) if you want to be able to read the disk from a windows system, you MUST do the following at the start of your bootcode:

jmp short bootup
nop

;; Put the fat parameter table here, look it up from a
;; bootsector written to be used on dos systems

bootup:

;; The rest of your code goes here

If you don't do this last thing, once you write your bootsector you will no longer be able to use or even read the disk in Win/DOS (not even in debug I don't think) because you've overwritten the part of the disk that tells DOS it's a FAT compatible disk.

If you need a well commented bootsector code, visit my website (look in the Sig)

Hope this helps you, I know this stuff can be frustrating,
Breckin
NokouT

Re: Lost and Confuse

Post by NokouT »

Tks for the info
But:

I pass the asm to bin file run rawrite...
Enter disk image source file name: boot.bin
Enter target diskette drive: a:
Please insert..
(Press enter)
Can?t figure out how many sectors/track for this diskette.

***
Try rawrite with my 6 disquettes and all them give me this error do you know anything about it?
beyondsociety

Re:Lost and Confuse

Post by beyondsociety »

IS it erroring out when it checks the sectors/tracks on diskette. normally it should ask you for:

Enter disk image source file name: boot.bin
Enter target diskette drive: a:
Please insert..
(Press enter)

and it should check the sectors/tracks and then say done. The only thing I can think of is that you either have a corrupt floppy disk and you should reformat it and re-run rawrite or you are not using the right version of rawrite. if this doesn't solve your problem, you might have something wrong with your bootsector that you are trying to copy to disk. I suggest looking at a tutorial on how to write a bootsector.
Post Reply