MIPS-如何减去(已使用的子不起作用!)

时间:2016-09-20 03:28:07

标签: mips

我的代码提供了不支持的R-Type,如何正确地减去它。尝试更改其他细节....已经尝试使用subu ..................................... .................................................. ........



.data
str:  .asciiz "\nHello World!\n"
# You can change what is between the  quotes if you like

.text
.globl main

main:
# Do the addition
# For this, we first need to put the values
# to add into registers  ($t0 and $t1)
li $t0, 30    # You can change the 10
li $t1, 20    # You can change the 20

# Now we can add the values in $t0
# and $t1, putting the result in special register $a0
sub $a0, $t0, $t1

# Set up for printing the value in $a0.
# A 1 in $v0 means we want to print an int
li $v0, 1

# The system call looks at what is in $v0
# and $a0, and knows to print what is in $a0
syscall

# Now we want to print Hello World
# So we load the (address of the) string into $a0
la $a0, str

# And put a 4 in $v0 to mean print a string
li $v0, 4

# And just like before syscall looks at
# $v0 and $a0 and knows to print the string
syscall

# Nicely end the program
li $v0, 0
jr $ra




1 个答案:

答案 0 :(得分:1)

您的程序在import serial ser = serial.Serial(port='/dev/ttyUSB0', baudrate=9600) ser.write('0') print ser.readline() tk.iconify()模拟器中运行良好,但除外,用于程序终止。这些模拟器没有设置mars,因此它为零。所以,最后,你会回到可能有半随机指令的东西,包括非法指令。因此,根本不是 你的spim就是问题所在。这是后来发生的事情。

变化:

$ra

分为:

sub