Question

How would you go about creating a subroutine in MARIE assembly language that allows for the...

How would you go about creating a subroutine in MARIE assembly language that allows for the output of text entered from a keyboard?
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

A subroutine is a sequence of instructions that is modular and can be executed multiple times. If you are familiar with any programming language, you may see that subroutines are similar to functions.MARIE provides a way to call these subroutines by using the JnS instruction, and normal program execution can be resumed once the subroutine exits by using the JumpI instruction.

Here is an example that prints the sum of two variables X and Y then halts the program:

JnS PrintSum  /Enter subroutine PrintSum
Halt

PrintSum, HEX 000 / Used for storing return address
         INPUT
         Store X
         INPUT
         Store Y
         Load X
         Add Y
         Output

  

JumpI PrintVariableX
X, DEC 0
Y, DEC 0
Add a comment
Know the answer?
Add Answer to:
How would you go about creating a subroutine in MARIE assembly language that allows for the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT