0

I am new at MARIE simulator and I need to write a code that reads "a" and "b" from the user, and calculates the summation from "a" to "b" and outputs it. Can you please help me with this? This is what i have done but the output is not correct:

ORG 100
Input
Store a
Input 
Store b
Begin, Load a
Store sum
Add one
Store a
Subt b
Skipcond 800
Jump Begin
Output sum
Halt

a, Dec 0
b, Dec 0
one, Dec 1
sum, Dec 0
Erik Eidt
  • 23,049
  • 2
  • 29
  • 53
UserL00
  • 37
  • 1
  • 8
  • Where are you stuck? This site respects questions of lasting value. Can someone help is not that kind of question, so ask something more specific and technical. If you tried and had problems ask a technical question about your attempt. – Erik Eidt Dec 16 '20 at 21:24
  • Well i did try writing a code but the output wasn't right so i gave up now. – UserL00 Dec 16 '20 at 21:26
  • Suggest you comment the code, in particular what you expect to happen at label Begin, that instruction and the next instructions. A load followed by store will not accomplish a summation, just a copy. You could include an add instruction to perform the summation. – Erik Eidt Dec 16 '20 at 22:04

0 Answers0