MIPS分区的问题

MIPS分区的问题,mips,division,Mips,Division,我需要调试以下代码的帮助。我已经尝试了10次或更多次,但我仍然不明白为什么我会得到如此奇怪的输出,如下所示: Enter a: 5 Enter b: 2 a/b = 268501012 (<--- weird output) # task4partial.asm # Given positive integers a and b, output a/b and a%b. .data str1: .asciiz "Enter a: " str2: .asciiz "Enter b:

我需要调试以下代码的帮助。我已经尝试了10次或更多次,但我仍然不明白为什么我会得到如此奇怪的输出,如下所示:

Enter a: 5
Enter b: 2
a/b = 268501012 (<--- weird output)



# task4partial.asm
# Given positive integers a and b, output a/b and a%b.
  .data
str1: .asciiz "Enter a: "
str2: .asciiz "Enter b: "
str3: .asciiz "a/b = "
str4: .asciiz "a%b = "
newline: .asciiz "\n"
  .text

main: li   $v0, 4            # system call code for print_string
  la   $a0, str1         # address of str1
  syscall                # print str1

#get the first number from user, put it into $s0

li   $v0, 5            # system call code for read_int
  syscall                # read an integer into $v0 from console
  add  $s0, $v0, $zero   # copy $v0 into $s0 (a)


#read print_string for str2
li   $v0, 4            # system call code for print_string
  la   $a0, str2         # address of str1
  syscall                # print str1

# get second number from user, put it into $t1  
li  $v0, 5      #load syscall for read_int
syscall         #make the syscall
move $s1, $v0       #move the number read into $s1(b)

#do the calculations
div $s0, $s1        #diving $s0 by $s1
mflo    $t0         #storing value of lo(quotient) in
                #register $t0
mfhi    $t1         #storing value of hi(remainder) in
                #register $t1

#read print_string for str3
li   $v0, 4            # system call code for print_string
  la   $a0, str3         # address of str1
  syscall                # print str1   

#print a/b
li  $v0, 1      #load syscall print_int into $v0
move $t2, $t0       #move the number to print into $t2
syscall

#end of program
li  $v0, 10     #system call code for exit
syscall
输入a:5
输入b:2

a/b=268501012(错误在这一行:
移动$t2,$t0#将要打印的数字移动到$t2中
print_int syscall例程的参数必须放入
$a0
,而不是
$t2

谢谢!!!:)幸运的是你回答了,否则我仍然会被困在那里,试图找出我的代码出了什么问题!