-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathboot2.asm
More file actions
105 lines (73 loc) · 1.25 KB
/
boot2.asm
File metadata and controls
105 lines (73 loc) · 1.25 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
org 0x0500
jmp 0x0000:start
str_a db "Loading structures for the kernel...", 13, 10, 0
str_b db "Setting up protected mode...", 13, 10, 0
str_c db "Loading kernel in memory...", 13, 10, 0
str_d db "Running kernel...", 13, 10, 0
start:
xor ax, ax
mov ds, ax
mov si, str_a
mov cl, 0
print_str_a:
lodsb
cmp cl, al
je end_print_str_a
mov ah, 0xe
mov bl, 0xf
int 10h
jmp print_str_a
end_print_str_a:
mov si, str_b
print_str_b:
lodsb
cmp cl, al
je end_print_str_b
mov ah, 0xe
mov bl, 0xf
int 10h
jmp print_str_b
end_print_str_b:
mov si, str_c
print_str_c:
lodsb
cmp cl, al
je end_print_str_c
mov ah, 0xe
mov bl, 0xf
int 10h
jmp print_str_c
end_print_str_c:
; load kernel in memory
resetDisk:
mov ah, 0h
int 13h
jc resetDisk
readDisk:
mov bx, 0x7e0
mov es, bx
mov bx, 0h
mov ah, 2h ; read
mov al, 6h ; setors count
mov ch, 0h ; track
mov cl, 3h ; sector id
mov dh, 0h ; head
mov dl, 0h ; drive
int 13h
jc readDisk
; end load kernel in memory
mov si, str_d
mov cl, 0
print_str_d:
lodsb
cmp cl, al
je end_print_str_d
mov ah, 0xe
mov bl, 0xf
int 10h
jmp print_str_d
end_print_str_d:
; run kernel
jmp 0x7e0:0x0
; end run kernel
times 512-($-$$) db 0