Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MAKE SURE TO USE ASSEMBLY LANGUAGE Write a program using the LOOP instruction with indirect addressing that reserves the words in a string in place.

MAKE SURE TO USE ASSEMBLY LANGUAGEimage text in transcribed

Write a program using the LOOP instruction with indirect addressing that reserves the words in a string in place. The words are separated by one or more-character spaces in the original string. Your program should first eliminate extra spaces and hence just leave one space between two consecutive words. That is to say, the string stored in the variable msg (below '' is a space for visibility) CIS 335.. is.a..great....course.. at.. CSU Becomes CIS 335 is a great course at CSU Then, call the function WriteString provided in the Irvine's library to display the string msg. Next, your program reverses the string character by character to generate: USC ta esruoc taerg a si 533 SIC In the variable msg. Call the function WriteString again to display msg. Next your program needs to reverse each word in the msg and store it back to the variable msg using the nested LOOP instructions. Don't forget to copy the space character after you reverse a word. The result would be CSU at course great a is 335 CIS The structure of your program looks like TITLE MASM Assignment 3: Reverses a string word by word (assign3.asm) Description INCLUDE Irvine32.inc data msg ecxbkp BYTE "CSU 335 is a great course at CSU", 0 DWORD? ;save ecx if necessary code main PROC ;eliminate extra spaces between words ; display msg MOV edx, OFFSET msg CALL WriteString CALL Crlf print Irn ; reverse the String char by char in msg display msg ; use nested LOOP instruction to reverse each word in msg ; display msg Exit main ENDP END main Write a program using the LOOP instruction with indirect addressing that reserves the words in a string in place. The words are separated by one or more-character spaces in the original string. Your program should first eliminate extra spaces and hence just leave one space between two consecutive words. That is to say, the string stored in the variable msg (below '' is a space for visibility) CIS 335.. is.a..great....course.. at.. CSU Becomes CIS 335 is a great course at CSU Then, call the function WriteString provided in the Irvine's library to display the string msg. Next, your program reverses the string character by character to generate: USC ta esruoc taerg a si 533 SIC In the variable msg. Call the function WriteString again to display msg. Next your program needs to reverse each word in the msg and store it back to the variable msg using the nested LOOP instructions. Don't forget to copy the space character after you reverse a word. The result would be CSU at course great a is 335 CIS The structure of your program looks like TITLE MASM Assignment 3: Reverses a string word by word (assign3.asm) Description INCLUDE Irvine32.inc data msg ecxbkp BYTE "CSU 335 is a great course at CSU", 0 DWORD? ;save ecx if necessary code main PROC ;eliminate extra spaces between words ; display msg MOV edx, OFFSET msg CALL WriteString CALL Crlf print Irn ; reverse the String char by char in msg display msg ; use nested LOOP instruction to reverse each word in msg ; display msg Exit main ENDP END main

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

How is the weighted average cost of capital determined?

Answered: 1 week ago

Question

Persuasive Speaking Organizing Patterns in Persuasive Speaking?

Answered: 1 week ago