Need help to write an assembly language program.

myst3's Avatar, Join Date: Oct 2009
Newbie Member
I'm pretty new to ALP. I need to write a program to find the total, minimum and maximum of 10 numbers. I sort of have the part to find the total as can be seen below.

ADD 55
STO 55
LDA 44
SUB 66
STO 44
BRZ 08
BR 00
LDA 55
DAT 010
DAT 000
DAT 001

I need to know how to add on to that to find the minimum and maximum number.

xpi0t0s's Avatar, Join Date: Aug 2004
Make two variables (memory locations, or registers, whichever you prefer) equal to the first number; one represents minimum number found so far and the other represents maximum so far. As you loop over the numbers, if the current one is bigger than "maximum so far", then set "maximum so far" equal to "current one", and similar for "minimum so far". At the end of the loop these two variables will contain the smallest and largest numbers in the data set.
myst3 like this