-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboot.asm
More file actions
56 lines (45 loc) · 1.13 KB
/
boot.asm
File metadata and controls
56 lines (45 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
[org 0x7C00]
[bits 16]
jmp short start
nop
; FAT12 Headers
OEMIdentifier db "MYOS "
BytesPerSector dw 512
SectorsPerCluster db 1
ReservedSectors dw 1
FATCount db 2
RootDirEntries dw 224
TotalSectors dw 2880
MediaDescriptor db 0xF0
SectorsPerFAT dw 9
SectorsPerTrack dw 18
HeadsPerCylinder dw 2
HiddenSectors dd 0
LargeSectorCount dd 0
DriveNumber db 0
Reserved db 0
BootSignature db 0x29
VolumeID dd 0x12345678
VolumeLabel db "MYOS FLOPPY"
FileSystemType db "FAT12 "
start:
xor ax, ax
mov ds, ax
mov es, ax
mov ss, ax
mov sp, 0x7C00
mov [DriveNumber], dl ; Save boot drive
; Print loading message
mov si, msg_loading
call print_string
; Load kernel from sector 33 (LBA 33)
mov ax, 33 ; LBA = 33 (data region start)
mov cl, 1 ; Read 1 sector
mov bx, 0x7E00 ; Load kernel here
call disk_read
jmp 0x0000:0x7E00 ; Jump to kernel
%include "disk.asm"
%include "print.asm"
msg_loading db "Loading kernel...", 0xD, 0xA, 0
times 510 - ($ - $$) db 0
dw 0xAA55