Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello! I\'m working with MASM assembly language and was wondering if someone wou

ID: 2079786 • Letter: H

Question

Hello! I'm working with MASM assembly language and was wondering if someone would be able to help me with this problem. The instructions are:

The first loop is going to prompt the user to enter 10 DWORD values into an array. It will use a symbol to calculate the size of the array. The array will be initialized to zero. The second loop is going to use indirect or indexed addressing to reverse the elements of an integer array in place. The third loop is going to display the contents of the reversed array. Side note, The display is suppose to show "Enter Number 1:".."Enter Number 2:"..all the way to "Enter Number 10:" I am having difficulty incrementing the number inside of the enter number prompt.

Below is what I have so far, any help is greatly appreciated!!

INCLUDE Irvine32.inc
.DATA
Message0   BYTE "Welcome to Pat Programmer's Array Reverse",0dh,0ah,0
Message1   BYTE "Enter Number ",0
Message2   BYTE "Reverse Order",0dh,0ah,0
MessageSize = ($ - Message1) - 1
NumberToGet = 10
.CODE
main PROC
   call   clrscr
   mov       edx, OFFSET Message0
   mov       ecx, NumberToGet

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;The first loop is going to prompt the user to enter 10 DWORD
;values into an array. It will use a symbol to calculate the
;size of the array. The array will be initialized to zero.
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
loop1:
   mov       edx, OFFSET Message1

    call   WriteString
   call   Crlf
   call   ReadInt
   push   eax
   loop   loop1  
   mov       ecx, NumberToGet
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;The second loop is going to use indirect or indexed addressing
;to reverse the elements of an integer array in place.
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;loop2:

;   loop   loop2

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;The third loop is going to display the contents of the
; reversed array.
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
loop3:
   pop       eax
   call   WriteInt
   call   Crlf
   loop   loop3

   call   readint                           ;pauses the program
   exit
main ENDP
END main

Explanation / Answer

INCLUDE Irvine32.inc
.DATA
Message0   BYTE "Welcome to Pat Programmer's Array Reverse",0dh,0ah,0
Message1   BYTE "Enter Number ",0
Message2   BYTE "Reverse Order",0dh,0ah,0
MessageSize = ($ - Message1) - 1
NumberToGet = 10
.CODE
main PROC
   call   clrscr
   mov       edx, OFFSET Message0
   mov       ecx, NumberToGet

loop1:
   mov       edx, OFFSET Message1

    call   WriteString
   call   Crlf
   call   ReadInt
   push   eax
   loop   loop1  
   mov       ecx, NumberToGet

loop2:

call   WriteString
   call   Crlf
   call   ReadInt

loop   loop2

loop3:
   pop       eax
   call   WriteInt
   call   Crlf
   loop   loop3

   call   readint                           ;pauses the program
   exit
main ENDP
END main

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote