You are on page 1of 5

PIXELES

CLASSES

PIXELES CLASSESPage | 1
MCA (IGNOU)

BCA &

Course Code
: BCSL-022
Course Title
: Assembly Language Programming Lab
Assignment Number : BCA(II)/L-022/Assignment/2015
Last Dates for Submission: 15 October, 2015 (For July 2015 Session) April,
2016 (For January 2016 Session)

1. Design a two bit down counter circuit that count from 11 to 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 any flip flop to design the circuit. You must design them using state
transition diagram and Karnaugh's map. (10 Marks)
Ans:

www.pixelesindia.com

PIXELES
CLASSES

PIXELES CLASSESPage | 2
MCA (IGNOU)

BCA &

2. Write and run the following programs using 8086 assembly


language.(30 Marks)
(a) Write and run an Assembly language program that counts the
occurrence of alphabet A (irrespective of case) in a sting. For example,
for the string AXabAYaf, the output will be 4. You may assume that the
string is available in the memory and output is stored in the AL register.

www.pixelesindia.com

PIXELES
CLASSES

PIXELES CLASSESPage | 3
MCA (IGNOU)

BCA &

Ans.
DATA SEGMENT
.MODEL SMALL
.STACK 100H
STRING DB AXABAYAF , $
RESULT DB ?

We are teaching IGNOUs BCA & MCA


Students

DATA END
CODE SEGMENT

Why join us?

LENGTH DB $-STRING
MAIN PROC
MOV AX, @DATA
MOV DS, AX
MOV AL,00H

Regular Classes
BCA & MCA IGNOU Special Institute
Free Trial Classes
Subjective Knowledge
Free PIXELES Guide Books (Prepared by our

teachers)
Free Solved Assignments
Experienced Faculties
100% Results
Home Test Series
Class Test Series
We teach you until you pass
Final Year Synopsis & Project
Proper Guidance

MOV SI, OFFSET STRING


MOV CX, LENGTH
BACK: MOV BH, [SI]
CMP BH, A
JNZ LABEL
INC AL
LABEL: INC SI
LOOP BACK
MOV RESULT, AL
MOV AH, 4CH
INT 21H
MAIN ENDP
ENDS CODE

(b) Write and run (using appropriate calling program) a near procedure
in assembly language that converts a packed 2 digit BCD number stored
in AL register to equivalent Binary number. For example, if AL contains
a packed BCD number 64 as 0110 0100, then the program will convert
this BCD to equivalent binary number 01000000. The binary number
should be returned back in the AL register itself.
Ans:
DATA_SEGSEGMENT

www.pixelesindia.com

PIXELES
CLASSES

PIXELES CLASSESPage | 4
MCA (IGNOU)
BCD DB 25h
BIN

DB ?

DATA_SEGENDS
STACK_SEGSEGMENT STACK
DW 100 DUP(0)
TOP_STACK LABEL WORD
STACK_SEGENDS
CODE_SEG SEGMENT
ASSUME CS:CODE_SEG, DS:DATA_SEG, SS:STACK_SEG
START: MOV AX, DATA_SEG
MOV DS, AX
MOV AX, STACK_SEG
MOV SS, AX
MOV SP, OFFSET TOP_STACK
MOV SI, OFFSET BCD
MOV DI, OFFSET BIN
CALL BCD_BINARY
BCD_BINARYPROC NEAR
PUSHF
PUSH AX
PUSH BX
PUSH CX
MOV AL, [SI]
MOV BL, AL
AND BL, 0Fh
AND AL, 0F0h
MOV CL, 04
ROR AL, CL
MOV BH, 0Ah
MUL BH
ADD AL, BL
MOV [DI], AL
POP CX
POP BX
POP AX

www.pixelesindia.com

BCA &

PIXELES
CLASSES

PIXELES CLASSESPage | 5
MCA (IGNOU)

BCA &

POPF
RET
BCD_BINARY ENDP
CODE_SEGENDS
END START
(c) Write and run an assembly language program that multiplies two
numbers (of size one byte only) stored in the memory. The result should
be output on the computer monitor.
Ans:
DATA SEGMENT
NUM1 DB 25h
NUM2 DB 80h
RESULT DB ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV DS, AX
MOV AL, NUM1
ADD AL, NUM2
MOV RESULT, AL
RCL AL, 01

Branches & Contacts Details

AND AL, 00000001B

agar:-WZ-B7, Old Pankha Road (Opp.


Primary School),
Near
East
Metro
Station, Uttam Nagar,
NewRoad,
Delhi-59
Nangloi:-Plot.
No-19,
Ext2A,
oppBanke-Bihari,
Talabwali
Na

MOV CARRY, AL
MOV AH, 4CH
INT 21H
CODE ENDS
END START

Ph: 9213327975, 9716339580


8750321695
, web: www.pixelesindia.com

www.pixelesindia.com

You might also like