-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootloader_simple.asm
More file actions
120 lines (99 loc) · 2.01 KB
/
Copy pathbootloader_simple.asm
File metadata and controls
120 lines (99 loc) · 2.01 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
; Aurora OS Bootloader with Kernel-like Features
org 0x7C00
bits 16
start:
; Set video mode to 80x25 text
mov ax, 3
int 0x10
; Clear screen with Aurora colors
mov ax, 0x0600
mov bh, 0x1F ; Blue background, white foreground
mov cx, 0x0000
mov dx, 0x184F
int 0x10
; Position cursor
mov ah, 0x02
mov bh, 0
mov dh, 0
mov dl, 0
int 0x10
; Print Aurora shell interface
mov si, banner
call print_string
mov si, prompt
call print_string
shell_loop:
; Wait for key press
mov ah, 0
int 0x16
; Echo character
mov ah, 0x0E
int 0x10
; Handle commands
cmp al, 0x0D ; Enter
je .newline
cmp al, 'q'
je reboot
cmp al, 'v'
je version
cmp al, 'h'
je help
; Continue loop
jmp shell_loop
.newline:
mov si, crlf
call print_string
mov si, prompt
call print_string
jmp shell_loop
reboot:
mov si, reboot_msg
call print_string
int 0x19
version:
mov si, version_msg
call print_string
mov si, prompt
call print_string
jmp shell_loop
help:
mov si, help_msg
call print_string
mov si, prompt
call print_string
jmp shell_loop
print_string:
pusha
.ps_loop:
lodsb
cmp al, 0
je .done
mov ah, 0x0E
mov bh, 0
int 0x10
jmp .ps_loop
.done:
popa
ret
; Messages
banner:
db "🌠 Aurora OS Shell v0.2.0", 0x0D, 0x0A
db "Commands: h=help, v=version, q=quit", 0x0D, 0x0A, 0
prompt:
db "aurora> ", 0
crlf:
db 0x0D, 0x0A, 0
help_msg:
db 0x0D, 0x0A, "Available commands:", 0x0D, 0x0A
db " h - This help", 0x0D, 0x0A
db " v - Show version", 0x0D, 0x0A
db " q - Reboot", 0x0D, 0x0A, 0
version_msg:
db 0x0D, 0x0A, "Aurora OS v0.2.0", 0x0D, 0x0A
db "Prototype Operating System", 0x0D, 0x0A
db "Built with NASM + Rust", 0x0D, 0x0A, 0
reboot_msg:
db 0x0D, 0x0A, "Rebooting...", 0x0D, 0x0A, 0
; Boot sector signature
times 510 - ($ - $$) db 0
dw 0xAA55