Question: I have an issue with my code and have been struggling to fix the error in it . Essentially I need to use MACROs to

I have an issue with my code and have been struggling to fix the error in it. Essentially I need to use MACROs to recieve 10 signed numbers, convert them from a string to integers, store them in an array, then print the array of numbers before then printing, the sum and the average of all the numbers. Most of it seems like it should work since I had it working with unsigned, but now it it throwing error A2022 Instruction operands must be the same size. If there is a way to call the strings that align with the values outside of some of SumNums and for the avg that would be great too. Any step by step on my error would also be a fantastic help. As understanding MACROs and their implementation has been rather difficult. Code is snipped for reference.
```
INCLUDE Irvine32.inc
.data
Hellousr BYTE "Hello and welcome to a lowlevel I/0 procedure", 0
intro_1 BYTE "Please enter 10 signed decimal integers", 0
intro_2 BYTE "Each number needs to be small enough to fit inside a 32 b
intro_3 BYTE "After they are entered IDIV will display the list offset
intro_4 BYTE "Please enter a signed integer: ",0
outofrangeerror BYTE "The number entered is not a signed intiger inside 32 bits
averagenumstr BYTE "The average number is: ",0
numsumstr BYTE "The sum of all the numbers entered is: ",0
usrenteredstr BYTE "The numbers are:", 0
goodbye
```
```
EmGetString MACRO intro_4, bufferInputSize, inputcounter
PUSHAD
mov ed`, intro_4
WriteString
mov edx, OFFSET bufferInputSize
mov ec, bufferSize
ReadString
mov edx, OFFSET inputcounter
mov dword ptr [], eax ; Store number of bytes read
POPAD
ENDM
mDisplayString MACRO bufferInputSize
PUSHAD
mov ad, bufferInputSize
WriteString
POPAD
ENDM
.code
Emain PROC
introduction
PUSH OFFSET signedArray
PUSH OFFSET inputtotal
PUSH OFFSET inputcounter
readVal
crlf
PUSH OFFSET averagenumstr
PUSH OFFSET numsumstr
PUSH OFFSET signedArray
displaySumAvg
``````
_Numloopcheck:
mGetString intro_4, bufferInputSize, inputcounter
xor ebx,
mov esi, OFFSET bufferInputSize ; Address of buffer
cld
converterStr2Int:
lodsb
cmp al,0
_validnum
cmp al,'0'
_errToUsr
cmp al,'9'
_errToUsr
sub al,'0'
imul ebx, ebx, 10
add ebx,
converterStr2Int
_validnum:
mov [edi], ebx ; Store number in array
add edi, 4 ; Move to next element
_Numloopcheck
_readvalComplete
_errToUsr:
mDisplayString OFFSET outofrangeerror
crlf
dec
_Numloopcheck
_readvalComplete:
ret 8
readVal ENDP
writeVal PROC
push ebp
mov ebp,
mov adi, [ebp +8] ; Address of List
lea esi, bufferInputSize ; Point to string buffer
mov ecx, 10 ; Loop counter
_outerloop:
push
mov eax, [edi] ; Load number from the array
mov ebx, 10 ; Initialize divisor
xor edx, edx ; Clear high part
divide:
div ebx ; Divide eax by 10
add dl,'0' ; Convert remainder to ASCII
stosb ; Store digit in buffer
test eax, eax ; Check if quotient is zero
divide ; Repeat until all digits are processed
; Null-terminate and display
mov al,0
stosb
lea edx, bufferInputSize
mDisplayString
pop
add edi, 4 ; Move to next number in List
_outerloop
pop
ret 4
``````
displaySumAvg PROC
push
mOV
mov esi, [eb+8]
xor ebx,
mov ecx, 10
_SumNums:
mov eax, [esi]
add ebx,
add esi, 4
lloog)_SumNums
; Display sum
mov eax, abx ; Sum in eax
push offset numsumstr
push eax ; Pass sum
writeVal
; Display average
xor adx,
mov eax, ebx
mov ecx, 10
div acx ; Compute average
push offset averagenumstr
push eax ; Pass average
writeVal
pop
ret 8
displaySumAvg ENDP
```
Gfaremel1 PROC
I have an issue with my code and have been

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!