1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Need help to write an assembly language program.

Discussion in 'Assembly Language Programming (ALP) Forum' started by myst3, Oct 24, 2009.

  1. myst3

    myst3 New 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.

    IN
    ADD 55
    STO 55
    LDA 44
    SUB 66
    STO 44
    BRZ 08
    BR 00
    LDA 55
    OUT
    HLT
    *44
    DAT 010
    *55
    DAT 000
    *66
    DAT 001

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

    Thanks.
     
  2. xpi0t0s

    xpi0t0s Mentor

    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.
     

Share This Page