2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -0,0 +1,21 @@
.data
#.asciiz automatically adds the NULL terminator character, \0 for us.
string: .asciiz "Nice string you got there!"
.text
main:
la $a1,string #load the beginning address of the string.
loop:
lb $a2,($a1) #load byte (i.e. the char) at $a1 into $a2
addi $a1,$a1,1 #increment $a1
beqz $a2,exit_procedure #see if we've hit the NULL char yet
addi $a0,$a0,1 #increment counter
j loop #back to start
exit_procedure:
li $v0,1 #set syscall to print integer
syscall
li $v0,10 #set syscall to cleanly exit EXIT_SUCCESS
syscall