fork download
  1. global _start
  2.  
  3. ; The data section is used for declaring initialized data or constants.
  4. ; This data does not change at runtime.
  5. ; You can declare various constant values, file names or buffer size etc. in this section.
  6. section .data
  7. msg db 'Hello World!', 0xa ; Hello World message.
  8. msglen equ $ - msg ; length of the Hello World message.
  9. mydate dw "06-Jan-2024 07:55 AM", 0xa ; Today's Date.
  10. mydatelen equ $ - mydate ; Length of mydate variable.
  11.  
  12. ; The bss section is used for declaring variables.
  13. section .bss
  14.  
  15.  
  16. ; The text section is used for keeping the actual code.
  17. ; This section must begin with the declarationglobal main,
  18. ; which tells the kernel where the program execution begins.
  19. section .text
  20.  
  21. _start:
  22. ; Print message "Hello World".
  23. mov edx, msglen ; message length
  24. mov ecx, msg ; message to write
  25. mov ebx, 01h ; file descriptor (stdout)
  26. mov eax, 04h ; system call number (sys_write)
  27. int 0x80 ; call kernel
  28.  
  29. ; Print current system date.
  30. mov edx, mydatelen ; message length
  31. mov ecx, mydate ; message to write
  32. mov ebx, 01h ; file descriptor (stdout)
  33. mov eax, 04h ; system call number (sys_write)
  34. int 0x80 ; call kernel
  35.  
  36. jmp exit
  37.  
  38. exit:
  39. mov eax, 01h ; exit()
  40. xor ebx, ebx ; errno
  41. int 80h
  42.  
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
Hello World!
06-Jan-2024 07:55 AM