zettacode.files/hello_world.text/mips_assembly.txt in zettacode-0.1.0 vs zettacode.files/hello_world.text/mips_assembly.txt in zettacode-0.1.1
- old
+ new
@@ -1,12 +1,12 @@
-{{ |MARS}} {{ |SPIM}}
- .d #co fo dc vb
-: .cz "H !" #cz uc u . If ' .c ' .
+{{works with|MARS}} and {{works with|SPIM}}
+ .data #section for declaring variables
+hello: .asciiz "Hello world!" #asciiz automatically adds the null terminator. If it's .ascii it doesn't have it.
- . # b f c
-: # b, c c b u ju bc uc.
- $0, # f $0
- $0, 4 # c $0
- c # c
+ .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
- $0, 10 # c
- c # c
+ li $v0, 10 # set the syscall to exit
+ syscall # make the system call