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, 0 ; Hello World message.
  8. ; 0xA (10) is hex for (NL), carriage return
  9. ; 0 terminates the line
  10. msglen equ $ - msg ; length of the Hello World message.
  11.  
  12. mydate dw "06-Jan-2024 07:55 AM", 0xA ; Today's Date.
  13. mydatelen equ $ - mydate ; Length of mydate variable.
  14.  
  15. ; The bss section is used for declaring variables.
  16. section .bss
  17.  
  18.  
  19. ; The text section is used for keeping the actual code.
  20. ; This section must begin with the declarationglobal main,
  21. ; which tells the kernel where the program execution begins.
  22. section .text
  23.  
  24. _start:
  25. ; Print message "Hello World".
  26. mov edx, msglen ; message length
  27. mov ecx, msg ; message to write
  28. mov ebx, 01h ; file descriptor (stdout)
  29. mov eax, 04h ; system call number (sys_write)
  30. int 0x80 ; call kernel
  31.  
  32. ; Print current system date.
  33. mov edx, mydatelen ; message length
  34. mov ecx, mydate ; message to write
  35. mov ebx, 01h ; file descriptor (stdout)
  36. mov eax, 04h ; system call number (sys_write)
  37. int 0x80 ; call kernel
  38.  
  39. jmp exit
  40.  
  41. exit:
  42. mov eax, 01h ; exit()
  43. xor ebx, ebx ; errno
  44. int 80h
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
Hello World!
06-Jan-2024 07:55 AM