I currently have a MARIE assembly langauge program that will read in ten numbers and output the average, min and max. I need to add an aditional feature to this program that will also print out the standard deviation of the numbers 10, 20, 30 ...90, 100. Here is the program I have so far: org 100 /start address loop, load x /counter, checks if x < 0 subt ten Skipcond 000 Jump loop2 clear /gather user input and store as temp var input store temp clear if, load x /decrements x and compares value if x > 0 subt 1 Skipcond 800 jump storeFirst clear /subtracts value in min from temp and compares in condition load temp /if x < 0 subt min Skipcond 000 jump findMax else, Skipcond 800 /if not, checks if x > 0 and jumps to findmin jump findMin continue, clear /adds value of temp to y and stores new val load temp add y Store y clear load x /increments counter x add one store x clear jump loop /goes back to begining and restarts loop 'function' findMax, clear Load temp /stores value of temp as max var Store max /and jumps back up to continue function Jump continue findMin, clear Load temp /stores value of temp as min var Store min /jumps back up to continue function Jump continue storeFirst, Load temp Store min /stores value of temp into min and max variables Store max /jumps back up to continue Jump continue loop2, load y /checks if y is > 0 Skipcond 800 Jump printAll /jumps to print function subt ten /subtracts 10 from y val Store y Clear Load average /adds 1 to average and stores val Add one Store average Clear Jump loop2 /jumps back to top of loop2 printAll, Load average Output /loads and outputs average, min and max var values Clear Load min Output Clear Load max Output Clear Halt ten, DEC 10 one, DEC 1 x, DEC 0 y, DEC 0 min, DEC 0 max, DEC 0 temp, DEC 0 average, DEC 0 If it is easier to write an entirely new program from scratch, that is fine as well but I would perfer to just add a standard deviation feature to this one. Thank You!
I currently have a MARIE assembly langauge program that will read in ten numbers and output the average, min and max. I need to add an aditional feature to this program that will also print out the standard deviation of the numbers 10, 20, 30 ...90, 100. Here is the program I have so far:
org 100 /start address
loop, load x /counter, checks if x < 0
subt ten
Skipcond 000
Jump loop2
clear /gather user input and store as temp var
input
store temp
clear
if, load x /decrements x and compares value if x > 0
subt 1
Skipcond 800
jump storeFirst
clear /subtracts value in min from temp and compares in condition
load temp /if x < 0
subt min
Skipcond 000
jump findMax
else, Skipcond 800 /if not, checks if x > 0 and jumps to findmin
jump findMin
continue, clear /adds value of temp to y and stores new val
load temp
add y
Store y
clear
load x /increments counter x
add one
store x
clear
jump loop /goes back to begining and restarts loop 'function'
findMax, clear
Load temp /stores value of temp as max var
Store max /and jumps back up to continue function
Jump continue
findMin, clear
Load temp /stores value of temp as min var
Store min /jumps back up to continue function
Jump continue
storeFirst, Load temp
Store min /stores value of temp into min and max variables
Store max /jumps back up to continue
Jump continue
loop2, load y /checks if y is > 0
Skipcond 800
Jump printAll /jumps to print function
subt ten /subtracts 10 from y val
Store y
Clear
Load average /adds 1 to average and stores val
Add one
Store average
Clear
Jump loop2 /jumps back to top of loop2
printAll, Load average
Output /loads and outputs average, min and max var values
Clear
Load min
Output
Clear
Load max
Output
Clear
Halt
ten, DEC 10
one, DEC 1
x, DEC 0
y, DEC 0
min, DEC 0
max, DEC 0
temp, DEC 0
average, DEC 0
If it is easier to write an entirely new program from scratch, that is fine as well but I would perfer to just add a standard deviation feature to this one. Thank You!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps