
Robert K. answered 06/14/20
Computer Science Master's Student
The specific answer to your question will depend on which assembly language they want you to use, however, to get you start, try thinking about:
Regarding the register architecture, the fact you have two open memory locations for storage should make that relatively straight forward. Load two values, compute, store, and then repeat. I believe the loading/storing order is flexible as long as you adhere to the order of operations for the computations.
Regarding the accumulator architecture, you have to be more careful than above. However, it's not all THAT much different. It just takes away that load/store flexibility from the previous architecture. But, it'll follow essentially the same steps to solve just with more efficient memory management.
Regarding the stack-based architecture, this is actually probably the easiest. Funnily enough. Just google Stack-Based Calculators. It's a fascinating, and still useful, way of thinking about/computing a calculation. But it'll give you the general algorithm.
Hope this helps! And please let me know if you have any questions! : )