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.
The following are the instructions. Please help me fill this out
INCLUDE Irvine32.inc
.data
intArray sdword 50 DUP(?) ; Declare an integer array
count DWORD 0 ; initialize a counter
.code
main PROC
; call Randomize from Irvine32.inc
; point to the array
; length of into ecx
; set the lower limit (j)
; set the upper limit (k)
; Call your function fillWithRandom
; move 5 into ebx
; move upper limit (50) into eax
; Call your function again
exit
main ENDP
fillWithRandom proc
; Input parameters:
; ESI points to the array, ECX is the size
; EBX = lower base, EAX = upper limit
; use pushad
; calculate interval size
; increment eax
; save the interval size start of Loop 1
; generates value (0 to EAX-1) Call RandomRange
; add it to the base
; move eax into the esi array
; pop eax
; move 4 into esi
; Loop back to L1
; popad
; ret
fillWithRandom 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