MIPS Assembly Multivariable Calculator
Source Code: asmcalc.s
This is a pretty interesting project that I worked on in university, a MIPS assembly application which handles delayed
branches/loads on bare mode. It reads the user input and performs up to five different operations; addition, subtraction,
multiplication, division, and modulus. The input can take any amount of variables with excess whitespace. For instance,
the following are valid inputs ("_" is a whitespace for demonstration):
To handle multiple operations, each inner operation is stored back into the user input as a signed 6 bit integer (-64 to 64). This is to take advantage of the extended ASCII range where English keyboards do not typically have characters for. When the program loops back over these stored numbers, it knows that this special number is greater than 127 (Extended ASCII) and changes it back to a "normalized" number for the next operation. This also distinguishes invalid input, in which the program will display an error message.
Examples of what this process looks like internally: