我想以这种方式打印星星图案:
******
*****
****
***
**
*
但它是这样打印的:
******
******
******
******
******
******
有人能帮我吗?这是我的密码:
main:
daddiu $sp,$sp,-48
sd $31,40($sp)
sd $fp,32($sp)
sd $28,24($sp)
move $fp,$sp
lui $28,%hi(%neg(%gp_rel(main)))
daddu $28,$28,$25
daddiu $28,$28,%lo(%neg(%gp_rel(main)))
sw $0,0($fp)
b .L2
nop
.L5:
li $2,6 # 0x6
sw $2,4($fp)
b .L3
nop
.L4:
li $4,42 # 0x2a
ld $2,%call16(putchar)($28)
move $25,$2
nop
lw $2,4($fp)
addiu $2,$2,-1
sw $2,4($fp)
.L3:
lw $2,4($fp)
bgez $2,.L4
nop
li $4,10 # 0xa
ld $2,%call16(putchar)($28)
move $25,$2
nop
lw $2,0($fp)
addiu $2,$2,1
sw $2,0($fp)
.L2:
lw $2,0($fp)
slt $2,$2,6
bne $2,$0,.L5
nop
nop
move $sp,$fp
ld $31,40($sp)
ld $fp,32($sp)
ld $28,24($sp)
daddiu $sp,$sp,48
j $31
nop
1条答案
按热度按时间s2j5cfk01#
嘿,可能是你正在做错误的设置循环在mips
未正确初始化内部循环
如果你正在转换c程序到mips比正确设置的限制内循环