1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| .eqv n, $s0 .eqv max, $s1 .eqv len, $s2 .eqv curr, $s3 .eqv last, $s4
.macro printInt(%int) move $a0, %int li $v0, 1 syscall .end_macro
.macro inputInt(%int) li $v0, 5 syscall move %int, $v0 .end_macro
.macro forLoop(%ct,%n,%startLabel,%endLabel) %startLabel: beq %ct, %n, %endLabel .end_macro
.macro forEnd(%ct,%startLabel,%endLabel) addi %ct, %ct, 1 j %startLabel %endLabel: .end_macro
li last, -1 li $t0, 0 inputInt(n) forLoop($t0,n,start,end) inputInt(curr) ble curr, last, less add len, len, 1 bge max, len, skip move max, len skip: j tail less: li len, 1 tail: move last, curr forEnd($t0,start,end)
printInt(max)
|