MIPS, how can you compare a character taken from input?

My program asks the user if the number he / she thinks is on the list. The user enters y or n. How do I check if user y or n is entered in an assembly? Is it enough to enter the user in register and branch if it is 121 (decimal ASCII for "y") or branch if value is 110 (decimal ASCII for "n"?

Thank you in advance

+2


source to share


1 answer


It is possible to use the system call code for Read Character, which must be system code 12, then the character (binary ASCII code) will be stored in $ v0. Then you can make the register equal to 121 and the other to 110. Then branch if it is equal.



SPIM Call Codes: http://www.doc.ic.ac.uk/lab/secondyear/spim/node8.html

+1


source







All Articles