.data str: .asciiz "Hello World and CS 447!\n" .text la $a0,str li $v0,4 syscall la $t0,str loop: lbu $t1,0($t0) beq $t1,$0,exit # if load char==null, then exit addi $t1,$t1,-32 # 32 is ASCII code for space bne $t1,$0,cont li $t1,'_' sb $t1,0($t0) # replace space with underscore cont: addi $t0,$t0,1 # next character j loop exit: la $a0,str li $v0,4 syscall li $v0,10 syscall