; =================================================================== ; Program: hello_word_nasm.asm ; Date: July 2020 ; Author: Jean-Michel Richer ; Email: jean-michel.richer@univ-angers.fr ; =================================================================== ; Description: ; This program is an assembly translation of the C Hello World ; program. ; =================================================================== global main extern printf ; =================================================================== ; ##### ## ##### ## ; # # # # # # # ; # # # # # # # ; # # ###### # ###### ; # # # # # # # ; ##### # # # # # ; =================================================================== section .data message: db "Hello World!", 10, 0 ; =================================================================== ; #### #### ##### ###### ; # # # # # # # ; # # # # # ##### ; # # # # # # ; # # # # # # # ; #### #### ##### ###### ; =================================================================== section .text ; ------------------------------------------------------------------- ; SUBPROGRAM ; ; int main(int argc, char *argv[]) ; ; DESCRIPTION ; ; Main subprogram that prints the string 'message' on standard ; output ; ; PARAMETERS ; ; argc int number of arguments of the program ; argv char *[] array of arguments as strings ; ; RETURN VALUE ; ; 0 if everything is ok, ; >0 if error ; ; ------------------------------------------------------------------- main: push ebp mov ebp, esp ; ; Code of subprogram ; push dword message call printf add esp, 4 xor eax, eax ; 0 of return 0 mov esp, ebp pop ebp ret