Question: Using MASM ( x 8 6 Assembly Language ) : For the following procedure: calcAverageLowHighTemps, the user is getting an error when attempting to return

Using MASM (x86 Assembly Language):
For the following procedure: calcAverageLowHighTemps, the user is getting an error when attempting to return to main at the next call step. User attempted to calibrate [EBP] indexes to make sure the correct amount of bytes are returned; however, the error persists. Please advise where the code appears to be misaligned.
;calcAverageLowHighTemps parameters
PUSH OFFSET dailyLows
PUSH OFFSET dailyHighs
PUSH averageLow
PUSH averageHigh
CALL calcAverageLowHighTemps
;procedure to calculate the average temperatures
calcAverageLowHighTemps PROC
PUSH EBP
MOV EBP, ESP
MOV ESI, [EBP +20]
MOV EDI, [EBP +12]
MOV ECX, DAYS_MEASURED
MOV EAX, 0
_calculateAvgLow:
MOV EBX, DAYS_MEASURED
ADD EAX, [ESI]
ADD ESI, 4
LOOP _calculateAvgLow
MOV EDX, 0
DIV EBX
MOV [EDI], EAX
POP ECX
POP EDI
POP ESI
POP EBP
_stagingParamsAvgHigh:
MOV EBP, ESP
MOV ESI, [EBP +16]
MOV EDI, [EBP +8]
MOV ECX, DAYS_MEASURED
_calculateAvgHigh:
MOV EBX, DAYS_MEASURED
ADD EAX, [ESI]
ADD ESI, 4
LOOP _calculateAvgHigh
MOV EDX, 0
DIV EBX
MOV [EDI], EAX
POP ECX
POP EDI
POP ESI
RET
calcAverageLowHighTemps ENDP
Using MASM ( x 8 6 Assembly Language ) : For the

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!