Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BITS 16
- header:
- jmp boot
- nop
- OEMLabel db "LABEL " ; Disk label
- BytesPerSector dw 512 ; Bytes per sector
- SectorsPerCluster db 1 ; Sectors per cluster
- ReservedForBoot dw 1 ; Reserved sectors for boot record
- NumberOfFats db 1 ; Number of copies of the FAT
- RootDirEntries dw 0 ; Number of entries in root dir
- ; (224 * 32 = 7168 = 14 sectors to read)
- LogicalSectors dw 2880 ; Number of logical sectors
- MediumByte db 0F0h ; Medium descriptor byte
- SectorsPerFat dw 9 ; Sectors per FAT
- SectorsPerTrack dw 18 ; Sectors per track (36/cylinder)
- Sides dw 1 ; Number of sides/heads
- HiddenSectors dd 0 ; Number of hidden sectors
- LargeSectors dd 0 ; Number of LBA sectors
- DriveNo dw 0 ; Drive No: 0
- Signature db 41 ; Drive signature: 41 for floppy
- VolumeID dd 00000000h ; Volume ID: any number
- VolumeLabel db "OS " ; Volume Label: any 11 chars
- FileSystem db "FAT12 " ; File system type: don't change!
- boot:
- mov ah, 02h
- mov al, 1 ; Num sectors to read
- mov ch, 0 ; Cylinder
- mov dh, 0 ; Head
- mov cl, 2 ; Sector
- mov dl, 0 ; Drive (0 is floppy)
- ; mov ax, 800h
- ; mov es, ax
- ; xor bx, bx
- xor ax, ax
- mov es, ax
- mov bx, 800h
- int 13h
- jnc goto_kernel
- mov dx, ax
- mov si, err_msg
- call print_string
- goto_kernel:
- jmp 800h
- loading_msg db 'Reading os from disk...', 0
- err_msg db 'An error occurred reading from disk :(', 0
- print_string: ; Routine: output string in SI to screen
- mov ah, 0Eh ; int 10h 'print char' function
- .repeat:
- lodsb ; Get character from string
- cmp al, 0
- je .done ; If char is zero, end of string
- int 10h ; Otherwise, print it
- jmp .repeat
- .done:
- ret
- times 510-($-$$) db 0 ; Pad remainder of boot sector with 0s
- dw 0xAA55 ; The standard PC boot signature
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement