You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
test_repo/assemblyexample1.asm

31 lines
765 B
NASM

.global _start
//exposes a symbol called start to the assembler
.intel_syntax noprefix
//See: https://www.youtube.com/watch?v=6S5KRJv-7RU
//See: https://blog.rchapman.org/posts/Linux_System_Call_Table_for_x86_64/
_start:
//write call (sys_write)
mov rax,1
//sys_write system call
mov rdi, 1
//unsigned int fd = 1 (stdout)
lea rsi,[hello_world]
//load effective address (lea) into rsi of hello_world data
mov rdx, 14
//size_t count excluding null terminator
syscall
//exit call
mov rax, 60
mov rdi, 33
//return result (must be "rdi" not "rdx" - how are these registers named?)
syscall
//apprently int 80h interrupt is also syscall?
hello_world:
.asciz "Hello, World!\n"