Read from file mips32 - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Read from file mips32

I'm using Spim for my mips coding and I need to load a file and use the data contained in it. The file contains a number telling the amount of numbers that needs to be sorted.

The file looks like this:

.data
datalen:
.word 0x0010 # 16
data:
.word 0xffff7e81
.word 0x00000001
.word 0x00000002
.word 0xffff0001
.word 0x00000000
.word 0x00000001
.word 0xffffffff
.word 0x00000000
.word 0xe3456687
.word 0xa001aa88
.word 0xf0e159ea
.word 0x9152137b
.word 0xaab385a1
.word 0x31093c54
.word 0x42102f37
.word 0x00ee655b


It is possible for the file to contain more or less numbers.
So I was thinking like this. Open file, read first number. Allocate an memory area capable of storing all these numbers. Read the numbers and put them in the memory.

but I got no clue on how to read from a file and iterate trough it and I'm completely bummed out. I'm trying to figure out how to use syscall 13 and 14 but no luck so far.
Sign In or Register to comment.