Advertisement
PauSix

PSP Hello World main.s Assembly

Jan 28th, 2018
661
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. # Module Info
  3.         .set push
  4.     .section .lib.ent.top, "a", @progbits
  5.     .align 2
  6.     .word 0
  7. __lib_ent_top:
  8.     .section .lib.ent.btm, "a", @progbits
  9.     .align 2
  10. __lib_ent_bottom:
  11.     .word 0
  12.     .section .lib.stub.top, "a", @progbits
  13.     .align 2
  14.     .word 0
  15. __lib_stub_top:
  16.     .section .lib.stub.btm, "a", @progbits
  17.     .align 2
  18. __lib_stub_bottom:
  19.     .word 0
  20.         .set pop
  21. .text
  22.     .globl  module_info
  23.     .section    .rodata.sceModuleInfo,"a",@progbits
  24.     .align  4
  25.     .type   module_info, @object
  26.     .size   module_info, 52
  27. module_info:
  28.     .half   0
  29.     .byte   0
  30.     .byte   1
  31.     .ascii  "HelloWorld\000"
  32.     .space  16
  33.     .byte   0
  34.     .word   _gp
  35.     .word   __lib_ent_top
  36.     .word   __lib_ent_bottom
  37.     .word   __lib_stub_top
  38.     .word   __lib_stub_bottom
  39.     .globl  sce_newlib_attribute
  40.     .section    .sdata,"aw",@progbits
  41.     .align  2
  42.     .type   sce_newlib_attribute, @object
  43.     .size   sce_newlib_attribute, 4
  44.  
  45. # Thread Attribute
  46. sce_newlib_attribute:
  47.     .word   -2147483648
  48.  
  49.  
  50. # Main Program
  51. .data
  52.     main_pspDebugScreenSetXY_001:   .asciiz "Hello, World!"
  53.  
  54. .text
  55.     .globl  main
  56.     .type main, @function
  57. main:
  58.     addiu $sp, $sp, -4                  # save main $ra
  59.     sw $ra, ($sp)
  60.    
  61.     jal setupExitCallback               # callback.h
  62.     nop
  63.    
  64.     jal pspDebugScreenInit              # pspdebug.h
  65.     nop
  66.    
  67. .loop0: # while loop
  68.         jal isRunning
  69.         nop
  70.        
  71.         bne $v0, 1, .e_loop0            # break on `isRunning() == 0`
  72.        
  73.         jal sceDisplayWaitVblankStart   # pspdisplay.h
  74.         nop
  75.        
  76.         jal pspDebugScreenClear         # pspdebug.h
  77.         nop
  78.        
  79.         li $a0, 0
  80.         li $a1, 0
  81.         jal pspDebugScreenSetXY         # pspdebug.h
  82.         nop
  83.        
  84.         la $a0, main_pspDebugScreenSetXY_001
  85.         jal pspDebugScreenPrintf        # pspdebug.h
  86.         nop
  87.        
  88.         j .loop0
  89.         nop
  90. .e_loop0:
  91.     jal sceKernelExitGame               # pspkernel.h
  92.     nop
  93.    
  94.     li $v0, 0                           # return 0;
  95.     lw $ra, ($sp)
  96.     addiu $sp, $sp, 4                   # pop $ra from stack
  97.     jr $ra
  98.     nop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement