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