Question: why is my code : . 3 8 6 . model flat, stdcall . stack 4 0 9 6 ExitProcess proto, dwExitCode:dword ReadInt proto WriteInt

why is my code : .386
.model flat, stdcall
.stack 4096
ExitProcess proto, dwExitCode:dword
ReadInt proto
WriteInt proto
ReadChar proto
WriteString proto
.data
array DWORD 25 DUP(?)
odds DWORD 25 DUP(?)
evens DWORD 25 DUP(?)
minVal DWORD ?
maxVal DWORD ?
avgVal DWORD ?
msg_prompt BYTE "Enter a non-negative integer: ",0
msg_min BYTE "Minimum Array Value: ",0
msg_max BYTE "Maximum Array Value: ",0
msg_avg BYTE "Average Array Value: ",0
msg_odd BYTE "Odd Array Values: ",0
msg_even BYTE "Even Array Values: ",0
msg_repeat BYTE "Repeat program (Y/N)?",0
count DWORD 0
.code
main PROC
start_program:
mov ecx, 0
input_loop:
mov edx, OFFSET msg_prompt
call WriteString
call ReadInt
cmp eax, -1
jl fill_remaining
mov array[ecx*4], eax
inc ecx
cmp ecx, 25
jne input_loop
fill_remaining:
mov ebx, 1
fill_loop:
cmp ecx, 25
jge done_input
mov array[ecx*4], ebx
inc ebx
inc ecx
jmp fill_loop
done_input:
call find_min_max
call calculate_average
call find_odds
call find_evens
mov edx, OFFSET msg_min
call WriteString
mov eax, minVal
call WriteInt
mov edx, OFFSET msg_max
call WriteString
mov eax, maxVal
call WriteInt
mov edx, OFFSET msg_avg
call WriteString
mov eax, avgVal
call WriteInt
mov edx, OFFSET msg_odd
call WriteString
mov ecx, 0
display_odds:
cmp odds[ecx*4],0
je display_evens
mov eax, odds[ecx*4]
call WriteInt
inc ecx
jmp display_odds
display_evens:
mov edx, OFFSET msg_even
call WriteString
mov ecx, 0
display_evens_loop:
cmp evens[ecx*4],0
je repeat_program
mov eax, evens[ecx*4]
call WriteInt
inc ecx
jmp display_evens_loop
repeat_program:
mov edx, OFFSET msg_repeat
call WriteString
call ReadChar
cmp al,'Y'
je start_program
exit_program:
invoke ExitProcess, 0
ret
main ENDP
find_min_max PROC
mov eax, array[0]
mov ebx, eax
mov ecx, 1
min_max_loop:
cmp ecx, 25
jge end_min_max
mov edx, array[ecx*4]
cmp edx, eax
jl update_min
cmp edx, ebx
jg update_max
jmp next_element
update_min:
mov eax, edx
jmp next_element
update_max:
mov ebx, edx
next_element:
inc ecx
jmp min_max_loop
end_min_max:
mov minVal, eax
mov maxVal, ebx
ret
find_min_max ENDP
calculate_average PROC
mov eax, 0
mov ecx, 0
avg_loop:
cmp ecx, 25
jge end_avg
add eax, array[ecx*4]
inc ecx
jmp avg_loop
end_avg:
xor edx, edx
mov ebx, 25
div ebx
mov avgVal, eax
ret
calculate_average ENDP
find_odds PROC
mov ecx, 0
mov edx, 0
odd_loop:
cmp ecx, 25
jge end_odd
mov eax, array[ecx*4]
test eax, 1
jz not_odd
mov odds[edx*4], eax
inc edx
not_odd:
inc ecx
jmp odd_loop
end_odd:
ret
find_odds ENDP
find_evens PROC
mov ecx, 0
mov edx, 0
even_loop:
cmp ecx, 25
jge end_even
mov eax, array[ecx*4]
test eax, 1
jnz not_even
mov evens[edx*4], eax
inc edx
not_even:
inc ecx
jmp even_loop
end_even:
ret
find_evens ENDP
WriteInt PROC
ret
WriteInt ENDP
ReadInt PROC
ret
ReadInt ENDP
ReadChar PROC
ret
ReadChar ENDP
WriteString PROC
ret
WriteString ENDP
END main
why does source\repos\Test1retry\Debug\Test1retry.exe (process 35788) exited with code 0(0x0).
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window ...
happen when trying to run debugger what wrong with the code ive got to turn it in tonight so plz try and give me the fixed verson! nothing shows error on my compiler

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!