4Manuals

  • PDF Cloud HOME

如何在mips的一个字符串中读取我的整个.txt文件? Download

    适用于qemu mips的U-boot-文档错误和常见问题 任何人都可以帮助它吗?它有此错误:错误:错误的程序计数器值:0×00000000 Go:执行由于错误而终止

我试图以mips字符串形式读取整个.txt文件,但它仅从文件中读取第一行。我正在尝试制作成绩单管理系统,并且我已经成功创建了txt文件,但我不明白为什么in in not read txt。下面提供了代码输出和txt屏幕截图。 这是我的代码

.data
viewStr: .space 1024
addRoll: .asciiz "\nEnter Roll # : "
rollNum: .space 15
txt: .asciiz ".txt"
fileName: .space 19

.text .globl主 主要:     li $ v0,4     la $ a0,addRoll     系统调用

li $v0, 8
la $a0, rollNum
li $a1, 15
syscall

la $s0, fileName
la $s1, rollNum
la $s2, txt

loop:
    lb $a0, ($s1)
    beq $a0, $0, TXT
    sb $a0, ($s0)
    add $s1, $s1, 1
    add $s0, $s0, 1
    b loop

TXT:
    sub $s0, $s0, 1
    loop1:
        lb $a0, ($s2)
        beq $a0, $0, FileName
        sb $a0, ($s0)
        add $s0, $s0, 1
        add $s2, $s2, 1
        b loop1

FileName:
    li $v0, 13
    la $a0, fileName
    li $a1, 0
    syscall

    move $s0, $v0
    li $v0, 14
    move $a0, $s0
    la $a1, viewStr
    la $a2, 1024
    syscall

    li $v0, 16
    move  $a0, $s0
    syscall

    li $v0, 4
    la $a0, viewStr
    syscall

    li $v0, 10
    syscall 

here is the output of the above code

here is the screenshot of the txt file i am trying to read

0 个答案:

没有答案



Similar searches
    Azure Devops管道找不到al.exe 如何使用具有多个条件的linq过滤对象列表? Mailer测试失败,并在null上调用成员函数getSubject() 在MacOS中启动Django服务器时,为什么会出现错误? 在mysql查询中添加距离时出现错误