I'm getting an error which says MIPS: line 27: Runtime exception at 0x0040003c: address out of range 0x00000000. Don't really understand why

0

Write a MIPS assembly language program to count the number of occurrences of the lower-case "t" in a string. After running your code, the variable count (in memory) should contain the number of "t"'s in the string.

.text           
.globl main     

main:   la $s1, strA            
        la $s2, count          
        lbu     $s4, 0($s2)     
        add     $s3, $zero, $zero   
        addi    $t0, $zero, 116     
        add $t1, $zero, $zero   

loop: lbu   $s3, 0($s1)           
      addi  $s1, $s1, 1      
      beq   $s3, $t0, eqult     
      beq   $s3, $zero, strgend 
      j loop                

eqult:  addi $t1, $t1, 1       
        j loop             
strgend: sb $t1, 0($s4)                         

nop             

.data 0x10010000
strA:   .asciiz "the house on the left" 
count:  .byte 0
runtime
ascii
mips
memory-address
outofrangeexception
asked on Stack Overflow Sep 23, 2018 by brian012

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0