assembly - 在 MIPS 中读取文件
问题描述
我是 MIPS 的完整初学者,我试图理解一段关于打开文件、保存文件然后关闭文件的代码。
#open file
li $v0, 13
la $a0, fname #file name
li $a1, 1 #flags: 1-write file
li $a2, 0 #mode: ignored
syscall
move $s1, $v0 # save the file descriptor
#check for errors - if the file was opened
#...
#save file
li $v0, 15
move $a0, $s1
la $a1, image
li $a2, BMP_FILE_SIZE
syscall
#close file
li $v0, 16
move $a0, $s1
syscall
除了“保存文件描述符部分”之外,我了解所有内容。谁能解释什么是文件描述符以及我们为什么在这里使用它?我不明白的说明:
- 移动 $s1, $v0
- 移动 $a0, $s1
- 移动 $a0, $s1
解决方案
推荐阅读
- angular - 如何在Angular中比较日期和时间
- python-3.x - 在数据框列中搜索字符串
- javascript - 将正确的数据从 API 插入到 MongoDB
- git - Jenkins 文件的 Jenkins 多分支管道错误
- sql-server - 无法将始终加密的 varbinary 加密列转换为任何类型
- ruby-on-rails - 如何在 ActiveAdmin 的仪表板中使列可排序?
- android - 无法使用 MediaBrowserServiceCompat
- c++ - Pisano 周期生成器在 3 位周期中的行为不正确
- c - 有没有办法将 txt 中的信息直接转换为 struct 声明?
- python - 降低图像分辨率