Problem Write an assembly program that prompts the user to enter a string of a size that does not exceed 20 characters and store it into a data variable wordListA using Irvine library's ReadString procedure. The program then displays the string entered by the user in reverse as shown in the sample run below. Sample Run > reverse.exe Enter a string (max 20 characters): word The reverse is: drow > reverse.exe Enter a string (max 20 characters): BaB The reverse is: BaB > reverse.exe Enter a string (max 20 characters): sultan The reverse is: natlus > reverse.exe Enter a string (max 20 characters): abc123 The reverse is: 321cba > reverse.exe Enter a string (max 20 characters): &5%1772js The reverse is: sj2771%5&

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter9: Completing The Basics
Section9.3: The String Class
Problem 7E
icon
Related questions
icon
Concept explainers
Question
Problem
Write an assembly program that prompts the user to enter a string of a size that does not exceed
20 characters and store it into a data variable wordListA using Irvine library's ReadString
procedure. The program then displays the string entered by the user in reverse as shown in the
sample run below.
Sample Run
> reverse.exe
Enter a string (max 20 characters): word
The reverse is: drow
reverse.exe
Enter a string (max 20 characters): BaB
The reverse is: BaB
> reverse.exe
Enter a string (max 20 characters): sultan
The reverse is: natlus
> reverse.exe
Enter a string (max 20 characters): abc123
The reverse is: 321cba
> reverse.exe
Enter a string (max 20 characters): &5%1772js
The reverse is: sj2771%5&
Your program must define and use the following procedure:
Procedure reverseString: this procedure reverses the string that was read from the
user by copying the characters from the defined data variable wordListA into wordListB
starting from position at length-1 of wordListA and position zero of wordListB in
reverse order (NOTE: the last character of a string is the NULL terminator at the last position
since every string must be terminated with 0 and therefore start copying from length-1). It then
completes the last position of wordListB by filling it with a NULL terminator (i.e. 0). For
instance, see the illustration below using the string “ABCD" of length=4:
wordListA = “ABCD"
position
1
2 3 4
character A
BCD0
wordListB= “DCBA"
position
1
4
character| D C BA0
Grading Table
Points
Mark
Style (naming, comments, spacing, indentation)
Data Segment with needed variables
Main Procedure (prompt=2, readstring=3, result messages=2, calling
procedure=3)
reverseString Procedure (loop=2,indexing=3,handle string null
terminator=3, return from procedure=2)
5
5
10
10
Total
30
Needed Irvine32 Library Procedures
Crlf: advances the cursor to the beginning of the next line in the console window.
ReadString: Reads a string from the keyboard.
WriteChar: writes a single character to the console window. Pass the character in AL
WriteString: writes a null-terminated string to the console window. Pass the string's offset in EDX.
Transcribed Image Text:Problem Write an assembly program that prompts the user to enter a string of a size that does not exceed 20 characters and store it into a data variable wordListA using Irvine library's ReadString procedure. The program then displays the string entered by the user in reverse as shown in the sample run below. Sample Run > reverse.exe Enter a string (max 20 characters): word The reverse is: drow reverse.exe Enter a string (max 20 characters): BaB The reverse is: BaB > reverse.exe Enter a string (max 20 characters): sultan The reverse is: natlus > reverse.exe Enter a string (max 20 characters): abc123 The reverse is: 321cba > reverse.exe Enter a string (max 20 characters): &5%1772js The reverse is: sj2771%5& Your program must define and use the following procedure: Procedure reverseString: this procedure reverses the string that was read from the user by copying the characters from the defined data variable wordListA into wordListB starting from position at length-1 of wordListA and position zero of wordListB in reverse order (NOTE: the last character of a string is the NULL terminator at the last position since every string must be terminated with 0 and therefore start copying from length-1). It then completes the last position of wordListB by filling it with a NULL terminator (i.e. 0). For instance, see the illustration below using the string “ABCD" of length=4: wordListA = “ABCD" position 1 2 3 4 character A BCD0 wordListB= “DCBA" position 1 4 character| D C BA0 Grading Table Points Mark Style (naming, comments, spacing, indentation) Data Segment with needed variables Main Procedure (prompt=2, readstring=3, result messages=2, calling procedure=3) reverseString Procedure (loop=2,indexing=3,handle string null terminator=3, return from procedure=2) 5 5 10 10 Total 30 Needed Irvine32 Library Procedures Crlf: advances the cursor to the beginning of the next line in the console window. ReadString: Reads a string from the keyboard. WriteChar: writes a single character to the console window. Pass the character in AL WriteString: writes a null-terminated string to the console window. Pass the string's offset in EDX.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Operators
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr