小编mol*_*r20的帖子

MIP 程序使用堆栈反转字符串

当我运行我的程序时出现错误。这是我收到的错误。

我收到异常错误。错误提示“数据/堆栈读取中的地址错误”

错误提示“指令引用未定义的符号”

在控制台中显示“要反转的字符串:

COSC 300 异常 7 [错误数据地址] 发生并被忽略

该程序

.data

str: .asciiz "String to be reversed : \n" 
msg: .asciiz "COSC 300" 
ans: .asciiz "The string reversed is : " 

.text
.globl main



main: 

la $a0, str            #print string
li $v0, 4 
syscall

la $a0, msg            #print string
li $v0, 4
syscall

la $t0, msg            #load a string to be reversed



loop:
lb $t0, 0 ($t0)       #load char from msg
beqz $t0, stringEnd   # if null end loop …
Run Code Online (Sandbox Code Playgroud)

assembly mips

3
推荐指数
1
解决办法
7702
查看次数

标签 统计

assembly ×1

mips ×1