- You appear to be doing everything in
main
while just branching into single-character procedures. Consider renaming them to specify their purpose, while separating them frommain
with proper indentation and such. I cannot tell whatmain
should be doing by itself.You appear to be doing everything in
main
while just branching into single-character procedures. Consider renaming them to specify their purpose, while separating them frommain
with proper indentation and such. I cannot tell whatmain
should be doing by itself. I can just see that it prompts for user input and operates the two loops with its procedures. Since
prompt
is done first, consider defining it abovemain
instead. The end of the program should just display the result(s).
Structure
The register initializations should be placed above
main
for better visibility and maintainability.The loop labels barely stand out, and this really hurts structure. The loop procedures are all crammed together and
L1
looks like just another procedure. You could at least renameL1
andL2
toLoop1
andLoop2
respectively.The procedures should be properly indented to help them stay isolated.
P:
, for instance, hardly stands out:P: add $t1, $t1, $t5 # increment i move $t2, $t6 bgt $t1, $t0, E j L2
All of that could should be indented together and with
P:
on its own line:P: add $t1, $t1, $t5 # increment i move $t2, $t6 bgt $t1, $t0, E j L2