MIPS - 打印一个简单的双数组

时间:2016-09-07 10:46:35

标签: assembly double mips qtspim

我想打印一个双数组,这是我的简单代码:

    .data
    myarraydouble: .space 24
    newline: .asciiz "\n"
    .text
    main:

    addi $t0,$zero,0    #set counter to 0   
    li.d $f2, 1.393701  #$f2 = 1.393701
    li.d $f4, 2.393701  #$f4 = 2.393701
    li.d $f6, 3.393701  #$f6 = 3.393701
    addi $t2,$zero,0        #reset base address

    #store doubles into array
    swc1 $f2, myarraydouble($t2)
    addi $t2,$t2,8
    swc1 $f4, myarraydouble($t2)
    addi $t2,$t2,8
    swc1 $f6, myarraydouble($t2)

    #clear $t2 to 0
    addi $t2, $zero,0

    while:
    beq $t0,3, exit

    lwc1 $f8,myarraydouble($t2) #load register from RAM 

    addi $t2, $t2, 8    #base address +4

    #print current double
    li $v0,3
    mov.d $f12,$f8
    syscall

    #print new line
    li $v0,4
    la $a0,newline
    syscall
    addi $t0, $t0, 1    #counter +1

    j while

    exit:
    li $v0,10
    syscall

,输出为:

任何人都知道为什么我不能打印双倍值? 我不明白为什么我的双数字编码就是这样。

0 个答案:

没有答案