我尝试打开.bmp文件(230454字节)并写入另一个.bmp文件。它没有用,谁能告诉我为什么?
文件与Mar4_5.jar
位于同一目录中当我调试时,程序将smt读取为缓冲区,但我无法打印出来,甚至是控制台。
.data
fin: .asciiz "1.bmp"
fout: .asciiz "1_out.bmp"
buffer: .space 250000
.text
main:
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, 230454 # 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
li $v0, 13 # system call for open file
la $a0, fout # 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
li $v0, 15 # system call for read from file
move $a0, $s6 # file descriptor
la $a1, buffer # address of buffer to which to read
li $a2, 230454 # 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
li $v0, 10
syscall