1
我喜欢通过系统调用的装置,以使与MIPS的阵列,但我得到的错误错误d:在0x00400028运行时异常:\ MIPS \创建阵列线20请求(1074003968)超过可用堆存储(系统调用9)。错误创建阵列MIPS
矿代码:
.data
question1_msg: .asciiz "How much integer do you want to give?\n"
question2_msg: .asciiz "give a number?\n"
.text
question_numbers:
la $a0, question1_msg #load the question in $a0
li $v0, 4
syscall
answer_numbers:
li $v0, 5 #read the anwser of previous question
syscall
move $t0, $a0
generate_array:
sll $t0, $t0, 2 #create array
move $a0, $t0
li $v0, 9
syscall
move $t3, $v0 #put the stack pointer in a temperay register
add_numbers_array:
bge $t1, $t0, exit # if $t1 > $t0 then exit
#ask questions
la $a0, question2_msg #load the question in $a0
li $v0, 4
syscall
#read numbers
li $v0, 5
syscall
move $t2, $a0
#add number en go to the next array point
sw $t2, ($t3)
add $t3, $t3, 4
#get back to the begin of the loop
b add_numbers_array
exit :
li $v0 , 10 # let the code end
syscall
非常感谢,这是由矿方一个很大的错误。现在这个问题几乎可以解决 – Bjorn