我正在尝试编写一个ARM程序集程序,它打开并从文件中读取整数。我对ARM非常陌生,不认为我完全理解这里发生的事情,我们将非常感谢任何帮助。
这是我到目前为止所拥有的:
@ ========= Open file for reading =============================
ldr r0,=inputFile
mov r1,#0
swi 0x6c @ open file
bcs InFileError @ if cannot open file branch to InFileError
ldr r1,=InputFileHandle
str r0,[r1]
inputFile: .asciz "integers.dat"
InputFileHandle: .word 0
InFileError:
ldr r1, =FileOpenErrorMsg
swi 0x02 @ display error
bal Exit
FileOpenErrorMsg: .asciz "Error opening file."
Exit:
swi 0x68 @ close file
当我尝试在ARMSim#:
中运行时,这就是我得到的PC Out of valid memory range, address 00011400
R0 :4140
R1 :4172
... (all 0)
R8 :37484
...
R13 :21504
R15 :70656