HelloWorld.s 709 B

123456789101112131415161718192021222324252627282930
  1. @
  2. @ Assembler program to print "Hello World!"
  3. @ to stdout
  4. @
  5. @ R0-R2 - parameters to Linux function services
  6. @ R7 - Linux function number
  7. @
  8. .global _start @ Provide program starting
  9. @ address to linker
  10. @ Set up the parameters to print hello world
  11. @ and then call Linux to do it.
  12. _start: mov R0, #1 @ 1 = StdOut
  13. ldr R1, =helloworld @ string to print
  14. mov R2, #13 @length of our string
  15. mov R7, #4 @ Linux write system call
  16. svc 0 @ Call Linux to print
  17. @ Set up the parameters to exit the program
  18. @ and then call Linux to do it.
  19. mov R0, #0 @ Use 0 return code
  20. mov R7, #1 @ Sevice command code 1
  21. @ terminates the program
  22. svc 0 @ Call Linux to terminate
  23. .data
  24. helloworld: .ascii "Hello World!\n"