TITLE Copying an Array (arrayCopy.asm) COMMENT @ Write a program in assembly language that uses the following data and constant declarations: array DWORD 10h,20h,30h,40h,11h,12h,16h,14h,18h,22h,96h,44h,89h DWORD 17h,94h,27h,16h,82h,33h,15h,21h,77h,73h,02h,12h,09h arrayLen = ($ - array) / 4 Step 1: Display the array in forward order, in hexadecimal format, with a comma between each number. (You may have a trailing comma after the last number.) Step 2: Display the array in reverse order, in hexadecimal format, with a comma between each number. (You may have a trailing comma after the last number.) Turn in a printed listing of your program, and a printout of the screen when the program runs. To print a DOS window, select Edit > Mark from the window's System menu (upper left corner). Drag the mouse over the text you want to print, and press the Enter key. Open up a text editor window and paste the Windows clipboard into the editor. Print the file using the text editor's print command. Required reading: All of Chapter 4, plus pp.137-147 in Chapter 5. @ INCLUDE Irvine32.inc .data array DWORD 10h,20h,30h,40h,11h,12h,16h,14h,18h,22h,96h,44h,89h DWORD 17h,94h,27h,16h,82h,33h,15h,21h,77h,73h,02h,12h,09h arrayLen = ($ - array) / 4 comma BYTE ",",0 .code main PROC ; Step 1: display the array in forward order, in hexadecimal format. mov esi,OFFSET array ; point to the array mov ecx,arrayLen ; set loop counter L1: mov eax,[esi] ; get integer from array call WriteHex ; write it in hexadecimal mov edx,OFFSET comma ; display a comma call WriteString add esi,TYPE array ; point to next array position loop L1 call Crlf ; end the current line call Crlf ; display a blank line ; Step 2: display the array backwards mov ecx,arrayLen ; set loop counter L2: sub esi,TYPE array ; back up one position mov eax,[esi] ; get integer from array call WriteHex ; write it in hexadecimal mov edx,OFFSET comma ; display a comma call WriteString loop L2 ; repeat the loop call Crlf ; end the current line call Crlf ; display a blank line call WaitMsg ; pause the screen display exit main ENDP END main