Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

4. (20 points) A programmer was asked to write a Pep/9 assembly code program tha

ID: 3728668 • Letter: 4

Question

4. (20 points) A programmer was asked to write a Pep/9 assembly code program that inputs a speed (S) and outputs one of three messages for a roadside display If S70 "Woah! Slow down!" Otherwise "Good speed" The program submitted is shown below. Circle redundant instructions, i.e., those that could be removed without affecting the correctness of the program ldwa 0,i deci S,d ldwa S,d cpwa 70, i brgt toofast ldwa S,d cpwa 30,i brge OK brgt OK brlt tooslOw tooslow: stro slow, d br end OK stro good, d br end toofast: stro fast,d br end end: stop .block 2 fast: .ascii "Woah! Slow down! x00" slow: .ascii "Too slow: speed it up n x00'" good: .ascii "Good speed n" . ena

Explanation / Answer

Instructions which are not required:

ldwa S,d (this instruction is used 2 times) => deci instruction will load decimal entered into S

brgt OK => brge instruction means grater or equal, so brgt which is greater is not required

Also, instructions cpwa where i is sompared against 70 & 30, here i should be replaced by S since speed should be compared againt these and then remove first instruction ldwa 0,i as i will not be required

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote