MIPS汇编:无法存储/打印数组元素

时间:2017-05-11 09:16:31

标签: arrays assembly mips

我的Mips项目的第一部分是读取2个带有双重类型元素的2x2数组。我不确定我做错了什么,但是当我试图打印第一个数组的第二个元素时(只是为了检查它是否正常)我只得到零。可能是一个愚蠢的问题,但任何帮助将不胜感激。感谢

 .data

input1: .asciiz "a(1,1)="
input2: .asciiz "a(1,2)="
input3: .asciiz "a(2,1)="
input4: .asciiz "a(2,2)="

input5: .asciiz "b(1,1)="
input6: .asciiz "b(1,2)="
input7: .asciiz "b(2,1)="
input8: .asciiz "b(2,2)="

tableA: .space, 32
tableB: .space, 32
tableC: .space, 32

zeroasdouble: .double 0.0







.text

la $a0, tableA
la $a1, tableB
la $a2, tableC
l.d $f30, zeroasdouble

addi $t0, $zero, 0
addi $t1, $zero, 0
addi $t2, $zero, 0

add $t0, $a0, $zero   #tablea address goes to t0
add $t1, $a1, $zero   #tableb address goes to t1
add $t2, $a2, $zero   #tablec address goes to t2

#start reading values

addi, $v0, $zero, 4
la $a0, input1
syscall

addi $v0, $zero, 7
syscall
sdc1 $f0, 0($t0) ###### read float-store double in memory


addi, $v0, $zero, 4
la $a0, input2
syscall

addi $v0, $zero, 7
syscall
sdc1 $f0, 8($t0)#####

addi, $v0, $zero, 4
la $a0, input3
syscall

addi $v0, $zero, 7
syscall
sdc1 $f0, 16($t0)#####

addi, $v0, $zero, 4
la $a0, input4
syscall

addi $v0, $zero, 7
syscall
sdc1 $f0, 24($t0)##### table a filled-in

#fill-in table b

addi, $v0, $zero, 4
la $a0, input5
syscall

addi $v0, $zero, 7
syscall
sdc1 $f0, 0($t1)#####

addi, $v0, $zero, 4
la $a0, input6
syscall

addi $v0, $zero, 7
syscall
sdc1 $f0, 8($t1)#####

addi, $v0, $zero, 4
la $a0, input7
syscall

addi $v0, $zero, 7
syscall
sdc1 $f0, 16($t1)#####

addi, $v0, $zero, 4
la $a0, input8
syscall

addi $v0, $zero, 7
syscall
sdc1 $f0, 24($t1)#####

lwc1 $f12, 0($t0) ####delete test
li $v0, 3
syscall


addi $v0, $zero, 10
syscall

0 个答案:

没有答案