Yes. It works.
Why do I need that "add esp, 2*4"?
You pushed two times before you called printf.
push eax
push msg
call printf
printf is CDECL, so you need to restore or pop pushed items of the stack.
1. Restore stack pointer after CDECL procedure like printf was called:
add esp, 2*4
OR this also should do the trick, if eax is not needed:
2. Restore stack pointer after CDECL procedure like printf was called:
pop eax
pop eax
OR
3. Restore stack pointer after CDECL procedure like printf was called:
add esp,4
add esp,4
* Error in early code was caused because you didn't knew that printf is CDECL.
So, read, find info about x86 calling convetions (CDECL/STDCALL/Other) or use my links above.
Bye!