I am currently learing MIPS for a class and wrote the below sample code.
# UNTITLED PROGRAM
.data # Data declaration section
.text
main: # Start of code section
li $t1, 72
move $a0, $t1
li $v0,1
exit:
li $v0, 10
syscall
# END OF PROGRAM
As shown the value of ’72’ is stored in register $t1. Now, how do I parse out the ‘7’ and ‘2’ out?
Divide by 10, the modulo is your next digit, repeat until the result of division is 0. This assuming you’re not working with floating point numbers.