forked from ArTicZera/NovaOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboot.asm
68 lines (47 loc) · 1.28 KB
/
boot.asm
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
57
58
59
60
61
62
63
64
65
66
67
68
[BITS 16]
[ORG 0x7C00]
%define KERNEL 0x7E00
BootMain:
;Setup Data
cli
cld
xor ax, ax
mov ds, ax
mov es, ax
;Setup Stack
mov sp, 0x7C00
mov ss, ax
sti
;Setup VESA (640x480 8bpp)
mov ax, 0x4F02
mov bx, 0x4101
int 0x10
call ReadSectors
call SetupGDT
jmp CODESEG:pmode
;---------------------------------------
ReadSectors:
mov cx, 10 ; counter
.loop:
push cx
mov ah, 0x42
mov si, DAP
int 0x13
add dword [DAP + 8], 127
add word [DAP + 6], 0xFE0
pop cx
loop .loop
ret
align 4
DAP:
db 0x10 ;DAP byte [dap+0]
db 0x00 ;Unused byte [dap+1]
dw 0x7F ;Sectors byte [dap+2]
dw 0x0000 ;Segment byte [dap+3] byte [dap+4]
dw KERNEL >> 4 ;Offset word [DAP+6]
dq 1 ;LBA word [DAP+8]
;---------------------------------------
%include "Bootloader/gdt.asm"
%include "Bootloader/pmode.asm"
times 510 - ($ - $$) db 0x00
dw 0xAA55