mips - 继续尝试在 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 处执行非指令”
怎么了?
解决方案
推荐阅读
- c# - .NET 与 Mono WinForms - 实际表单大小,如呈现
- r - 如何将具有 POSIXct 日期的数据框转换为时间序列?
- r - 在谷歌地图上覆盖克里格数据时遇到问题
- javascript - 从 HTML 中删除多个元素的字符串
- html - 基于 url 或子目录突出显示当前导航选项卡
- php - 添加指向 scandir() 结果的链接
- java - Java & MongoDB - 如何在 MongoDB 文档中获取 _id 的值?
- google-cloud-sql - 如何将 datalab 与 Google Cloud SQL 连接起来?
- python - threading.Timer 用基本的清理控制杀死长时间运行的任务
- c++ - 如何在c ++中获取5到-5之间的随机数