2022-09-30 15:43:14 +00:00
|
|
|
section .text
|
|
|
|
global _start
|
|
|
|
_start:
|
2022-10-01 13:54:42 +00:00
|
|
|
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:
|
2022-10-01 10:17:16 +00:00
|
|
|
mov rax, 2
|
2022-10-01 13:54:42 +00:00
|
|
|
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
|
2022-10-01 10:17:16 +00:00
|
|
|
mov rax, 3
|
2022-10-01 13:54:42 +00:00
|
|
|
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
|
2022-10-01 13:54:42 +00:00
|
|
|
int 42h
|
2022-10-01 10:17:16 +00:00
|
|
|
|
|
|
|
section .rodata
|
2022-10-01 13:54:42 +00:00
|
|
|
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
|