QP 2
QP 2
QP 2
Q1. Write a program to provide the given on/off time to three traffic lights (Green,
Yellow, Red) and two pedestrian signs (WALK and DON’T WALK). The signals
and signs are turned on/off by the data bits of an output port as shown below:
The traffic and pedestrian flow are in the same direction; the pedestrian should
cross the road when the Green light is on. (20)
a) Calculate the delay in the following loop, assuming the system clock period is
0.33 micro seconds:
Label Mnemonics 8085 T-states
LXI B,12FFH 10
DELAY: DCX B 6
XTHL 16
XTHL 16
NOP 4
NOP 4
MOV A,C 4
ORA B 4
JNZ DELAY 10/7
b) Write a program to add the two Hex numbers 7A and 46 and to store the sum at
memory location XX98H and the flag status at XX97H.
c) Write a program to clear the flags. Load data byte FFH into the accumulator and
add 01h to the byte FFH by using the instruction ADI. Mask all the flags except
the CY flag and display the CY flag at PORT0.
Q3. Answer any two. (2x10=20)
a) Data bytes are stored in memory locations from XX50H to XX55h. To insert an
additional five bytes of data, it is necessary to shift the data string by 5 memory
locations. Write a program to store the data string from XX55h to XX64H.
b) The following block of data is stored in the memory locations from XX55H to
XX5AH. Transfer the data to locations XX80H to XX85H in the reverse order.
Data(H) 22, A5, B2, 99, 7F, 37
c) Write a program to – clear the accumulator, add 47H, subtract 92H, add 64H and
display the results after subtracting 92H and adding 64H. Specify the answers you
would expect at the output ports.
Q5. Illustrate any four of the following instructions with examples. (4x5=20)
a) ADD B
b) SUI 34H
c) CPI 34H
d) CMA
e) POP PSW
f) INR B