Answered step by step
Verified Expert Solution
Question
1 Approved Answer
We use CodeWarrior program assembly: Using a loop, branches, and the stack, create a postfix notation calculator that performs the operations specified in RPN_IN. Add
We use CodeWarrior program assembly: Using a loop, branches, and the stack, create a postfix notation calculator that performs the operations specified in RPN_IN. Add the variables below to the DATA section of your code. Use these variables to implement your calculator. The variable OPER contains the ASCII representation of the operators (addition, subtraction, multiplication, and division) in HEX. Use this variable in the loop to determine what operation to perform. RPN_IN contains the variable with the operation to perform. The values in RPN IN below are initially 63/4*2+ and the result should be 10. Try another operation of your choosing by changing RPN IN and discuss it in the methodology section of your report FCB $06,$03,$2F, $04,$2A, $02,$2B 63/4*2+=10 RPN IN RPN OUTRMB ; RPN START FDB RPN END FDB RPN IN RPN OUT-1 ; Pointer to start of RPN array Pointer to end of RPN array OPER FCB $2A,S2B, $2D,$2F HINTS: You will traverse the RPN IN array in a similar fashion to lab 3. You will jump out of the array when an operator is found, pull two values off the stack, perform that particular operation, push the result onto the stack, and then return to the loop. Otherwise, you will just push the value on the stack. NOTE: the divide instruction (IDIV) requires two 16-bit registers and returns a 16-bit value. Only return the lower 8-bit as your result. We use CodeWarrior program assembly: Using a loop, branches, and the stack, create a postfix notation calculator that performs the operations specified in RPN_IN. Add the variables below to the DATA section of your code. Use these variables to implement your calculator. The variable OPER contains the ASCII representation of the operators (addition, subtraction, multiplication, and division) in HEX. Use this variable in the loop to determine what operation to perform. RPN_IN contains the variable with the operation to perform. The values in RPN IN below are initially 63/4*2+ and the result should be 10. Try another operation of your choosing by changing RPN IN and discuss it in the methodology section of your report FCB $06,$03,$2F, $04,$2A, $02,$2B 63/4*2+=10 RPN IN RPN OUTRMB ; RPN START FDB RPN END FDB RPN IN RPN OUT-1 ; Pointer to start of RPN array Pointer to end of RPN array OPER FCB $2A,S2B, $2D,$2F HINTS: You will traverse the RPN IN array in a similar fashion to lab 3. You will jump out of the array when an operator is found, pull two values off the stack, perform that particular operation, push the result onto the stack, and then return to the loop. Otherwise, you will just push the value on the stack. NOTE: the divide instruction (IDIV) requires two 16-bit registers and returns a 16-bit value. Only return the lower 8-bit as your result
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started