Due Midnight, Thursday, April 12
Write a machine language program that accepts a number
total_number and then accepts total_number numbers and prints out
their average, minimum and maximum.
It will be helpful to have memory locations for the following variables: total_number, number, count, sum, currentmax, currentmin.
You should use a loop with this plan:
Copy total_number to count
Read first number
Store it in sum, currentmax, currentmin
Subtract 1 from from count
Read next number
Add it to sum
Compare number to currentmax and if number is bigger then store it in currentmax
Compare number to currentmin and if number is smaller then store it in currentmin
Subtract one from count
If count equals 0 then go FinishUp
Branch back to Loop
Print out currentmax, currentmin, and sum/total_number.
Feel free to ask for help or hints.
Translate any three lines of your program from assembly into
machine language (i.e. binary.) Assume all address modes and
commands are as we discussed in class: 4 bits for opcode, 1 bit
for the address mode, and 11 bits for the address offset or
#number (1 bit for the sign, and 10 bits for the value). To
make sure everything fits into 16 bits, be careful to place your
data within 1024 (2^10 forward or back) bytes from your program
lines, so that the offset fits into 11 bits.