Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In ARM Assembly language, wrote a program that will do the following. Read the d

ID: 3758939 • Letter: I

Question

In ARM Assembly language, wrote a program that will do the following.

Read the data from a file called "input.txt" as a string of characters into memory. Lowercase all the letters Replace all punctuation with a hyphen (-), Output the new string from memory to a file called "output.txt".

For example:

input.txt" contains "I'm already born. I'm already wise. I'm already worn. I'm already wonderin', "What am I?"

"output.txt" should contain "i-m already born- i-m already wise- i-m already worn- i-m already wonderin-- -what am i-"

Explanation / Answer

This Logic is only for reading a file and writing data into a file. It may Help for something

ldr      r0,=InFileName
mov      r1,#0    @ input mode
swi      SWI_Open
bcs      NoFileFound
ldr      r1,=InFileHandle
str      r0,[r1]
...
ldr      r0,=OutFileName
mov      r1,#1    @ output mode
swi      SWI_Open
bcs      NoFileFound
ldr      r1,=OutFileHandle
str      r0,[r1]
...
OutFileHandle: .word 0
InFileHandle: .word 0
InFileName: .asciz "Infile1.txt"
OutFileName: .asciz "Outfile1.txt"

Descrption is below..

Opens a text file for input or output. The file name is passed via r0.
Register r1 specifies the file access mode. If r1=0, an existing text file is to be opened
for input. If r1=1, a file is opened for out put (if that file exists already, it
will be overwrit ten, otherwise a new file is created).
If r1=2, an existing text file is opened in append mode, so that any new text
written to the file will be added at the end. If the file is opened successfully, a
positive number(the file handle) is returned in r0. Otherwise, a result of 1 is
returned and the C bit is set

It may help but not fully please refer the below link page number 21 onwards