| Download
Example of using NASM Netwide Assembler online via https://cocalc.com.
Project: public
Views: 65License: OTHER
Image: ubuntu2004
; ----------------------------------------------------------------------------------------1;2; From https://cs.lmu.edu/~ray/notes/nasmtutorial/3;4; Writes "Hello, World" to the console using only system calls. Runs on 64-bit Linux only.5; To assemble and run:6;7; nasm -felf64 hello.asm && ld hello.o && ./a.out8; ----------------------------------------------------------------------------------------910global _start1112section .text13_start: mov rax, 1 ; system call for write14mov rdi, 1 ; file handle 1 is stdout15mov rsi, message ; address of string to output16mov rdx, 13 ; number of bytes17syscall ; invoke operating system to do the write18mov rax, 60 ; system call for exit19xor rdi, rdi ; exit code 020syscall ; invoke operating system to exit2122section .data23message: db "Hello, World", 10 ; note the newline at the end242526