forked from CompArchFA17/FinalProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootSector.asm
More file actions
48 lines (39 loc) · 1011 Bytes
/
Copy pathbootSector.asm
File metadata and controls
48 lines (39 loc) · 1011 Bytes
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
[org 0x7c00]
KERNEL_OFFSET equ 0x1000
mov [BOOT_DRIVE], dl ; BIOS sets boot drive
mov bp, 0x9000
mov sp, bp
mov bx, REAL_MODE
call print
call print_nl ; Print
call load_kernel ; Read kernel from disk
call switch_pmode ; Begin protected mode
jmp $ ; Never run but holds
%include "bootSectorPrint.asm"
%include "bootSectorPrintHex.asm"
%include "bootSectorDisk.asm"
%include "gdt.asm"
%include "print.asm"
%include "enter32.asm"
[bits 16]
load_kernel:
mov bx, LOAD_KERNEL
call print
call print_nl
mov bx, KERNEL_OFFSET ; Read from disk
mov dh, 2
mov dl, [BOOT_DRIVE]
call disk_load
ret
[bits 32]
BEGIN_PMODE:
mov ebx, PROTECTED_MODE
call print_pmode ; Print
call KERNEL_OFFSET ; Give kernel control
jmp $ ; Gain control from Kernel
BOOT_DRIVE db 0
REAL_MODE db "Real Mode", 0
PROTECTED_MODE db "Protected Mode", 0
LOAD_KERNEL db "Loading Kernel into Memory", 0
times 510 - ($-$$) db 0 ; Padding
dw 0xaa55