Home / Questions / Assembly Language x86
Modify the program in Figure 5.9 of our text (Detmer), replacing the second loop by one that changes each number that is larger than the average to zero. Show your full source code and screenshots of your working program.
; given an array of doubleword integers, (1) find their average
; and (2) add 10 to each number smaller than average
; author: R. Detmer
; revised: 6/2013
.586
.MODEL FLAT
.STACK 4096
.DATA
nbrArray DWORD 25, 47, 15, 50, 32, 95 DUP (?)
nbrElts DWORD 5
.CODE
main PROC
; find sum and average
mov eax,0 ; sum := 0
lea ebx,nbrArray ; get address of nbrArray
mov ecx,nbrElts ; count := nbrElts
jecxz quit ; quit if no numbers
forCount1: add eax,[ebx] ; add number to sum
add ebx,4 ; get address of next array elt
loop forCount1 ; repeat nbrElts times
cdq ; extend sum to quadword
idiv nbrElts ; calculate average
; add 10 to each array element below average
lea ebx,nbrArray ; get address of nbrArray
mov ecx,nbrElts ; count := nbrElts
forCount2: cmp [ebx],eax ; number < average ?
jnl endIfSmall ; continue if not less
add DWORD PTR [ebx], 10 ; add 10 to number
endIfSmall:
add ebx,4 ; get address of next array elt
loop forCount2 ; repeat
quit: mov eax, 0 ; exit with return code 0
ret
main ENDP
END
Dec 03 2020 Read more Less More
An end-of-period adjusting entry that debits Unearned Revenue most likely will credit a. a revenue. b. an asset. c. a liability. d. an expense.
Aug 26 2020The following information was taken from the job cost sheet for Job 101 for Scott Manufacturing Company:Date started:July 5Date completed:August 21 Direct Direct Fact...
Mar 13 2020i keep getting a chinese pop up ad on the lower right corner. whether I use explorer, chorm or firefox. Even after I close all the windows the ad still remain on the scre...
Apr 27 2020Quinton Corporation produces and sells two types of chili: 1-Alarm and 5-Alarm. Operating performance for the most recent quarter is: Management is puzzled by these resul...
May 22 2020A decrease in owner's equity resulting from the operation of a business
Dec 07 2017List a few examples of online conversations you have noticed as a user. Be sure to name some of the brands you have seen engage in online conversation. 100 word minimum
Aug 27 2020What is the journal entry for. ABC paid landlord $3,000 for 6 month's rent in advanced.
Sep 09 2020In assuming that profit mazimization motivates firms, we assume that the firmsA. choose the most efficient production process.B. choose the least costly combination of re...
Jun 06 2018Stainless steel ball bearings (ρ = 8085 kg/m3, k = 15.1 W/m·°C, cp = 0.480 kJ/kg·°C, andα = 3.91 × 10-6 m2 /s) having a diameter of 1.2 cm are to be quenched in water. Th...
Jun 09 2020The builder of a new movie theater complex is trying to decide how many screens she wants. Below are her estimates of the number of patrons the complex will attract each ...
May 01 2020Welcome to MyCourseHelp Services, World's leading Academic solutions provider with Millions of Happy Students.