Question: How to implement a counting Procedure on intel x 8 6 MASM irvine that stores the amount of the numbers in an array per instance
How to implement a counting Procedure on intel x MASM irvine that stores the amount of the numbers in an array per instance eample, sortedArray: CountNums should the return an array that looks like the following CountedArray:and can be called using a universal display function. I just don't understand, why my code is not storing the counts properly or if the issue is my display? My counting nums procedure is below for refrence. Along with the code above to initalize it myArray stores the sorted number list.
PUSH OFFSET myArray
PUSH ARRAYSIZE
PUSH OFFSET countArray
CALL countingNums
countingNums PROC
PUSH ebp
mov ebp, esp
mov esi, ebp ; Array start
mov ecx, ebp ; Number of elements
mov edi, ebp ; Address of countArray
xor ebx, ebx ; Clear ebx, to use as the current count
mov edx, esi
countLoopshell:
cmp esi edx
jne countkeeper
inc ebx
add esi,
dec ecx
jnz countLoopshell
countkeeper:
mov edi edx ; Store count in countArray
add edi,
mov edx, esi ; Load the next unique element
mov ebx,
test ecx, ecx
jnz countLoopshell
nextnum:
add esi,
loop countLoopshell
mov edi ebx
countComplete:
pop ebp
ret
CountingNums ENDP
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
