assemblyinputcharacterpcspim

checking Yes/No input for PCSpim


I am trying to figure out the best way to check user input in assembly language for PCSpim, for a programming assignment. Basically, I will prompt the user to enter whether or not they would like the display to be in ascending order. If they type "Y" the display will be in ascending order, but if they type "N" it will print in descending order.

Is there away to store "Y" and "N" into registers to check against their answer, or must it be a number stored in the register?

Other ideas are also appreciated. Thank you!


Solution

  • If you are reading a character, you presumably get the ascii code. As such, you should compare the input with the ascii code of Y and N. Depending on your assembler, you may be able to write constants such as 'Y' or 'N'. Otherwise you'll have to look the codes up in some ascii chart.