EDIT: I got the bootloader to work using copyboot, but now when I try to write the kernel to the floppy, the disk needs to be formatted, which gets me back to the start...

Hmm... Debug isn't working properly. After I enter w 100 0 1 1, it just keeps asking for more input.matias_beretta wrote:> format a:
> debug kernel.bin ;FIRST KERNEL
w 100 0 1 1
> debug boot.bin ;SECOND BOOT
w 100 0 0 1
Code: Select all
dd if=floppy.img of=/dev/fd0
Code: Select all
use16
org 0x7C00
boot: jmp near start
nop
;------------------------------------------;
; Standard BIOS Parameter Block, "BPB". ;
;------------------------------------------;
bpbOEM db 'MY OS'
bpbSectSize dw 512
bpbClustSize db 1
bpbReservedSec dw 1
bpbFats db 2
bpbRootSize dw 224
bpbTotalSect dw 2880
bpbMedia db 240
bpbFatSize dw 9
bpbTrackSect dw 18
bpbHeads dw 2
bpbHiddenSect dd 0
bpbLargeSect dd 0
;---------------------------------;
; extended BPB for FAT12/FAT16 ;
;---------------------------------;
bpbDriveNo db 0
bpbReserved db 0
bpbSignature db 41 ; 0 = nothing more. 41 = three more (below)..
bpbID dd 1
bpbVolumeLabel db 'BOOT FLOPPY'
bpbFileSystem db 'FAT12 '
;----------------------------------------;
; starting point of bootsector code ;
;----------------------------------------;
start:
Code: Select all
KERNEL_START equ 1 ; Disk block where kernel starts
KERNEL_SIZE equ 1 ; Kernel size in disk blocks
KERNEL_SEGMENT equ 1000h ; Segment where kernel will be loaded
; Load kernel
mov ax, 200h + KERNEL_SIZE
push word KERNEL_SEGMENT
pop es
xor bx, bx
mov cx, KERNEL_START + 1
mov dx, 0
int 13h
jnc ok
jmp $
ok:
; Jump to kernel
jmp KERNEL_SEGMENT:0
; Boot signature
times 510 - ($ - $$) db 0
db 55h
db 0aah
Ahh, yes, after fumbling around with it I figured that out and it works, great, now, I have to figure out how to make a batch file that can do that...matias_beretta wrote:i'm sorry i forgot 'q'
> format a:
> debug kernel.bin ;FIRST KERNEL
w 100 0 1 1
q
> debug boot.bin ;SECOND BOOT
w 100 0 0 1
q
Sounds like you need something like RawWrite (Microsoft OSs can't do it without additional utilities)...Bobalandi wrote:Ahh, yes, after fumbling around with it I figured that out and it works, great, now, I have to figure out how to make a batch file that can do that...
Code: Select all
KERNEL_START equ 1 ; Disk block where kernel starts
KERNEL_SIZE equ 1 ; Kernel size in disk blocks
KERNEL_SEGMENT equ 1000h ; Segment where kernel will be loaded
use16
org 0x7C00
boot: jmp near start
nop
;------------------------------------------;
; Standard BIOS Parameter Block, "BPB". ;
;------------------------------------------;
bpbOEM db 'MY OS'
bpbSectSize dw 512
bpbClustSize db 1
bpbReservedSec dw 1
bpbFats db 2
bpbRootSize dw 224
bpbTotalSect dw 2880
bpbMedia db 240
bpbFatSize dw 9
bpbTrackSect dw 18
bpbHeads dw 2
bpbHiddenSect dd 0
bpbLargeSect dd 0
;---------------------------------;
; extended BPB for FAT12/FAT16 ;
;---------------------------------;
bpbDriveNo db 0
bpbReserved db 0
bpbSignature db 41 ; 0 = nothing more. 41 = three more (below)..
bpbID dd 1
bpbVolumeLabel db 'BOOT FLOPPY'
bpbFileSystem db 'FAT12 '
;----------------------------------------;
; starting point of bootsector code ;
;----------------------------------------;
start:
; Load kernel
mov ax, 200h + KERNEL_SIZE
push word KERNEL_SEGMENT
pop es
xor bx, bx
mov cx, KERNEL_START + 1
mov dx, 0
int 13h
jnc ok
jmp $
ok:
; Jump to kernel
jmp KERNEL_SEGMENT:0
; Boot signature
times 510 - ($ - $$) db 0
db 55h
db 0aah
;PUT YOUR SECOND STAGE HERE *********************************