首页 > 解决方案 > 继续尝试在 0x00400098 处执行非指令

问题描述

.data
scores : .word 84 99 92 45 55 46 78 67 79
arraySize : .word 9
prompt1: .asciiz "Pleaes input a passing score(between 0 and 100) : "
prompt2: .asciiz "The number of students who passed this course is : "
.text

main:
li $v0,4
la $a0,prompt1 #it will print prompt
syscall
li $v0,5
syscall #ask user input
move $s2,$v0 #move to s2
la $s0,scores #get user address
lw $s1,arraySize #get array size

li $t7,0 #store passed count

li $t0,0
loop:
mul $t1,$t0,4
add $t1,$t1,$s0
lw $t1,($t1)
blt $t1,$s2,skipCount
add $t7,$t7,1 #increase count by one
skipCount:
add $t0,$t0,1
blt $t0,$s1,loop #loop until i<size


li $v0,4
la $a0,prompt2 #it will print prompt
syscall
li $v0,1
move $a0,$t7
syscall

此代码用于查找等于或高于及格分数的分数。它要求用户提供及格分数,然后给出数字。

即如果分数列表是:84、99、92、45、55、46、78、67、79

如果及格分数是 60,那么答案是 6。但是,当我编译它时,它给了我正确的答案,然后是“尝试在 0x00400098 处执行非指令”

怎么了?

标签: mipsqtspim

解决方案


推荐阅读