-1
I am a beginner in MIPS programming (I use MARS), my teacher asked us to do a program where given 9 digits of a CPF he calculates the last two digits of this CPF. The program is working, but my program crashes when I enter a letter, my teacher wants the program to treat when the user enters with a letter, but I don’t know how to do this, how do I compare the value typed by the user with all the letters of the alphabet? I could make a condition for each letter of the lower or upper case alphabet, but I don’t think this is the best way to do it.
The initial problem is that I use a "function" to read integers in the program, so if a letter is typed it gives a direct error.
li $v0, 5 #comando para ler um inteiro
syscall #chamando o sistema para executar as instruções
la $t2, 0($v0)
I use the above code, the check would come after it and I would compare the $t2 to know if it is a letter or not, but this code only works to read whole, so if I type a letter it stops immediately!
Thanks in advance for any tips you have to give me!