Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Loops MIPS中的延迟环_Loops_Assembly_Count_Mips_Pic32 - Fatal编程技术网

Loops MIPS中的延迟环

Loops MIPS中的延迟环,loops,assembly,count,mips,pic32,Loops,Assembly,Count,Mips,Pic32,我在编写将返回常量0x80000的延迟循环时遇到问题。输出应该像Hello,world!0 你好,世界!1. 你好,世界!2. ... 但是当我运行我的程序时,终端没有显示任何东西,即使我相信一声你好,世界!应该会出现。我试图通过调试代码来找出问题所在,但这似乎对我没有帮助。有没有关于如何解决这个问题的建议 .ent getDelay .text .global getDelay getDelay: addi $sp, $sp, -1 sw $ra, 0($sp) la $a0, helloS

我在编写将返回常量0x80000的延迟循环时遇到问题。输出应该像Hello,world!0 你好,世界!1. 你好,世界!2. ... 但是当我运行我的程序时,终端没有显示任何东西,即使我相信一声你好,世界!应该会出现。我试图通过调试代码来找出问题所在,但这似乎对我没有帮助。有没有关于如何解决这个问题的建议

.ent getDelay
.text
.global getDelay

getDelay:
addi $sp, $sp, -1
sw $ra, 0($sp)
la $a0, helloStr
lw $a1, counter 
jal printf
nop
lw $ra, 0($sp)
addi $sp, $sp, -1
lw $t0, ($a1)
addiu $t0, $t0,1
la $t1, counter
sw $t1, ($a1) 
$v0 = 0x80000
jr $ra

.end getDelay

.data
helloStr: .asciiz "Hello, world %d\n"
counter: .word 100
您应该仅以4字大小的倍数调整$sp。 您应该使用addiu$sp、$sp、-4和addiu$sp、$sp,4。 您正在递增$t0,但随后存储$t1。你不需要 la$t1,计数器,而不是sw$t1,$a1,您应该使用 sw$t0$a1。 $v0=0x80000不是指令,您可能需要li$v0, 0x80000。 如果这个函数本身应该有一些延迟,那么您需要 一个循环。