Professional Documents
Culture Documents
BCSL-022
BCSL-022
tech
• telegram - https://t.me/DalalTechnologies
• YouTube-https://www.youtube.com/channel/UCilEr1rW-SIrJlJ5_ioKQfw
Q1:
Design a two-bit down counter circuit that counts from 3 to 0. It should have states 11, 10, 01, and 00. The initial state of the counter
may be assumed to be 11. The counter will be in following successive states: 11, 10, 01, 00, 11, 10, 01, 00, 11, Use J-K flip flop to design
the circuit. You must design the circuit using state transition diagram and Karnaugh's maps.
Ans.
Design a 2-bit counter which counts from 3 to 0 means when D=1, the count sequence is 00,11,10,01,00.
Disclaimer/Note
These are just the sample of the answers/solution to some of the questions given in the assignments. Student should read and refer the official study material provided by
the university.
• Facebook-https://www.facebook.com/dalal.tech
• telegram - https://t.me/DalalTechnologies
• YouTube-https://www.youtube.com/channel/UCilEr1rW-SIrJlJ5_ioKQfw
Disclaimer/Note
These are just the sample of the answers/solution to some of the questions given in the assignments. Student should read and refer the official study material provided by
the university.
• Facebook-https://www.facebook.com/dalal.tech
• telegram - https://t.me/DalalTechnologies
• YouTube-https://www.youtube.com/channel/UCilEr1rW-SIrJlJ5_ioKQfw
Disclaimer/Note
These are just the sample of the answers/solution to some of the questions given in the assignments. Student should read and refer the official study material provided by
the university.
• Facebook-https://www.facebook.com/dalal.tech
• telegram - https://t.me/DalalTechnologies
• YouTube-https://www.youtube.com/channel/UCilEr1rW-SIrJlJ5_ioKQfw
Q2:
Write and run following programs using 8086 assembly language.
(a) Write and run a 8086 Assembly language program that converts a three digit ASCII number stored in three consecutive byte
locations in the memory, into a binary number. The output should be stored in DX register. For example, if three consecutive byte
locations contain '345' (please note they are three ASCII digits), then the DX should get binary equivalent of decimal number 543,
which is (0000 0010 0001 1111)2. This binary value will be stored in DX register.
ANS.
DATA SEGMENT
ARR DB ‘3’,’4′,’5′
HUN DB ?
TEN DB ?
UNT DB ?
LEN DW $-ARR
RES DW ?
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA CS:CODE
START:
MOV AX,DATA
MOV DS,AX
LEA SI,ARR
MOV AL,ARR[SI]
SUB AL,30H
MOV HUN,AL
INC SI
MOV AL,ARR[SI]
SUB AL,30H
MOV TEN,AL
INC SI
MOV AL,ARR[SI]
SUB AL,30H
MOV UNT,AL
MOV AX,0
MOV CL,100
MOV AL,HUN
MUL CL
MOV BX,AX
Disclaimer/Note
These are just the sample of the answers/solution to some of the questions given in the assignments. Student should read and refer the official study material provided by
the university.
• Facebook-https://www.facebook.com/dalal.tech
• telegram - https://t.me/DalalTechnologies
• YouTube-https://www.youtube.com/channel/UCilEr1rW-SIrJlJ5_ioKQfw
MOV AX,0
MOV CL,10
MOV AL,TEN
MUL CL
ADD AX,BX
MOV BX,0
MOV BL,UNT
ADD AX,BX
MOV RES,DX
MOV AH,4CH
INT 21H
CODE ENDS
END START
(B)
Write and run (using appropriate calling program) a near procedure in 8086 assembly language, which is passed a single parameter
by the calling program. The procedure checks if the input parameter has a value zero or not. If the value of input parameter is zero
then procedure/program is terminated, otherwise a value of 1 is returned to the calling program, which then continue to execute the
remaining program. Make and state suitable assumptions, if any.
Ans.
"DATA SEGMENT
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:
MOV AX,DATA
MOV DS,AX
LEA DX,MSG1
MOV AH,9
INT 21H
CALL PRINT_AL
MOV AH,4CH
INT 21H
CODE ENDS
MOV AH,1
INT 21H
MOV BL, AL
MOV AH,9
INT 21H
MOV DL, BL
MOV AH,2
INT 21H
RET
PRINT_AL ENDP
END START"
(c) Write and run a 8086 assembly language program that finds the sum of first N natural numbers. The value
of N is input to the assembly program. The sum is stored in DX register. Assume the value of N between 1
and 10 only.
Answer-
Input: 04H
Output: 0AH
as 01+02+03+04 = 10 in decimal => 0AH
The formula for calculating the sum of first n natural numbers is.
Algorithm –
In 8086 microprocessor, no direct instruction exists to multiply two numbers, so multiplication is done by repeated addition as 4×5 is equivalent to 4+4+4+4+4
(i.e., 5 times).
Input: 04H
Add 04H 5 times
Product: 14H(2010)
Similarly, in 8086 microprocessor, no direct instruction exists to divide two numbers, so division is done by repeated subtraction.
Input: 14H
Keep subtracting 2 from the input till it reduces to 0.
Since subtraction has to be performed 1010 times before 14H becomes 0, the quotient is 1010 => 0AH.
Steps –
• Load the data from the memory location (201DH, arbitrary choice) into the accumulator
• Move this data into D
• Increment the value in the accumulator by one and move it to the register X
• Initialise the accumulator with 0
• Multiplcation: Keep adding D to accumulator. The number of times D has to be added is equal to the value of X
• Initialise D with 00H. D will store the quotient of the division
• Initialise X with 02H. This is the divisor for the division
• Division: Keep subtracting C from A till A becomes 0. For each subtraction, increment B by one
• The final answer is in B. Move it to A. Then store the value of A in 201DX (arbitrary choice again)
Disclaimer/Note
These are just the sample of the answers/solution to some of the questions given in the assignments. Student should read and refer the official study material provided by
the university.
• Facebook-https://www.facebook.com/dalal.tech
• telegram - https://t.me/DalalTechnologies
• YouTube-https://www.youtube.com/channel/UCilEr1rW-SIrJlJ5_ioKQfw
Disclaimer/Note
These are just the sample of the answers/solution to some of the questions given in the assignments. Student should read and refer the official study material provided by
Copy protected with Online-PDF-No-Copy.com the university.