Created
February 12, 2016 09:26
-
-
Save tremblerz/2ebb158ecdfa4d8df337 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.data | |
fin: .asciiz "maze1.dat" # filename for input | |
buffer: .asciiz "" | |
.text | |
#open a file for writing | |
li $v0, 13 # system call for open file | |
la $a0, fin # board file name | |
li $a1, 0 # Open for reading | |
li $a2, 0 | |
syscall # open a file (file descriptor returned in $v0) | |
move $s6, $v0 # save the file descriptor | |
#read from file | |
li $v0, 14 # system call for read from file | |
move $a0, $s6 # file descriptor | |
la $a1, buffer # address of buffer to which to read | |
li $a2, 1024 # hardcoded buffer length | |
syscall # read from file | |
# Close the file | |
li $v0, 16 # system call for close file | |
move $a0, $s6 # file descriptor to close | |
syscall # close file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment