Page 1 of 2
Non system disk error
Posted: Fri Mar 28, 2008 12:24 pm
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"
Posted: Fri Mar 28, 2008 12:56 pm
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.
Posted: Fri Mar 28, 2008 1:15 pm
by Pyrofan1
sync didn't help
Posted: Fri Mar 28, 2008 1:31 pm
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.
Posted: Fri Mar 28, 2008 4:26 pm
by Pyrofan1
That didn't work
Posted: Fri Mar 28, 2008 4:47 pm
by Masterkiller
BIOS should boot at 0x07C0:0x0000, not 0x0000:0x7C00 which makes the orign of the program 0.
Posted: Fri Mar 28, 2008 6:30 pm
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.
Posted: Sat Mar 29, 2008 11:42 am
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
Posted: Sat Mar 29, 2008 12:15 pm
by jzgriffin
Are you booting the floppy physically or in an emulator? If emulator, post the command / configuration.
Posted: Sat Mar 29, 2008 12:37 pm
by Pyrofan1
physically
Posted: Sat Mar 29, 2008 12:38 pm
by jzgriffin
Try booting it in QEMU:
Code: Select all
qemu -fda floppy.img -boot a -m 4 -no-kqemu -localtime
Posted: Sat Mar 29, 2008 12:50 pm
by Pyrofan1
it works fine in qemu
Posted: Sat Mar 29, 2008 1:19 pm
by jzgriffin
Is your floppy disk and floppy drive bad?
Posted: Sat Mar 29, 2008 1:32 pm
by Pyrofan1
No
Posted: Sat Mar 29, 2008 3:09 pm
by Brynet-Inc
Pyrofan1 wrote:No
Stop waisting everyones time, clearly the problem is on your end..