CSCI 365 Project Four: Copy a String in Reverse Order Answered – MASM Assembly Language, Loops & Indirect Addressing

$45.00

Explore MASM assembly language programming through string reversal using loops and indirect addressing. Covers null-terminated strings, BYTE arrays, ESI and EDI index registers, reverse character copying, memory manipulation, and Visual Studio debugging. Delivered as a downloadable ZIP file containing the programming project solution for educational reference.

Original Work ?

Download Details:

  • Name: 4.ProjectFour-kcgmyl.zip
  • Type: zip
  • Size: 97.18 KB

Category: You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (3 votes)

CSCI 365 Project Four: Copy a String in Reverse Order focuses on reversing a null-terminated string using MASM assembly language. The assignment explores indirect addressing, loop structures, BYTE arrays, and ESI and EDI index registers. Students implement character-by-character copying in reverse order, handle string terminators, and inspect program results using Visual Studio’s memory debugger.

Assignment Description

Objectives:

  1. Declare and initialize null-terminated string
  2. Apply indirect address
  3. Write loop
  4. Apply Irvine.inc library functions to display a string

Problem Description:

Write a program with a loop and indirect address that copies a string from source to target. Revising the character order in the process. Use the following variables:

source BYTE “This is the string that will be reversed”, 0

target BYTE SIZEOF source DUP(‘#’)

You may refer to the Programming Exercise #7 on Page 138 of the textbook.

Hint:

You may study the book example “Copying a String” on page 127 first. However, this project has three different things from the book’s example.

 

  1. You need two index register. One for the index of source, another for index of target. You can use Register ESI for index of source and Register EDI for index of target
  2. You will not copy the last character in source, which is null character (the terminator of source string). So the initial value of ESI shall be set as OFFSET target – 2 since the target string is stored right after the source string in memory
  3. After the loop, you need add null character to the end of the target string

How to View Output:

After Chapter Five, you will be able to write statement to print out the output on screen. So far, you need to see output in memory. After your project can be assembled and run successfully, you may do following things:

  1. Click on the grey bar located on the left of side of the “invoke ExitProcess, 0” statement to set up the Break Point
  2. Go to Debug and click on Start Debugging
  3. Go to Debug -> Windows -> Memory -> Memory 1 (or: ALT + 6). You will see a window on the right side of your code. Type 0x004068D0 in Address field and you will see the following window (next page). If you don’t see the source string, then your computer may store .data section in difference memory location. You may need to search to find it. If you see the source string but the string after it is not a reverse of source string, then your program has logic errors.
  4. After check the result, press F10 to continue and finish the program execution.

Due Date:

You need to turn in YourNameProj4.asm via Blackboard. Due date will be announced on Blackboard.

Solution Overview

The solution addresses a MASM assembly program that copies source string characters into a target buffer in reverse order. It covers ESI and EDI register indexing, indirect memory addressing, loop-controlled copying, null termination, and verification through the Visual Studio memory debugger.