x86_64-linux-asm/helloworld/hello.asm

48 lines
638 B
NASM
Raw Normal View History

2021-09-07 06:55:26 -04:00
section .data
text db 65,10
fuckvalue db 255
2021-09-07 19:58:21 -04:00
texthello db "hello world",10
2021-09-07 06:55:26 -04:00
section .text
global _start
_start:
2021-09-07 19:58:21 -04:00
mov r8b, [fuckvalue] ; put the shit in the register for later
mov r9b, [text]
mov rax, 1 ;syscall 1
mov rdi, 1 ; arg 1 (stdout)
mov rsi, text ; the shit to print
mov rdx, 2 ; the length
syscall ;invoke
2021-09-07 19:58:21 -04:00
cmp r8b, r9b
je _end
;inc text
2021-09-07 19:58:21 -04:00
mov r9b, [text]
inc r9b
mov [text], r9b
jmp _start
2021-09-07 06:55:26 -04:00
_end:
2021-09-07 19:58:21 -04:00
mov rax, 1 ;syscall 1
mov rdi, 1 ; arg 1 (stdout)
mov rsi, texthello ; the shit to print
mov rdx, 12 ; the length
syscall ;invoke
mov rax, 60 ; exit
mov edi, 1 ; error 1
syscall
2021-09-07 19:58:21 -04:00