SPIM code for "hello world" program
# This is a simple program to print hello world
# a comment starts with a # till the end of the line
.data # start putting stuff in the data segment
greet: .asciiz "Hello world\n" # declare greet to be the string
.text # start putting stuff in the text segment
main: # main is a label here. Names a function
li $v0, 4 # system call code for print_str(sect1.5 appen)
la $a0, greet # address of string to print
syscall # print the string
jr $ra # return from main
# here li is load immediate into an integer register
# la is load computed address into an integer register
# jr is standard return from function call...$ra contains return
# address