I'm trying to use MIPS Syscall 13 to simply open a file so I can read in some strings and print them to the console, but the file descriptor keeps returning as -1 when I open the file. I've checked the file extensions and everything seems to be in order. There's a file of name "cards.dat" in the same directory as the source code. Here's my code. If Anyone could help, it would be appreciated.
.data
filename: .asciiz "cards.dat" #file name
textSpace: .space 1050 #space to store strings to be read
.text
main:
li $v0, 13 #open a file
li $a1, 0 # file flag (read)
la $a0, filename # load file name
add $a2, $zero, $zero # file mode (unused)
syscall
move $a0, $v0 # load file descriptor
li $v0, 14 #read from file
la $a1, textSpace # allocate space for the bytes loaded
li $a2, 1050 # number of bytes to be read
syscall
la $a0, textSpace # address of string to be printed
li $v0, 4 # print string
syscall