DATE: ICC15 ASSIGNMENT ROLL NO.
:
V SEM ICE SECTION II
Q1. Write a program to perform subtraction of two 8-bit BCD numbers.
Soln.
1. ADD2BCD MOV AL, N1 LOAD FIRST BCD NUMBER
ADD AL, N2 ADD TO SECOND BCD NUMBER
DAA DECIMAL ADJUST
MOV [2000], AL STORE BCD SUM
RCR AL, 1 BRING CF FLAG TO MSB OF AL
AND AL, 80 MASK THE REMAINING BITS
MOV [2001], AL STORE THE CARRY STATUS
INT 3 TERMINATE THE PROGRAM
Q2. Find the state of the flags CF, ZF and OF after the following instructions are executed:
a. OR AH, BH
b. AND BL, CL
Given AX=008CH, BX=345EH, CX=67EBH
Soln.
2. a. AH=00; BH=34; RESULT = 34;
CF=0; ZF=0; OF=0;
b. BL=5E; CL=EB; RESULT=4A;
CF=0; ZF=0; OF=0;
Q3. Find the contents of AX and CL after the following program is executed:
STC
MOV AX, 5485
RCR AL, 1
MOV CL, 03
RCL AX, CL
Soln. STEP 1: CF=1
3. STEP 2: AX=5485; AH=54; AL=85
STEP 3: AL=C2 (AFTER ROTATE RIGHT THROUGH CARRY);CF=1
STEP 4: CL=3
STEP 5: AX=1010 0110 0001 0101; CF=0
AX=A615
CL=03
Q4. What is the duration of the bus-cycle in an 8086 based microcomputer, if the clock frequency is 12MHz
and three wait states are inserted?
Soln. CLOCK FREQUENCY =12MHZ
4. T-state = 1/12MHZ=83ns
One bus cycle + 3 Wait states = 4T +3T = 7T
Total time = 7*83ns
= 581 ns
Q5. Initialize 8255 in mode 0, with Port B and Port C upper as input ports and Port A and Port C lower as
output ports. Write a program to read the status of switches from Port B and Port C upper and display
the status on Port B and Port C lower.
Soln. Control word = 1000 1010 = 8AH
5. Assume addresses PA = FO; PB=F1; PC = F2; CWR = F3; (Arbitrarily chosen)
8255INOUT MOV AL, 8A INITIALIZE 8255 WITH PORT B AND PORT C
UPPER AS INPUT PORTS AND PORT A
OUT F3, AL AND PORT C LOWER AS OUTPUT PORTS
IN AL, F1 INPUT FROM PORT B
OUT F0, AL OUTPUT TO PORT A
IN AL, F2 INPUT FROM PORT C
AND AL, F0 MASK LOWER NIBBLE
MOV CL, 04
ROR AL, CL MAKE PORT C UPPER AS PORT C LOWER
OUT F2, AL OUTPUT FROM PORT C LOWER
INT 3 TERMINATE THE PROGRAM
Q6. Draw a diagram using memory banks for a 16KX16 RAM. Draw only the decoding circuit and
addressing to the even and odd banks.
DATE: ICC15 ASSIGNMENT ROLL NO.:
V SEM ICE SECTION II
Soln.
6
Q7. Explain the mode 2 of 8253, with suitable timing diagram.
Soln. Rate generator
7.
Q8. What is the purpose of using 8259? Can the 8086 work without this device?
Soln. (i) The PIC manages eight levels of requests and has built-in features for expandability to other
8 PIC (up to 64 levels).
(ii) It is programmed by system software as an I/O peripheral.
(iii) The priority modes can be changed or reconfigured dynamically at any time during main
program operation.
Q9. Draw the display section for a 8-bit display interfaced to 8279.
Soln.
9.
Q10. Give the format of ICW1, ICW2 and ICW4 of 8259.
Soln.
10