Does this MARIE code find the lowest number in an array?

Viewed 3383

I believe i did this correct, can anyone double check on the work. And if it is correct where should I look to verify that it is picking the right number. So i am trying to give the array and see which one is the smallest number out of that array.

    Org 100     /Find minimum
    Load    Start
    Add Num
    Subt    One
    Store   Loc
    Loadi   Loc
    Store   Min 
    Load    Num
    Subt    One
    Store   J
Loop,   Load    J
    Skipcond 00
    Jump    After
    Jump    Done
After,  Load    Loc
    Subt    One
    Store   Loc
    Subt    Min
    Skipcond 00
    Jump    After2
    Loadi   Loc
    Store   Min
After2, Load    J
    Subt    One
    Store   J
    Jump    Loop
Done,   Load    Min
    Halt

Min,    Dec 0  /where we save the min
Num,    Dec 10 /Numbers of value in array
One,    Dec 1 
J,  Dec 0  /Loop variable
Loc,    Dec 0
Start,  Hex 121 /Be sure to start off values in array
Array,  Dec 5
    Dec 20
    Dec 11
    Dec 15
    Dec 83
    Dec 2
    Dec 7
    Dec 1
    Dec 13
    Dec 15
1 Answers
Related