Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Modify this add program so that the user can input two numbers and then subtract the two integers. Displays the difference on the screen.

1. Modify this add program so that the user can input two numbers and then subtract the two integers. Displays the difference on the screen.

2. Further, modify the program to display negative results.

3. Create a flowchart for your algorithm, illustrating each register and their meaning.

ORIG x3000 LD R6, ASCII LD R5, NEGASCII TRAP x23 ;the trap instruction which is also known as "IN" ADD R1,R0,x0 ;move the first integer to register 1 ADD R1,R1,R5 ;convert first ASCII number to numerical value TRAP x23 ;another "IN" ADD R0,R0,R5 ;convert next ASCII number to numerical value ADD R2,R0,R1 ;add the two integers ADD R2,R2,R6 ;convert the sum to its ASCII representation LEA R0,MESG ;load the address of the message string TRAP x22 ;"PUTS" outputs a string ADD R0,R2,x0 ;move the sum to R0, to be output TRAP x21 ;display the sum HALT ASCII .FILL x30 ;the mask to add to a digit to convert it to ASCII NEGASCII .FILL xFFD0 ;the negative version of the ASCII mask MESG .STRINGZ "The sum of those two numbers is " .END

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

More Books

Students also viewed these Databases questions

Question

How many moles of salicylic acid are in 1.2 gram of salicylic acid

Answered: 1 week ago