Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. section .text
  2. extern printf
  3. global _start ;must be declared for linker (ld)
  4. _start: ;tells linker entry point
  5. push ebp ;save the calling program base pointer (OS)
  6. mov ebp, esp ;creates a new entry for the program
  7. push msg ;pushes the memory address onto the stack
  8. call printf
  9. mov esp, ebp ;destroy stack frame and restores the pointer to OS
  10. pop ebp
  11. ret
  12. section .data
  13. msg db 'Hello, world!' , 10,0 ;string to be printed 10-return to next
  14. ;10 - return to next line, 0 end of message
  15. len equ $ - msg ;length of the string
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement