Advertisement
BaSs_HaXoR

Hello World PPC32 Assembly

Oct 18th, 2014
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #CREDITS: http://www.ibm.com/developerworks/library/l-ppc/
  2.  
  3.  
  4. .data                       # section declaration - variables only
  5.  
  6. msg:
  7.     .string "Hello, world!\n"
  8.     len = . - msg       # length of our dear string
  9.  
  10. .text                       # section declaration - begin code
  11.  
  12.     .global _start
  13. _start:
  14.  
  15. # write our string to stdout
  16.  
  17.     li      0,4         # syscall number (sys_write)
  18.     li      3,1         # first argument: file descriptor (stdout)
  19.                         # second argument: pointer to message to write
  20.     lis     4,msg@ha    # load top 16 bits of &msg
  21.     addi    4,4,msg@l   # load bottom 16 bits
  22.     li      5,len       # third argument: message length
  23.     sc                  # call kernel
  24.  
  25. # and exit
  26.  
  27.     li      0,1         # syscall number (sys_exit)
  28.     li      3,1         # first argument: exit code
  29.     sc                  # call kernel
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement