Translate the following Python program into the machine language described in Ap
ID: 3856276 • Letter: T
Question
Translate the following Python program into the machine language described in Appendix C. You may assume that the program begins at address 00, and the x is stored at memory cell whose address is XY.
x= 0
while (x < 3):
x=x+ 1
part b
Translate the high-level statement
if (X == 0): Z=Y+ W
else: Z=Y+ X
into the machine language of Appendix C, assuming that W, X, Y, and Z are all values represented in two’s complement notation, each using one byte of memory.
Explanation / Answer
The following are instructions written in the machine language described in Appendix C. Translate them into English. a. 7123: OR the bit pattern in reg2 &3, and place the result in reg1. b. 40E1: MOVE the bit pattern in regE to reg1. c. A304: ROTATE the bit pattern in reg3 one bit to the right 4 times, and place the lower-order end bit at the higher-order end. d. B100: JUMP to instruction located in memory cell 00 if bit pattern in reg1 equal to bit pattern in reg0. If not, nothing will be done and program execution would continue. e. 2BCD: LOAD regB with the value CD. 9. Translate the following instructions from English into the machine language described in Appendix C. a. LOAD register 6 with the hexadecimal value 77. 2677 b. LOAD register 7 with the contents of memory cell 77. 1777 c. JUMP to the instruction at memory location 24 if the contents of register 0 equals the value in register A. BA24 d. ROTATE register 4 three bits to the right. A403 e. AND the contents of registers E and 2 leaving the result in register 1. 81E2 or 812E
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.