0

変換しようとしているコードは次のようになります。

 # 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:    ...

このコードで正しい方向に向かっているのか、最初からやり直す必要があるのか​​ を知りたかっただけです。ヒントやヘルプは大歓迎です。これが理解しにくい場合は、さらにコードを投稿できます。

4

0 に答える 0