Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Memory 如何在不使用la/li的情况下打印程序集中内存中的.word值_Memory_Assembly_Printing_Mips - Fatal编程技术网

Memory 如何在不使用la/li的情况下打印程序集中内存中的.word值

Memory 如何在不使用la/li的情况下打印程序集中内存中的.word值,memory,assembly,printing,mips,Memory,Assembly,Printing,Mips,如何在不使用la/li的情况下打印程序集中内存中的.word值?我只能使用基本功能。我可以打印.asciiz,但我不知道我做错了什么,因为它没有打印内存地址中的值(整数):( 这是我的代码,用于打印我的asciiz: lui $a0, 0x1001 addi $a0, $a0, 12 # set the address to my string location addi $v0, $0, 4 syscall 我写了相同的代码,除了不同的地址,但没有打印出任何内容。我也尝试搜索,但找不到这个

如何在不使用
la/li
的情况下打印程序集中内存中的.word值?我只能使用基本功能。我可以打印
.asciiz
,但我不知道我做错了什么,因为它没有打印内存地址中的值(整数):(

这是我的代码,用于打印我的
asciiz

lui $a0, 0x1001
addi $a0, $a0, 12 # set the address to my string location
addi $v0, $0, 4 
syscall
我写了相同的代码,除了不同的地址,但没有打印出任何内容。我也尝试搜索,但找不到这个问题的确切答案


请提供建议。如有任何帮助,将不胜感激。如果我有任何误解,请纠正我。提前谢谢。

您的代码中有几个错误

首先,如果要打印整数,应该使用syscall#1而不是#4

然后,如果要打印存储在内存中的整数,必须从内存中加载该字

您的代码应该如下所示:

  lw $a0, 0x100C   # Load the contents of word stored at address 0x1000 + 12
  addi $v0, $0, 1  # Set service #1 (which prints an integer)
  syscall          # Do the system call