-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_kernel.asm
More file actions
65 lines (53 loc) · 1 KB
/
test_kernel.asm
File metadata and controls
65 lines (53 loc) · 1 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
; Simple test kernel for AtomicOS v5.2.1
[BITS 32]
[ORG 0x10000]
%define VGA_BUFFER 0xB8000
section .text
global _start
_start:
jmp kernel_main
kernel_main:
; Setup stack
mov esp, 0x90000
mov ebp, esp
; Clear screen
mov edi, VGA_BUFFER
mov ecx, 80 * 25
mov ax, 0x0720
rep stosw
; Print message
mov edi, VGA_BUFFER
mov esi, msg1
call print_string
; Print second line
mov edi, VGA_BUFFER + 160
mov esi, msg2
call print_string
; Print shell prompt
mov edi, VGA_BUFFER + 320
mov esi, prompt
call print_string
; Infinite loop (no interrupts)
.hang:
hlt
jmp .hang
print_string:
push eax
push esi
.loop:
lodsb
test al, al
jz .done
mov ah, 0x0F
stosw
jmp .loop
.done:
pop esi
pop eax
ret
section .data
msg1: db 'AtomicOS v5.2.1 - Test Mode', 0
msg2: db 'Shell ready (no keyboard yet)', 0
prompt: db 'atomicos> ', 0
; Pad to fill sector
times 512*64-($-$$) db 0