global main section .data fmtString0: db `the number is %d\n`,0 fmtString: db `The numbers are: %d and %d, %s %d %d %d %d\n`,0 Message: db "Hello World!",0 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 extern printf main: push rbp ; this saves the base pointer on the stack mov rbp, rsp ; this makes the current stack pointer the base pointer sub rsp, 8 ; this makes the stack 16 bye alligned mov rdi, fmtString0 ; rdi is the first paramer to the printf fnction ; it need to hold the address of the format string mov rsi, 100 ; rsi is the second parameter to the printf function ; it holds the thing that matches the %d mov rax,0 ; this tells printf there are not floating point ; numbers call printf ; make a call to printf mov rsp, rbp ; restore the stack pointer pop rbp ; get rbp off the stack push rbp mov rbp, rsp sub rsp, 8 mov rdi, fmtString mov rsi, 1234 mov rdx, 4321 mov rcx, Message mov r8, 7777 mov r9, 888 push 99 push 100 mov rax, 0 call printf pop rax pop rax ;add rbp, 8 mov rsp, rbp pop rbp mov rax, SYS_EXIT ; system call for exit mov rdi, SUCCESS ; exit code 0 syscall