...
Question 9776 – Machine-Instructions
December 17, 2023
Question 13130 – Computer-Networks
December 18, 2023
Question 9776 – Machine-Instructions
December 17, 2023
Question 13130 – Computer-Networks
December 18, 2023

Question 9626 – Machine-Instructions

Consider the following assembly language program for a hypothetical processor. A, B, and C are 8 bit registers. The meanings of various instructions are shown as comments.

     MOV B, # 0   	;   B ← 0
     MOV C, # 8	        ;   C ← 8
Z :  CMP C, # 0	        ;   compare C with 0
     JZX	        ;   jump to X if zero flag is set
     SUB C, # 1	        ;   C ← C - 1
     RRC A, # 1 	;   right rotate A through carry by one bit. Thus:
                        ;   if the initial values of A and the carry flag are a7...a0 and
                        ;   c0 respectively, their values after the execution of this
                        ;   instruction will be c0a7...a1 and a0 respectively.
     JC Y	        ;   jump to Y if carry flag is set
     JMP Z	        ;   jump to Z
Y :  ADD B, # 1	        ;   B ← B + 1
     JMP Z	        ;   jump to Z
X :	

If the initial value of register A is A0 the value of register B after the program execution will be

Correct Answer: B

Question 3 Explanation: 
B is to be increments when a is moved to carry.
The code is counting the number of 1 bits in A0.
A
the number of 0 bits in A0
B
the number of 1 bits in A0
C
A0
D
8
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!