42 lines
485 B
NASM
42 lines
485 B
NASM
|
extern puts
|
||
|
|
||
|
section .data
|
||
|
text db "Bottom Text",10,0
|
||
|
section .text
|
||
|
global main
|
||
|
|
||
|
main:
|
||
|
sub rsp, 8
|
||
|
mov r9b, [text]
|
||
|
|
||
|
|
||
|
mov rax, 1 ;syscall 1
|
||
|
mov rdi, 1 ; arg 1 (stdout)
|
||
|
mov rsi, text ; the shit to print
|
||
|
mov rdx, 12 ; the length
|
||
|
syscall ;invoke
|
||
|
; ^^^^ is the linux syscall way of printing a string
|
||
|
|
||
|
mov r8b, [text]
|
||
|
add r8b, 1
|
||
|
mov [text], r8b
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
mov rdi, text
|
||
|
cld
|
||
|
call puts
|
||
|
|
||
|
add rsp, 8
|
||
|
ret
|
||
|
|
||
|
|
||
|
|
||
|
_end:
|
||
|
mov rax, 60 ; exit
|
||
|
mov edi, 1 ; error 1
|
||
|
syscall
|
||
|
|
||
|
|