global main section .data message1: db "Hello World!", 0x0A message1_length: equ $ - message1 STDIN: EQU 0 STDOUT: EQU 1 STDERR: EQU 2 SYS_READ: EQU 0 SYS_WRITE: EQU 1 SYS_EXIT: EQU 60 SUCCESS: EQU 0 section .text main: ; store a big number in the entire register mov rax, 01111111111111111h ; store a smaller number in the lower 1/2 step1: mov eax, 022222222h ; store a smaller number in the lower 1/4 mov rax, 01111111111111111h mov ax, 03333h ; store a small number in the lower 1/8 mov rax, 01111111111111111h mov al, 044h ; store a small number in the second 1/8 mov rax, 01111111111111111h mov ah, 077h ; let's try some negative numbers mov rax, 01111111111111111h mov al, -1 mov rax, 01111111111111111h mov ax, -2 mov rax, 01111111111111111h mov eax, -3 mov rax, 01111111111111111h mov rax, -4 ; do a print to show the RAX register is wiped out after a system call mov rax, SYS_WRITE mov rdi, STDOUT mov rsi, message1 mov rdx, message1_length syscall ; exit the program properly mov rax, SYS_EXIT ; system call for exit mov rdi, SUCCESS ; exit code 0 syscall ; invoke operating system to exit