09-18-25 Lab 7

Coding in x86 Assembly (ASM)

Argument Registers
ID rax
1 rdi
2 rsi
3 rdx
4 r10
5 r8
6 r9

hello.asm

section .data
  text db "Hello, World!", 10

section .text
  global _start:

_start:
  # First run system call to print to screen
  mov rax, 1
  mov rdi, 1
  mov rsi, text
  mov rdx, 14
  syscall       # Goas and read the ID for rax, and other arguments
                # and then actually run that system call
  # Then exits the program
  mov rax, 60
  mov rdi, 0
  syscall

Install assembler:

sudo apt-get install nasm

In order to transfer that into an object file we need an assembler

nasm -f elf64 -o hello.o hello.asm