Explanation of Solution
MARIE assembly instruction for given code segment:
ORG 100
If, Load X / Load value of X
Subt Y /Subtract X from Y and store into accumulator
SkipCond 800 /If AC>0 implies(X<=Y)skip to next one
Jump Else /Jump to the Else label
Then, Load Y /Reload the value of X
Add One /Add 1 and store into AC
Store Y /Y=Y+1
Clear /Move 0 into accumulator
Else, Load X /Load X
Subt Z /Subtract X from X
SkipCond 400 /If AC=0 implies(X=Z)skip to next one
Jump Else /Jump to the Else label
Then, Load Y /Load Y
Subt One /Subtract 1 from Y and store into accumulator
Store Y /Y=Y-1
Clear /Move 0 into accumulator
Else, Load Z /Load the value of Z
Add One /Add 1 to Z and store into Z
Store Z /Z=Z+1
Halt /Terminate the program
X, Dec ? /Starting value of X not specified
Y, Dec ? /Starting value of Y not specified
Z, Dec ? /Starting value of Z not specified
One, Dec 1 /Constant value
Explanation:
- Initially, the assembler loads the value of accumulator then the value stored to X.
- In “If” label, load the value of “X” and subtract the “X” from “Y” then store the resultant value in accumulator...
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
Essentials of Computer Organization and Architecture
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education