小编use*_*164的帖子

如何从MIPS程序集中的堆栈弹出?

我正在尝试学习MIPS汇编,因为我有一些空闲时间,而我正在尝试编写一个程序,将数字推送到堆栈,然后弹出它们.我希望它计算在达到负数之前弹出的数字的数量,然后每次得到负数时,保持计数弹出了多少负数和正数.

到目前为止我得到了这个:

 #count the number of negative words on the stock by poping the stack until a non-    negative word is found 
#and print out the number of words found

.text
.globl main
#this code reads the numbers from the data area and stores in them in a stack
#the numbers are located in the test area and the number of numbers in the num area

main:   la $t0, test
lw $t1, num
loop:   lw $t2,($t0)
sub $sp, $sp, 4 …
Run Code Online (Sandbox Code Playgroud)

stack mips

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

mips ×1

stack ×1