装配转换协助

时间:2013-03-15 19:42:34

标签: mips

这就是我试图转换的代码:

 # R = first number in input file - the upper bound on the rest of the
 #     numbers in the input file. If R = 100, then the rest of the
 #     input file must be non-negative integers < 100, and the last one < 0.
 # n = count of non-negative integers (except R) read from input.
 # n = size of arrays A and B, and R = size of array C.
 # for i = 0 to R-1
 #   C[i] = 0
 # end for

这些是我想要使用的寄存器:

 # $a0 = base address of array A (1st input in file)
 # $a1 = base address of array B (2nd input in file)
 # $a2 = base address of array C
 # $a3 = n, size of arrays A and B
 # $s0 = size of array C - upper bound on numbers (R)

 # $t0 = i
 # $t1 = j
 # $t2 = adress of C[i]

这是我目前还不确定如何格式化数组的地方:

 bucket:  li $t0,0        #set to 0/i
          li $t3,         #set to R
          sub  
          beq $t0,$t3,then#for loop
          add
          sll 
          sw $t2,
 then:    ...

我只是想知道我是否正在使用此代码朝着正确的方向前进,或者应该重新开始。非常感谢任何提示或帮助,如果难以理解,可以发布更多代码。

0 个答案:

没有答案