Question: Low Level Breakdown This assignment comprises five tasks: 1 . Prompt the user, and read two numeric characters ( ' 0 ' . . .
Low Level Breakdown
This assignment comprises five tasks:
Prompt the user, and read two numeric characters from the user using Trap x
GETC Echo the characters to the console as they are received OUT and store them as
character data in separate registers.
Output to the console the operation being performed eg
how will you print the How will you print the Note the double quotes!!
Once the setup is printed, convert the numeric characters into the actual numbers they
represent eg convert the ASCII code for into the binary representation of the number
Perform the subtraction operation by taking the two's complement of the second operand and
adding and determine the sign of the result;
if it is negative, determine the magnitude of the result ie take the s complement to turn it
back into a positive number
Convert the resulting number back to a printable character and output it together with a minus
sign if necessary. Remember, the number when converted to text is actually two separate
ascii characters, and
Example, with a detailed algorithm we won't always give you this!
Program prompts for user input two characters:
user enters which is echoed to console followed by a newline and copied to a register.
user enters which is echoed to console followed by a newline and copied to a different
register.
Program outputs the text
this will actually require at least distinct output steps using OUT and PUTS
Program converts ascii code into number and stores it back in the same register.
Program converts into and stores it back in the same register.
Program takes s complement of and stores the result back into the same register.
Program adds the contents of the two registers ie it performs the operation and stores
the result in a third register.
Program recognizes that the result is negative, obtains the magnitude of and outputs
minus sign
Program converts number into ascii code and stores it back in the same register.
Program outputs followed by a newline.
Expected Sample output
In this assignment, your output must exactly match the following, including:
the prompt, followed by newline provided in the starter code
Each digit input "echoed" and followed by a newline
the subtraction operation, including spaces as shown, also followed by a newline:
Difference is Positive
Difference is Zero
Difference is Negative
Your code will obviously be tested with a range of different operands giving all possible results.
Make sure you test your code likewise!
NOTES:
All console output must be NEWLINE terminated.
We will test only with positive single digit numeric inputs
NO error message is needed for invalid input ie we will not test with nonnumeric inputsConsole click to focus
Difference is Positive
Console click to focus
x
ENTER two numbers e
Halting the LCI
Difference is Zero
Console click to focus
ENTER two numbers ie dots.
Halting the LC
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
