分支到标签
我正在为一个简单的计算器编写 MIPS 代码,并且想知道如何根据用户输入分支到相应的函数。例如,如果用户希望将两个数字相加,您如何确保计算器跳转到加法标签,而不是乘法或减法?
I'm writing a MIPS code for a simple calculator, and was wondering how you branch to the corresponding function according to the user input. For example, if the user wishes to add two numbers, how would you make sure the calculator jumps to the add label, instead of perhaps the multiply or subtract?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将用户输入存入寄存器。
然后使用 beq 指令将其与第一个 ascii 值(例如“+”)进行比较。
Take user input into a register.
Then compare that to the first ascii value, say '+', using a beq instruction.