有一个整数并在 MIPS 中打印出十六进制 [英] having an integer and printing out the hexadecimal in MIPS

查看:152
本文介绍了有一个整数并在 MIPS 中打印出十六进制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个整数,将整数打印为十六进制的代码行是什么?我知道您使用 34 作为命令,但我不确定其余部分

If I have an integer, what is the line of code(s) to print out the integer into hexadecimal? I know you use 34 as the command but im not sure about the rest of it

推荐答案

您所指的34"是 mars 模拟器中以十六进制打印整数"的系统调用号.

The "34" you're referring to is the syscall number for "print integer in hexadecimal" in the mars simulator.

系统调用参考是:http://courses.missouristate.edu/kenvollmar/mars/help/syscallhelp.html

假设您的号码在寄存器中,例如 $t5,则序列为:

Assuming your number was in a register, say, $t5, the sequence would be:

    move    $a0,$t5                 # put number into correct reg for syscall
    li      $v0,34                  # syscall number for "print hex"
    syscall                         # issue the syscall

这篇关于有一个整数并在 MIPS 中打印出十六进制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆