Luna/apps/init.asm

65 lines
951 B
NASM
Raw Normal View History

2022-09-30 15:43:14 +00:00
section .text
global _start
_start:
mov rdi, welcome_label
call print
call next_line
mov rdi, 1000
call sleep
mov rdi, version_label
call print
call next_line
mov rdi, 2000
call sleep
mov rdi, end_label
call print
call exit
sleep:
mov rax, 2
int 42h
ret
strlen:
push rbx
push rcx
mov rbx, rdi
xor al, al
mov rcx, 0xffffffff
repne scasb
sub rdi, rbx
mov rax, rdi
pop rcx
pop rbx
dec rax
ret
print: ; string: rdi
push rdi
call strlen
mov rsi, rax
mov rax, 3
pop rdi
int 42h
ret
next_line:
mov rdi, newline
mov rsi, 1
mov rax, 3
int 42h
ret
exit:
2022-09-30 15:43:14 +00:00
mov rax, 0
int 42h
section .rodata
version_label:
db "You are running Luna version v0.7-beta", 0xA, 0
welcome_label:
db "Welcome to Luna!", 0xA, 0
end_label:
db "Press any key to restart.", 0xA, 0
newline:
db 0xA