Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In assembly windows32/console 32 The following design will input numbers into an

ID: 3830845 • Letter: I

Question

In assembly windows32/console 32

The following design will input numbers into an array of doublewords, using the sentinel value -9999 toterminate input.

nbrElts := 0

get address of array

prompt for and input number

while number != -9999 loop

add 1 to nbrElts

  store number at address

add 4 to address

  prompt for and input number

end whileImplement

This design in a windows32 program that uses a dialog box to prompt for and input eachnumber. Assume that no more than 100 numbers will be entered. Use a single message box to reportthe sum of the numbers and how many numbers were entered (not counting the sentinel value).

Also, Use the above program, display in the same message box the following additional calculations: The average of the numbers The count of the array entries that are greater than or equal to the average value

Calculate the difference of the sums of the differences, that is, subtract the average for the firstnumber and add that to a total, then subtract the average from the second number andadd it to the total. Continue until you have done this for all numbers in the array. Please use comments to explain what is happening, and please dont copy and paste the answer from the other questions

Explanation / Answer

I have written the assembly windows32 program along with the comments for all the lines.

// The text section helps us to hold the actual code into the program

section.text

// The global main declaration tells the operating system i.e, kernel to follow the execution of a given program

.global main

// The main declaration is the startup of the program

main:
// sub keyword is used for substrtaction purpose

sub sp, sp, #4
  
// str keyword is used to manipulate the immediate offset by using the stack pointer  

str lr, [sp, #0]

// It tells the user to enter any number for further calculation

;Prompt

ldr r0, =prompt
bl printf
  
// The scanf helps the users to type the numbers through the help of keyboard

;Scanf
ldr r0, =displayNumbersList
sub sp, sp, #4
mov r1, sp
bl scanf
ldr r4, [sp, #0]
add sp, sp, #4

// It significes the user to enter and check the result.

;Prompt
ldr r0, =prompt
bl printf

// The scanf helps the users to type the numbers through the help of keyboard

;Scanf
ldr r0, =displayNumbersList
sub sp, sp, #4
mov r1, sp
bl scanf
ldr r5, [sp, #0]
add sp, sp, #4

// It tells the user to enter any number for further calculation

;Prompt
ldr r0, =prompt
bl printf
  
// The scanf helps the users to type the numbers through the help of keyboard

;Scanf
ldr r0, =displayNumbersList
sub sp, sp, #4
mov r1, sp
bl scanf
ldr r6, [sp, #0]
add sp, sp, #4

// It tells the user to enter any number for further calculation

;Prompt
ldr r0, =prompt
bl printf
// The scanf helps the users to type the numbers through the help of keyboard

;Scanf
ldr r0, =displayNumbersList
sub sp, sp, #4
mov r1, sp
bl scanf
ldr r7, [sp, #0]
add sp, sp, #4

;Now you have all the numbers list

// The compute sum is used to sum the numbers which is entered by the user. For example, If he enters 3 and 5 value, the sum is equivalent to 8.

;Compute sum
sum r8, r4, r5
sum r9, r6, r7
sum r8, r8, r9

// The print will display the sum as 8 in the screen.

;Print sum
ldr r0, =displaySum
mov r1, r8
bl printf

// The compute average is used to calculate the average among the numbers which is entered by the user. For example, If he enters 10 and 20 value, the average value will be Average:   30 / 2 = 15

;Compute average
mov r1, r8
asr r1, #2
ldr r0, =displayAverage
bl printf

// The compute product is used to multiply the numbers which is entered by the user. For example, If he enters 5 and 5 value, the product value is 25.

;Compute Product
mul r8, r4, r5
mul r9, r6, r7
mul r1, r8, r9
ldr r0, =displayProduct
bl printf

// It helps us to display the sum final value

displaySum:
.asciz "The calculated Sum is %d "

// It helps us to display the average final value
   
  
displayAverage:
.asciz "The calculated Average is %d "

// It helps us to display the product final value  
  
displayProduct:
.asciz " The calculated Product is %d "
   // It helps us to display the all the listed final value  
displayNumbersList:
.asciz "%d"
       // Tells the user to enter any number.
prompt:
.asciz "Please enter a Number "

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote