.data prompt: .asciiz "Enter an operation" buf: .space 10 # reserves 10 bytes .text .align 2 main: li $v0, 4 # syscall 4 is print string la $a0, prompt syscall li $v0, 8 # syscall 8 is read string la $a0,buf li $a1,2 # reads 1 char plus the null syscall # the first character is now at address buf lbu $t0,0($a0) # go get the first char jr $ra