Question: Assembly Language X86 Processsor 7th edition. Write a program using the LOOP instruction with indirect addressing that reserves the words in a string in place.

Assembly Language X86 Processsor 7th edition. 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 Irvines 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. Dont 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 BYTE CSU 335 is a great course at CSU, 0

ecxbkp DWORD? ; save ecx if necessary

.code

main PROC

; eliminate extra spaces between words

; display msg

MOV edx, OFFSET msg

CALL WriteString

CALL Crlf ; print

; 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!