Guidelines undefined error in MIPS / QTSPIM

I am trying to count all the characters in an array and I had the following error:

Manual links undefined character at 0x00400014 [0x00400014] 0x0c000000 jal 0x00000000 [main]; 188: jal main

.data

 string:    .asciiz "nice work..."



  .text
 .globl main

  lw $a0,string
  jal strlength
  li $v0, 10
  syscall

   # METHOD STRLENGTH
   # Receives as first parameter the direction of the first character of string.
   # Returns the length of the string.

   strlength: li $t0, 0  #numero de caracteres
   lb $t4,string($t0)       #recorremos la cadena
   beqz $t4, fin            #si el caracter es igual a cero vamos a fin    
   addi $t0,$t0, 1      
   j strlength

   move $a0,$t0               #imprimimos numero de caracteres 
   li $v0, 1
   syscall 
   jr $ra 

      

+3


source to share


2 answers


.globl main

doesn't define a symbol, it just marks it as global if it ever gets defined. You need to add the label main:

to the appropriate place, which in your case will probably be the first instruction.



+7


source


You must change the settings of the simulator. Simulator -> Settings -> MIPS -> Exception Handler: Uncheck this "Load Exception Handler" option so that the native MIPS code is disabled and your own code works.



0


source







All Articles