RosettaCodeData/Task/Hello-world-Text/MIPS-Assembly/hello-world-text.mips

12 lines
492 B
Text
Raw Permalink Normal View History

2016-12-05 22:15:40 +01:00
.data #section for declaring variables
hello: .asciiz "Hello world!" #asciiz automatically adds the null terminator. If it's .ascii it doesn't have it.
2013-04-10 21:29:02 -07:00
2016-12-05 22:15:40 +01:00
.text # beginning of code
main: # a label, which can be used with jump and branching instructions.
la $a0, hello # load the address of hello into $a0
li $v0, 4 # set the syscall to print the string at the address $a0
syscall # make the system call
li $v0, 10 # set the syscall to exit
syscall # make the system call