代写 Go (CSCI 321) Project Four: Copying a Word Array to a Double Word Array

(CSCI 321) Project Four: Copying a Word Array to a Double Word Array
Objectives:
• Implementing arrays
• Apply indexed address
• Write loop
Problem Description:
Write a program that uses a loop to copy all the elements from an unsigned Word (16-bit) array into an unsigned doubleword (32-bit) array.
Hint:
You may study the book example “Loop Instruction” on page 124 first. However, this project has three different things from the book’s example.
• 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
• You will need to initialize the values of ESI and EDI as 0 since the target string is stored right after the source string in memory
• You will need to know the LENGTHOF the source array. Please see the section on the LENGTHOF operator on page 116 on how to do that.
For example:
var1 WORD 1, 2, 3, 4, 5
count = LENGTHOF var1

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:
• Click on the grey bar located on the left of side of the “invoke ExitProcess, 0” statement to set up the Break Point

• Go to Debug and click on Start Debugging
• Go to Debug -> Windows -> Memory -> Memory 1 (or: ALT + 6). You will see the memory window on the bottom of your code.

• In the Address field at the top of the memory window, type the & (ampersand) character, followed by the name of the array, and press Enter. For example, &myArray would be a valid address expression. The memory window will display a block of memory starting at the array’s address. See the following screenshot

To know that you got it right is this. Remember, the goal is to copy a 16-bit word to a 32-bit doubleword. As I have mentioned this before a doubleword is twice as big as a word, so if a word is 16-bit then a doubleword is 16*2 = 32-bits.
Now look at the above screenshot within the red lines. This is in hexadecimal number system. Now, if my array consists of an integer array of 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 and remember 10 decimal in hex is A….you can see that the first address in memory (0x00404000) has those values. Remember those array integers are 16 bits. Therefore, you see 01 00 02 00. Each of those values are 4-bits long, so 01 00 is 16-bits, then 02 00 is 16-bits and so one.
Now look at the second address. You are copying from a 16-bit address to a 32-bit address; therefore, 01 00 00 00 is 32-bits, then 02 00 00 00 is 32-bits, and so on and it continues on the third address.
After you 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.