Question
MASM Assembly-Languag Create a PROCEDURE out of LAB #4 which will be called from your MAIN PROCEDURE. lab #4 TITLE ]given array using push and
MASM Assembly-Languag
Create a PROCEDURE out of LAB #4 which will be called from your MAIN PROCEDURE.
lab #4
TITLE ]given array using push and pop (reverseprint.asm)
;This program wiil reverse a given array.
INCLUDE Irvine32.inc
.data
arrayB word 9,8,7,6,5,4,3,2,1,0 ; Array of integers with 10 elements
.code
main PROC
mov eax,0
mov esi,OFFSET arrayB ;Point esi to arrayB
mov ecx,LENGTHOF arrayB ;elements in array
mov ebx,TYPE arrayB ;point ebx to next element in array
call dumpmem
mov eax, 0
mov esi,OFFSET arrayB + SIZEOF arrayB - TYPE arrayB ;Last element in array
mov ecx,LENGTHOF arrayB ;elements in array
;start of loop
Reverse:
mov ax,[esi] ;move vaue of esi to ax
call writeint ;print value in ax
sub esi,TYPE arrayB ;point esi to previous element
loop Reverse ;LOOP
;end of loop
exit
main ENDP
End main
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started