Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

LC3 assembly code: PLease explain your answer . Thanks Question 2: You have to provide a simple interface that allows users to specify any of

LC3 assembly code:

image text in transcribed

PLease explain your answer . Thanks

Question 2: You have to provide a simple interface that allows users to specify any of three operations they wish to perform on a pair of integers x,y entered by the user. The three operations are (a) Addition, (b) Subtraction (first number - second number), and (c) multiplication. Do you think using subroutines makes your code more modular and easier to scale? Assume that x and y are each less than 1000 and are positive integers. You will need to convert ASCII to Binary The specifications for thep Your program must start at address x3000 The program should first print out a greeting "Starting Program" and then o Prompt user for input x: "Enter number x" o It should read this number and store it at address x5100 o Next, prompt user for input y: Enter number y" o It should read this number and store it at address x5101 The program then prompts the user for 4 inputs: "Enter operation A, S, M or X" (Can you make these commands case insensitive so that the user can enter A or a to select addition? Think about how you can add this option.) . After the prompt, the User enters one of these input. If they enter an invalid value (i.e., something other than A, S, or M) then the program prints out Invalid Operation-Try Again" and waits for correct entry If the user enters A, then the program adds the two numbers (i.e., computes x+y) stores the result in memory location x5102, and then goes back to the start and prompts .If the user enters S, then the program subtracts y from x (i.e., computes x -y) stores the result in memory location x5102, and then goes back to the start and prompts user for the next operation. If the user enters M, then the program multiplies the two numbers (i.e., computes x*y) stores the result in memory location x5102, and then goes back to the start and prompts user for next operation. If the user enters X, then the program Halts after printing the message Exiting program" Question 2: You have to provide a simple interface that allows users to specify any of three operations they wish to perform on a pair of integers x,y entered by the user. The three operations are (a) Addition, (b) Subtraction (first number - second number), and (c) multiplication. Do you think using subroutines makes your code more modular and easier to scale? Assume that x and y are each less than 1000 and are positive integers. You will need to convert ASCII to Binary The specifications for thep Your program must start at address x3000 The program should first print out a greeting "Starting Program" and then o Prompt user for input x: "Enter number x" o It should read this number and store it at address x5100 o Next, prompt user for input y: Enter number y" o It should read this number and store it at address x5101 The program then prompts the user for 4 inputs: "Enter operation A, S, M or X" (Can you make these commands case insensitive so that the user can enter A or a to select addition? Think about how you can add this option.) . After the prompt, the User enters one of these input. If they enter an invalid value (i.e., something other than A, S, or M) then the program prints out Invalid Operation-Try Again" and waits for correct entry If the user enters A, then the program adds the two numbers (i.e., computes x+y) stores the result in memory location x5102, and then goes back to the start and prompts .If the user enters S, then the program subtracts y from x (i.e., computes x -y) stores the result in memory location x5102, and then goes back to the start and prompts user for the next operation. If the user enters M, then the program multiplies the two numbers (i.e., computes x*y) stores the result in memory location x5102, and then goes back to the start and prompts user for next operation. If the user enters X, then the program Halts after printing the message Exiting program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions