嵌套for循环以创建直角MIPS装配体

时间:2018-10-01 16:09:17

标签: assembly output mips nested-loops

我能够使程序打印出正确数量的符号,但是我在用它绘制直角三角形时遇到困难。它应该下降5,有人有什么建议吗?

    .data
one:    .word 1     # Constant 1
newline: .asciiz "\n"

    .text
li  $t1, 1      # $t1 holds i
li  $t2, 10     # $t2 holds j
li  $t3, 0      # $t3 holds k
lw  $t4, one

L1: 
bgt $t1, $t2, DONE  # branch if ! ( i < j )
addi $t3, $t3, 1    # k++

li $a0, 36      # PRINT $ using 36 ASCII for $
li $v0, 11  
syscall

li $v0, 4
la $a0, newline
syscall

add $t1, $t1, $t4   # i = i + 1
j L1            # jump back to top of loop

DONE:

0 个答案:

没有答案