Question
Using the windows32 framework, write a complete 80x86 assembly language program that prompts for inputs three grades with separate dialog boxes, and calculates the sum
Using the windows32 framework, write a complete 80x86 assembly language program that prompts for inputs three grades with separate dialog boxes, and calculates the sum and the average (sum/3) of the grades. Display the sum and average on two lines of a message box, each line with an appropriate label. Hint: Printing two lines in the same message box is the tricky part. It is the only challenging part in this question. Try to find a method exploiting CR and LF. Think about how you can have multiple identifiers identifying sections of the same string. That way you can have two 11 dup(0)s in the same string. I WAS DOING ABOVE PROBELM AND I HAVE THIS CODE BELOW WHAT I'M GETTING EROOR HOW HOW DO I DO IN ORDER TO PROGRAM TO RUN. PLEASE WRITE CORRECT CODE THAT CORRECTLY DISPLAY OUTPUT
.586 .MODEL FLAT INCLUDE io.h ; header file for input/output .STACK 4096 .DATA number1 DWORD ? number2 DWORD ? number3 DWORD ? sumcount DWORD 3 ; we only need to divide the sum by 3 prompt1 BYTE "Enter grade 1:", 0 prompt2 BYTE "Enter grade 2:", 0 prompt3 BYTE "Enter grade 3:", 0 resultLbl BYTE "Sum:", 0 resultAvg BYTE "Average:", 0 sum BYTE 11 DUP (?), 0 avg BYTE 11 DUP (?), 0 string BYTE 40 DUP (?) .CODE _MainProc PROC input prompt1, string, 40 ; read first number as ASCII characters atod string ; convert to integer mov number1, eax ; store in memory input prompt2, string, 40 ; read second number as ASCII characters atod string ; convert to integer mov number2, eax ; store in memory input prompt3, string, 40 ; read third number as ASCII characters atod string ; convert to integer mov number3, eax ; store in memory mov eax, number1 ; move first number to EAX add eax, number2 ; add second number to EAX add eax, number3 ; add third number to EAX mov ecx, eax ; copy EAX's value into ECX mov ebx, sumcount ; put 3 in EBX idiv ebx ; divide the sum by 3 dtoa sum, eax ; convert to ASCII characters dtoa avg, ecx ; convert to ASCII characters output resultLbl, sum ; output label and sum output resultLbl, avg ; output label and sum mov eax, 0 ; exit with return code 0 ret _MainProc ENDP END ; end of source code
Information The sum is: 400 The average is: 40 OKStep 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