Introduction to Computer (NTU, Fall 2015)
Homework 2
RELEASE DATE: 2015/10/19
DUE DATE: 2015/11/02 (Mon.) 12:10pm
Please hand in your handwriting assignment after class.
Each question is 10 point, and the total point is 100 point.
Please write the solution in detail and clearly for each question; otherwise, you will lose partial point.
Penalty for late parts:
90% of value for one-day late, 80% two-day late, ...
The following questions are from “Chapter 2 review problem” in “Computer Science: An Overview”, 12th Edition by J. Glenn Brookshear.
4. What is the value of the program counter in the machine described in Appendix C immediately after executing the instruction B0CD?
7. The following are instructions written in the machine language described in Appendix C.
Translate them into English.
a. 7123 b. 40E1 c. A304 d. B100 e. 2BCD
9. Translate the following instructions from English into the machine language described in Appendix C.
a. LOAD register 6 with the hexadecimal value 77.
b. LOAD register 7 with the contents of memory cell 77.
c. JUMP to the instruction at memory location 24 if the contents of register 0 equals the value in register A.
d. ROTATE register 4 three bits to the right.
e. AND the contents of registers E and 2 leaving the result in register 1.
12. Suppose the memory cells at addresses 00 through 03 in the machine described in Appendix C contain the following bit patterns:
a. Translate the first instruction into English.
b. If the machine is started with its program counter containing 00, what bit pattern is in register 6 when the machine halts?
Introduction to Computer (NTU, Fall 2015)
17. Suppose the memory cells at addresses 00 through 0D in the machine described in Appendix C contain the following bit patterns:
Assume that the machine starts with its program counter containing 00.
a. What bit pattern will be in register 0 when the machine halts?
b. What bit pattern will be in register 1 when the machine halts?
c. What bit pattern is in the program counter when the machine halts?
20. Suppose the memory cells at addresses 20 through 28 in the machine described in Appendix C contain the following bit patterns:
Assume that the machine starts with its program counter containing 20.
a. What bit patterns will be in registers 0, 1, and 2 when the machine halts?
b. What bit pattern will be in the memory cell at address 30 when the machine halts?
c. What bit pattern will be in the memory cell at address B0 when the machine halts?
Introduction to Computer (NTU, Fall 2015)
22. Suppose the memory cells at addresses 00 through 05 in the machine described in Appendix C contain the following (hexadecimal) bit patterns:
If we start the machine with its program counter containing 00, when does the machine halt?
28. Suppose the following program, written in the machine language of Appendix C, is stored in main memory beginning at address 30 (hexadecimal). What task will the program perform when executed?
34. Perform the indicated operations:
42. What would be the result of performing a 2-bit right circular shift on the following bytes represented in hexadecimal notation (give your answers in hexadecimal notation)?
a. 3F b. 0D c. FF d. 77