我做了一些计算(甚至不确定它们是否接近准确,因为作业的说明是不存在的(感谢毫无价值的教授们)),但基本上我是在尝试计算$t2、$t3、$t4和$t5的值。将它们相加,然后将它们存储在$t6中,并将其打印到控制台。
这是我到目前为止所拥有的
li $v0,10
li $t1, 10
add $t2, $t1, $t1
sll $t3, $t1, 2
and $t4, $t1, 0x0000FFFF
or $t5, $t1, 0x0000FFFF发布于 2020-02-18 03:15:52
这应该可以完成这项工作。
.data ## Data declaration section
.text ## Assembly language instructions go in text segment
main: ## Start of code section
add $t1, $t2, $t3 # t1 = t2 + t3
add $t2, $t4, $t5 # t2 = t4 + t5
add $t6, $t2, $t1 # t6 = t1 + t2
move $a0, $t6 # a0 = t6
li $v0, 1 # system call code to print integer from a0
syscall # call operating system to perform operation
li $v0, 10 # terminate program
syscall找到了示例Hello World!程序在这里:https://courses.cs.vt.edu/cs2506/Fall2014/Notes/L04.MIPSAssemblyOverview.pdf
我是根据你的要求扩展的。
如果你在火星模拟器上运行,这段代码将输出0,因为t2,t3,t4,t5基本上都是0。
https://stackoverflow.com/questions/60268548
复制相似问题