Non system disk error

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.
Pyrofan1
Member
Member
Posts: 234
Joined: Sun Apr 29, 2007 1:13 am

Non system disk error

Post by Pyrofan1 »

okay, so i'm trying to create my own bootloader
i have this code

Code: Select all

[BITS 16]	 ; 16 bit code generation
[ORG 0x7C00]	 ; ORGin location is 7C00

;Main program
main:		 ; Main program label
jmp main		 ; Put it into a coninuous loop to stop it running off into
		 ;  the memory running any junk it may find there.

; End matter
times 510-($-$$) db 0	; Fill the rest of the sector with zeros
dw 0xAA55		; Boot signature
and use
this script to assemble and put on a floppy

Code: Select all

nasm bootloader.s -f bin -o bootloader.bin
sudo dd if=bootloader.bin bs=512 count=1 of=/dev/fd0
but when i try to boot from the floppy i get "Non-System disk or disk error"
User avatar
omegaman
Posts: 3
Joined: Wed Mar 26, 2008 9:54 am

Post by omegaman »

I haven't looked for flaws in the dd statement, etc, but I would suggest you do a "sync" after the dd command.
/omegaman
Pyrofan1
Member
Member
Posts: 234
Joined: Sun Apr 29, 2007 1:13 am

Post by Pyrofan1 »

sync didn't help
jzgriffin
Member
Member
Posts: 190
Joined: Tue Sep 26, 2006 1:40 pm
Libera.chat IRC: Nokurn
Location: Ontario, CA, USA
Contact:

Post by jzgriffin »

Code: Select all

nasm bootloader.s -f bin -o bootloader.bin
dd if=/dev/zero of=floppy.img bs=512 count=2880
dd if=bootloader.bin of=floppy.img conv=notrunc
sudo dd if=floppy.img of=/dev/fd0 bs=512
Try that.
Pyrofan1
Member
Member
Posts: 234
Joined: Sun Apr 29, 2007 1:13 am

Post by Pyrofan1 »

That didn't work
User avatar
Masterkiller
Member
Member
Posts: 153
Joined: Sat May 05, 2007 6:20 pm

Post by Masterkiller »

BIOS should boot at 0x07C0:0x0000, not 0x0000:0x7C00 which makes the orign of the program 0.
ALCA OS: Project temporarity suspended!
Current state: real-mode kernel-FS reader...
jzgriffin
Member
Member
Posts: 190
Joined: Tue Sep 26, 2006 1:40 pm
Libera.chat IRC: Nokurn
Location: Ontario, CA, USA
Contact:

Post by jzgriffin »

I use ORG 0x7C00 in my bootsector and it works just fine. However, you could also do this:

Code: Select all

USE16
ORG 0x0000
JMP SHORT START

START:
MOV AX, 0x07C0
MOV DS, AX
MOV ES, AX
MOV FS, AX
MOV GS, AX
MOV SS, AX
MOV SP, 0x7C00 ; forgive me if this is wrong, I can never remember what to set sp to
JMP SHORT $

TIMES 510 - ($ - $$) DB 0x00
DW 0xAA55
(note: fasm syntax; replace USE16 with BITS 16 for nasm)

Also, could you do this, please?

Code: Select all

dd if=/dev/fd0 of=fd0.img
hexdump fd0.img
And then post the output.

One last thing, try writing to the floppy without bs=512.
Pyrofan1
Member
Member
Posts: 234
Joined: Sun Apr 29, 2007 1:13 am

Post by Pyrofan1 »

One last thing, try writing to the floppy without bs=512.
already tried it
And then post the output.
0000000 c0b8 8e07 8ed8 8ec0 8ee0 8ee8 bcd0 7c00
0000010 eeeb 0000 0000 0000 0000 0000 0000 0000
0000020 0000 0000 0000 0000 0000 0000 0000 0000
*
00001f0 0000 0000 0000 0000 0000 0000 0000 aa55
0000200 0000 0000 0000 0000 0000 0000 0000 0000
*
0168000
jzgriffin
Member
Member
Posts: 190
Joined: Tue Sep 26, 2006 1:40 pm
Libera.chat IRC: Nokurn
Location: Ontario, CA, USA
Contact:

Post by jzgriffin »

Are you booting the floppy physically or in an emulator? If emulator, post the command / configuration.
Pyrofan1
Member
Member
Posts: 234
Joined: Sun Apr 29, 2007 1:13 am

Post by Pyrofan1 »

physically
jzgriffin
Member
Member
Posts: 190
Joined: Tue Sep 26, 2006 1:40 pm
Libera.chat IRC: Nokurn
Location: Ontario, CA, USA
Contact:

Post by jzgriffin »

Try booting it in QEMU:

Code: Select all

qemu -fda floppy.img -boot a -m 4 -no-kqemu -localtime
Pyrofan1
Member
Member
Posts: 234
Joined: Sun Apr 29, 2007 1:13 am

Post by Pyrofan1 »

it works fine in qemu
jzgriffin
Member
Member
Posts: 190
Joined: Tue Sep 26, 2006 1:40 pm
Libera.chat IRC: Nokurn
Location: Ontario, CA, USA
Contact:

Post by jzgriffin »

Is your floppy disk and floppy drive bad?
Pyrofan1
Member
Member
Posts: 234
Joined: Sun Apr 29, 2007 1:13 am

Post by Pyrofan1 »

No
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

Pyrofan1 wrote:No
Stop waisting everyones time, clearly the problem is on your end.. :wink:
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
Post Reply