assembly - MIPS/QTSPIM 中的指令引用未定义错误

标签 assembly mips qtspim

我试图计算数组中的所有字符,但出现以下错误:

指令引用了 0x00400014 处 undefined symbol [0x00400014] 0x0c000000 jal 0x00000000 [主要] ; 188: 贾尔主要

.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 

最佳答案

.globl main 不定义符号,它只是将其标记为全局(如果将要定义)。您需要将 main: 标签添加到适当的位置,在您的情况下,这可能是第一条指令。

关于assembly - MIPS/QTSPIM 中的指令引用未定义错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26812502/

相关文章:

assembly - 使用 INT 21h (DOS) 和 8086 汇编读取数字

c - 浮点模运算

compiler-errors - .data 节中的 MIPS 编译器错误

assembly - mips 组件的字符串长度

assembly - 如何转换 Mips 伪指令?

assembly - Intel 64、rsi 和 rdi 寄存器

windows - 将 MASM 程序与链接导致错误加载 mspdbcore.dll(错误代码 : 193)

gcc - set_c0_status()函数在哪里定义的?

linux - 高网络流量时的 ksoftirqd 行为

使用数组将 C 代码转换为 MIPS 汇编语言