You have a few problems.
You are comparing
$t0
, which is the address of the current character, not the character itself. Move that test below thelb
line and test against$a0
.105
in ASCII isE
, noti
. Try151
(or to be more normal,0x69
).You want to compare with
beq
, notbneq
.Inside the loop, you should use syscall
11
, which prints a single character, rather than the current syscall4
you're using, which prints a string.Your program doesn't make an exit syscall (
10
) at the end.
You can look at this link for a list of syscalls.
Here's a complete working program for reference:
.data
msg: .asciiz "testing"
i: .asciiz "iiing"
.text
.globl main
main:
la $t0, msg
la $t1, i
li $t2, 0
loop:
lb $a0, ($t0)
beq $a0, 0x69, end
li $v0, 11
syscall
addi $t0, $t0, 1
b loop
end:
move $a0, $t1
li $v0, 4
syscall
li $v0, 10
syscall