This discussion is closed.
amity2000
Badges: 0
#1
Report Thread starter 16 years ago
#1
A,B and C are 8 bit Registers.for a hypthetical processor.
intial value of of register A is A0


MOV B,#0 ;B<- 0 (assign 0 to B)
MOV C,#8 ;C<- 8 (assign 8 to C)
Z: CMP C,#0 ;compare C with 0
JZ X ;jump to X if zero flag is set
SUB C,#1 ;C<-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 a7a6..a1a0 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 (B=B+1)
JMP Z ;jump to Z
X;


q1>
After the execution of the above program what will be the value of register B.


q2>
which of the following instructions when inserted at location X will ensure
that the value of regiater A after program execution is the same as its intial value.
(a) RRC A,#1
(b) NOP ;no operation
(c) LRC A,#1 :left rotate A through carry flag by one bit
(d) Add A,#1


q3>
how the above program should be modified so the value in register B is
1>the no. of 0 bits in A0
2>the no. of 1 bits in A0
3>A0
4>8
0
X
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

People at uni: do initiations (like heavy drinking) put you off joining sports societies?

Yes (216)
67.92%
No (102)
32.08%

Watched Threads

View All