My program asks the user if the number he/she is thinking of is in a list. The user inputs a y or an n. How can I check if a user has entered y or n in assembly? Is it sufficient to put the user input into a register and branch if equal to 121 (decimal ASCII code for ‘y’) or branch if the value is equal to 110 (decimal ASCII code for ‘n’?
Thanks in advance
One can use the system call code for Read Character, which should be system call code 12, then the character (binary ASCII code) will be stored in $v0. Then you can make a register equal to 121 and another to 110. Then branch if equal.
SPIM system call codes:
http://www.doc.ic.ac.uk/lab/secondyear/spim/node8.html