Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用MIPS读取和写入.bmp文件_Mips - Fatal编程技术网

使用MIPS读取和写入.bmp文件

使用MIPS读取和写入.bmp文件,mips,Mips,我尝试打开一个.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 ope

我尝试打开一个.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

您能否添加有关如何尝试隔离问题的信息?您正在使用
$a1=0
(只读)打开输出文件。谢谢,问题已解决