1

I am currently working on the MARIE SIMULATOR and I am attempting to get three inputted decimals, and multiply all of them together. I save my code as .mas and attempt to assemble it. It says I have 1 error but the Assembly listing comes up completely empty! I figured out that the code assembles and runs when I remove the Jump OP from it however, I need the Jump to get the correct answer. Everywhere I look the jump is written as I have it so I have no idea if I am wrong, if my Sim is bugged or what.

ORG 100     /Starting point // Gustavo Brandao. No Partners
    Input       /Request user input for first number
    Store   NumA    /Store the number
    Output      /Display number to screen
    Input       /Request user for a second number
    Store   NumB    /Store number
    Output      /Display number
    Input       /Request user for third number
    Store   NumC    /Show number
    Output      /Display number
Loop,   Load    NumA    /Load the first number, will also loop from here
    Add Sum /Add with zero and location which will save the sum
    Store   Sum /Store the sum
    Load    NumB    /Load the second number for the skip condition control
    Subt    One /decrement the number
    Store   NumB    /Store the number. when 0, code will skip the jump
    Skipcond 000    /Skip when the second number reaches zero
    Jump    Loop    /Used to repeat addition until second number reaches zero
    Load    Sum
    Store   NumA    /Storing sum in NumA slot to make code easier to read
Loop,   Load    NumA    /Loading the previous sum
    Add FSum    /Adding previous sum to zero and final sum location
    Store   FSum    /Storing final sum
    Load    NumC    /Second skip condition control
    Subt    One /decrememting number
    Store   NumC    /Storing skip condition
    Skipcond 000    /When the third inputed number is zero, loop will end
    Jump    Loop    /Loops back to second part of code
    Load    FSum    /load the final sum for output
    Output      /Display final sum
    HALT
NumA,   Dec 0   /First number; Will be overwritten with input
NumB,   Dec 0   /Second number
NumC,   Dec 0   /Third number
Sum,    Dec 0   /Stores the sum for the first multiplication process
FSum,   Dec 0   /Stores sum for the second multiplication process
One,    Dec 1   /Used to decrement values
johnnyRose
  • 7,310
  • 17
  • 40
  • 61
Cigaro
  • 51
  • 1
  • 7

1 Answers1

0

So I just realized that I cant have two "Loop"s in the program since it wont recognize which to jump to. I named the second one Loop2 and it worked. I am getting the wrong answer but thats nothing a little tweaking wont solve

Cigaro
  • 51
  • 1
  • 7