# Print the Hello World phrase. # # Here we load the base address of the string # into register $a0, and use the print_string # syscall to print the phrase. .data hello: .asciiz "Hello World\n" .text main: # Function prologue -- even main has one subu $sp, $sp, 24 # allocate stack space -- default of 24 here sw $fp, 0($sp) # save caller's frame pointer sw $ra, 4($sp) # save return address addiu $fp, $sp, 24 # setup main's frame pointer # set up $a0 to hold address of the hello world string # then print the string la $a0, hello # Point to the string li $v0, 4 # syscall value for print_string syscall done: # Epilogue for main -- restore stack & frame pointers and return lw $ra, 4($sp) # get return address from stack lw $fp, 0($sp) # restore the caller's frame pointer addiu $sp, $sp, 24 # restore the caller's stack pointer jr $ra # return to caller's code