【问题标题】:MIPS operand of incorrect type error. Loading data into register错误类型错误的 MIPS 操作数。将数据加载到寄存器中
【发布时间】:2016-01-26 00:33:03
【问题描述】:

不正确类型错误的 MIPS 操作数。将数据加载到寄存器中

.data
    myMessage: .word 2
    myMessage2: .word 24
.text
    add $t0, $zero, myMessage 
    add $t1, $zero, myMessage2

为什么说类型不正确?我想既然 myMessage 是一个整数就可以了……(第一次使用 MIPS)

【问题讨论】:

    标签: load mips word operand


    【解决方案1】:

    从技术上讲,myMessage地址单词 2 所在的内存位置。

    MIPS 使用加载/存储架构,这意味着如果您想将内存中的某些数据用作操作数,您应该先将其加载到寄存器中:

    la $a0, myMessage   # Get the address
    lw $t0, ($a0)       # Get the value at that address
    

    如果汇编程序可以为您将其转换为正确的指令序列,您也许可以不写lw $t0, myMessage

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-07-03
      • 2017-01-18
      • 2018-12-04
      • 1970-01-01
      • 1970-01-01
      • 2015-01-18
      • 1970-01-01
      相关资源
      最近更新 更多