MIPS won't print out the buffer content

1.7k views Asked by At

i am trying to read the text from the input file, store it in the buffer and then print it out. i am pretty sure my code is correct and the mars.jar file is in the same directory with the .s and .txt files. could anyone please help me figure out why it wont print out the text?

here's the code:

.data

    buffer: .space 1024
    inputFile: .asciiz "aufgabe1.txt"    

.text

main:   

    #open file

    li $v0, 13      #syscall for open file
    la $a0, inputFile   #input file name     
    li $a1, 0       #read only
    li $a2, 0       #mode is ignored
    syscall
    move $s0, $v0       # save the file descriptor 


    #read from file

    li $v0, 14      #syscall for reading 
    move $a0, $s0       #file descriptor
    la $a1, buffer      #address of buff
    li $a2, 1024        #buff length
    syscall


    #print buffer to check
    li  $v0, 4          #
    la  $a0, buffer     # buffer contains the values
    syscall             # print int

    #end program
    li $v0, 10
    syscall
0

There are 0 answers