Question: Perform these steps using LC - 3 assembly that does not reference the run time stack. Learning Subroutines Programming Lab # 3 CEG 3 3
Perform these steps using LC assembly that does not reference the run time stack. Learning Subroutines
Programming Lab #
CEG : Computer Organization
PURPOSE
The average computer scientist programs in assembly very rarely. However, some familiarity with assembly level
programming is necessary to develop the fundamental understanding of how highlevel programs get executed which
itself is necessary to understand highend performance issues Subroutines are one of the most important fundamental
assembly language concepts.
ASSIGNMENT
In this lab you will create a simple calculator program. Calculator programs are common in higher level language
programming courses but implementing them in assembly is not so simple.
To create this calculator program you will have to implement subroutines:
GETNUM
a Captures a positive two digit number from the keyboard
GETOP
a Captures an operation from the keyboard or
CALC
a Calculates the correct mathematical result when provided two positive two digit numbers and an
operation
DISPLAY
a Displays up to a digit positive or negative number
In the main program loop, the program will prompt the user to enter the first number. After the user enters their first
number, the program will prompt the user for an operation Lastly, the program will prompt the user for the
second number. Using the first number, operation, and second number, the calculator program will display the
mathematical result. Once the output is displayed, the program will loop endlessly to allow the user to enter in more
combinations of numbers and operations.
For the subroutines in your program, use registers to take inputs and provide outputs. Do not implement a runtime stack
for this lab. As an example, the CALC subroutine could receive the first number on R the second number on R the
operation on R and output the final result on R
A sample program is provided to get you started.
The following is an example output of the program:
Enter first number :
Enter an operation :
Enter second number :
Result:
Enter first number :
Enter an operation :
Enter second number :
Result:
Enter first number :
Enter an operation :
Enter second number :
Result:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
