Question
Create a procedure that fills an array of doublewords with N random integers, making sure the values fall within the range j...k, inclusive. When calling
Create a procedure that fills an array of doublewords with N random integers, making sure the values fall within the range j...k, inclusive. When calling the procedure, pass a pointer to the array that will hold the data, pass N, and pass the values of j and K. Preserve all register values between calls to the procedure. Write a test program that calls the procedure twice, using different value for J and K. Verify your result using a debugger.
PLEASE POST A SCREENSHOT OF THE OUTPUT AND SOURCE CODE. THIS IS VISUAL STUDIO 15 MASM IRVINE
Hint :
To fill the array with random values be sure to point to the array like the following. mov esi,OFFSET intArray ; point to the array mov ecx,LENGTHOF intArray ; loop counter
L1: call Random32 ; EAX = random value call WriteInt call Crlf mov [esi],eax add esi,4
; to search for negative values you have to point to the array and do a loop counter again and then you have to compare value to zero and look for negative value. If the result is yes then you will add it to the count like the following:
L2: cmp dword ptr [esi],0 ; compare value to zero jge L3 ; negative value? inc count ; yes: add to count L3: add esi,4 loop L2
mov eax,count call WriteDec call Crlf
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