# echo.spim --- Read and echo a line from the console. Demonstrates # syscalls for reading and writing strings. .data line: .space 80 prompt: .asciiz "Enter a line to be echoed.\n" nl: .asciiz "\n" .text .globl main main: li $v0, 4 # Syscall code for print string. la $a0, prompt # Starting address of string. syscall li $v0, 8 # Syscall code for read string. la $a0, line # Starting address of buffer. li $a1, 80 # Length of buffer. syscall li $v0, 4 la $a0, nl syscall li $v0, 4 la $a0, line syscall li $v0, 10 # Syscall code for exit. syscall