%include "MY_IO.h" global main ; c libary functions extern printf extern exit ; My functions extern PrintHello extern Newline extern PrintNumber extern AddEm extern PrintAndIncrement extern FillArray extern PrintArray ; from C extern CHello section .data format0 db `%s\n\n`,0 format1 db `%s %d\n`,0 message db "Hello World!",0 number1 dd 1234 callCount dd 0 count dd 0 section .bss array resd 10 section .text main: ; using printf to print hello world. mov rdi, format0 mov rsi, message mov eax, 0 call printf ; for i = 0; i < 3; ++i top: ; three paramters mov rdi, format1 mov rsi, message mov rdx, [count] mov eax, 0 call printf ; ++i mov rdi, [count] inc rdi mov [count], rdi cmp rdi,3 jle top ; some no paramter calls in c++ call Newline call PrintHello ; and in C call CHello ; a pass by value mov rdi, 100 call PrintNumber call Newline ; two paramters with a return value. mov rdi, 100 mov rsi, 200 call AddEm mov r14, rax call Newline ; and prove it worked mov rdi, r14 call PrintNumber call Newline ; pass by reference (well by pointer) mov rdi, callCount call PrintAndIncrement mov rdi, callCount call PrintAndIncrement mov rdi, callCount call PrintAndIncrement call Newline ; fill an array, pass the address and the size mov rdi, array mov rsi, 10 call FillArray call Newline ; print an array, pass the address and the size mov rdi, array mov rsi, 10 call PrintArray call Newline ; exit push 0 call exit