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

These questions are about assembler language coding(Multiple choice) You could p

ID: 3719086 • Letter: T

Question

These questions are about assembler language coding(Multiple choice)

You could present your answer with A B C D.

Question 1 1 pts Briefly describe what the following Hack assembler code does @KBD D-M; @48 1A @num M-D END) OEND 0;JMP It reads the keyboard code at the time of the first D-M command and subtracts 48 from it and puts the result in "num It reads the keboard register at the time of the @kbd command and exits if the scan code is more than 48. Nothing, there is a syntax error and the code doesn't assemble. Nothing, there is no way that this code is able to read the keyboard unless the user is able to press the number O O 48 which doesn't exist on the keyboard. If it could work it would put the value -48 in "num".

Explanation / Answer

1. Answer is (A). The program first reades the keyboard code, then subtract 48 from it and then puts the result in num variable.

2. Answer is (A). Again, the program first read the keyboard code and subtract 48 from it. If the output is less than 0, it again scans the keyboard code, otherwise it further subtracts 10 from it. If this new output is greater than or equal to 0(which will occur when the input code is >=58), then it loops again, otherwise program ends.

3. Answer is (D). First instruction inverts the bits of D, and second one add 1 to it, which is equivalent to 1-D.

4. Answer is (B).

5. Answer is (B).

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