Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write pseudocode for a program that allows the user to input two numbers (X and Y) and a code C. If the code has value
Write pseudocode for a program that allows the user to input two numbers (X and Y) and a code C. If the code has value 1, the program should output the larger of X and Y and otherwise output the smaller.
Now convert your pseudocode to the assembly language displayed in the pictures attached.
Message load x store x clear x add x increment x subtract x decrement x compare x x-> R R-> x 0 -> X R + x -> R X + 1 -> X R - X -> R X - 1 -> x if x > R then 100 -> CCR elseif x CCR elseif x = R then 010 -> CCR goto x goto xif CCR = 100 goto xif CCR = 010 goto xif CCR = 001 goto xif CCR != 010 store input in x output x jump x jumpgtx jumped x jumpit x jumpne x in x out x halt OK Figure 10.1 Typical Assembly Language Instruction Set Binary Op Code Operation Meaning + 0000 LOAD X CON(X) 0001 STORE X R CON(X) 0010 CLEAR X 0 CON(X) 0011 ADD X R+ CONX) 0100 INCREMENT X CON(X) + 1 CON(X) 0101 SUBTRACT X R-CON(X) R 0110 DECREMENT X CON(X) - 1 CON(X) 0111 COMPAREX if CON(X) > R then GT = 1 else 0 if CON(X) = R then EQ = 1 else 0 if CON(X)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