-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootloader-simple.asm
More file actions
87 lines (71 loc) · 1.3 KB
/
Copy pathbootloader-simple.asm
File metadata and controls
87 lines (71 loc) · 1.3 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
; Aurora OS Bootloader - Simple version
; Loads kernel and jumps to it in real mode
org 0x7C00
bits 16
start:
jmp main
main:
; Setup
cli
xor ax, ax
mov ds, ax
mov es, ax
mov ss, ax
mov sp, 0x7C00
sti
mov [boot_drive], dl
; Clear screen
mov ax, 0x0003
int 0x10
mov ax, 0x0600
mov bh, 0x1F
xor cx, cx
mov dx, 0x184F
int 0x10
; Loading message
mov si, loading_msg
call print_str
; Try to load kernel
mov bx, 0x1000
mov ah, 0x02
mov al, 4
mov ch, 0
mov cl, 2
mov dh, 0
mov dl, [boot_drive]
int 0x13
jc disk_error
; Success message
mov si, success_msg
call print_str
; Simple delay
mov cx, 0xFFFF
.delay:
dec cx
jnz .delay
; Jump to kernel directly in real mode
jmp 0x1000
disk_error:
mov si, error_msg
call print_str
call wait_key
int 0x19
print_str:
lodsb
test al, al
jz .done
mov ah, 0x0E
int 0x10
jmp print_str
.done:
ret
wait_key:
mov ah, 0
int 0x16
ret
loading_msg: db "Loading Aurora...", 0x0D, 0x0A, 0
success_msg: db "Starting kernel...", 0x0D, 0x0A, 0
error_msg: db "Disk error!", 0x0D, 0x0A, 0
boot_drive: db 0
times 510 - ($ - $$) db 0
dw 0xAA55