0% found this document useful (0 votes)
37 views16 pages

Solved Question Bank For ct2 Mic

The document is a question bank for CT2 that covers various addressing modes of the 8086 microprocessor, including examples for each mode. It also includes instructions for performing operations such as multiplication, division, and counting bits in numbers, along with explanations of procedures, macros, and recursive procedures. Additionally, it discusses the significance of the stack, string instructions, and provides assembly language programs (ALPs) for various tasks.

Uploaded by

Pranav Shingne
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views16 pages

Solved Question Bank For ct2 Mic

The document is a question bank for CT2 that covers various addressing modes of the 8086 microprocessor, including examples for each mode. It also includes instructions for performing operations such as multiplication, division, and counting bits in numbers, along with explanations of procedures, macros, and recursive procedures. Additionally, it discusses the significance of the stack, string instructions, and provides assembly language programs (ALPs) for various tasks.

Uploaded by

Pranav Shingne
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

SUBJECT :-MIC

22415 QUESTION BANK FOR CT2

1. Describe any six Addressing modes of 8086 with suitable example

1. Immediate addressing mode:


An instruction in which 8-bit or 16-bit operand (data ) is specified in the instruction, then the
addressing mode of such instruction is known as Immediate addressing mode.
Example: MOV AX,67D3H

2. Register addressing mode


An instruction in which an operand (data) is specified in general purpose registers, then the
addressing mode is known as register addressing mode.
Example: MOV AX,CX

3. Direct addressing mode


An instruction in which 16 bit effective address of an operand is specified in the instruction,
then the addressing mode of such instruction is known as direct addressing mode.
Example: MOV CL,[2000H]

4. Register Indirect addressing mode


An instruction in which address of an operand is specified in pointer register or in index
register or in BX, then the addressing mode is known as register indirect addressing mode.
Example: MOV AX, [BX]

5. Indexed addressing mode


An instruction in which the offset address of an operand is stored in index registers (SI or DI)
then the addressing mode of such instruction is known as indexed addressing mode. DS is the
default segment for SI and DI. For string instructions DS and ES are the default segments for
SI and DI resp. this is a special case of register indirect addressing mode.
Example:
MOV AX,[SI]

6. Based Indexed addressing mode


an instruction in which the address of an operand is obtained by adding the contents of base
register (BX or BP) to the content of an index register (SI or DI) The default segment register
may be DS or ES
Example:
MOV AX, [BX][SI]
7. Register relative addressing mode
An instruction in which the address of the operand is obtained by adding the displacement (8-
bit or 16 bit) with the contents of base registers or index registers (BX, BP, SI, DI). the default
segment register is DS or ES
Example: MOV AX, 50H[BX]

8. Relative Based Indexed addressing mode


An instruction in which the address of the operand is obtained by adding the displacement (8
bit or 16 bit) with the base registers (BX or BP) and index registers (SI or DI) to the default
segment.

2. Select the instruction for each of the following


i)Rotate register BH left 4 times.
ii)Multiply AL by 08H.
iii)Signed division of BL and AL.
iv)Move 4000H in BX register.
v)Load offset 1000H in register BX.
vi)Rotate BX to left 4 times through carry.

i) Rotate register BH left 4 times.


 Logical or bit manipulation Instructions
 This instruction rotates all bits in a specified byte or word to the left some number of
bit positions.
 MSB is placed as a new LSB and a new CF.
 E.g. ROL BH, 4
 Rotate all bit in BH left by FOUR bit position.

ii) Multiply AL by 08H.


MOV AL,08H
MUL AL : Immediate Addressing mode.
iii) Signed division of BL and AL.
MOV AL,N1
MOV BL,N2
IDIV BL : Divide a signed Byte in BL and Quotient in AL, remainder in BL

iv) Move 4000H in BX register.


MOV BX, 4000H :- Immediate Addressing mode.
BX is loaded with 16bit immediate data 4000H

v) Load offset 1000H in register BX.


Direct Addressing Mode
BX will be loaded with the content of memory location whose offset is 1000H from base
address
 MOV AX,[1000H]

vi) Rotate BX to left 4 times through carry.

Logical or bit manipulation Instructions


This instruction rotates all bits in a specified byte or word some number of bit positions to
the left along with the carry flag.
MSB is placed as a new carry and previous carry is place as new LSB.
E.g. RCL BX, 4
Rotate all bit in BX left by four bit position.
3. What is the use of REP in string related instruction?

a) What is the use of REP in string related instruction?


1] REP: REP is a prefix which is written before one of the string instructions. It will
cause during length counter CX to be decremented and the string instruction to be
repeated until CX becomes 0.

Two more prefix.


REPE/REPZ: Repeat if Equal /Repeat if Zero.
It will cause string instructions to be repeated as long as the compared bytes or words
are equal and CX≠0.
REPNE/REPNZ: Repeat if not equal/Repeat if not zero.
It repeats the strings instructions as long as compared bytes or words are not equal
and CX≠0.
Example: REP MOVSB
4. With examples, describe any four String instructions in 8086 assembly language.

1.MOVSB / MOVSW :
 Move String Byte or String Word
 A string of bytes stored in a set of consecutive memory locations is to be moved
to another set of destination locations.
 The starting byte of source string is located in the memory location whose
address may be computed using SI (Source Index) and DS (Data Segment)
contents.
 The starting address of the destination locations where this string has to be
relocated is given by DI (Destination Index) and ES (Extra Segment) contents.

2.CMPS : Compare String Byte or String Word


 The CMPS instruction can be used to compare two strings of byte or words.
 The length of the string must be stored in the register CX. If both the byte or
word strings are equal, zero Flag is set.

3. SCAN : Scan String Byte or String Word


 This instruction scans a string of bytes or words for an operand byte or word
specified in the register AL or AX. The String is pointed to by ES:DI register
pair.
 The length of the string s stored in CX.

4.LODS : Load String Byte or String Word


 The LODS instruction loads the AL / AX register by the content of a string pointed
to by DS : SI register pair. The SI is modified automatically depending upon DF,
 If it is a byte transfer (LODSB), the SI is modified by one and
 if it is a word transfer (LODSW), the SI is modified by two.
 No other Flags are affected by this instruction.

5. What is stack? state its significance.


STACK: Simplified Stack Segment directive
This simplified segment directive define the stack segment
Default size of the stack is 1024 bytes.
General form: STACK
. STACK 100

6. Draw the flowchart for Multiplication of two 16 bit numbers.

ALGORITHM
1. Data initialization
2. Load N1 no.in AX
3. Load N2 no.in BX
4. Multiply in BX
5. Store result in AX and DX.
6. END

7. Draw the Machine language instruction format for Register to Register transfer and state
the function of each bit.
8. Write an ALP to perform 16-bit division of unsigned numbers.

16BIT DIVISION (IDIV)


ASSUME CS:CODE, DS:DATA
DATA SEGMENT
N1 DD 20000H
N2 DW 100H
QUOTIENT DW ?
REMAINDER DW ?
DATA ENDS
CODE SEGMENT
START: MOV AX,DATA
MOV DS, AX
MOV AX,[BX]
DIV CX
MOV [BX], AX
MOV AX,[ BX +2]
DIV CX
MOV [BX +2], AX
MOV AX, N1
MOV BX, N2
DIV BX
MOV QUOTIENT, AX
MOV REMAINDER, DX
MOV AH, 4CH
INT 21H
CODE ENDS
END START

9. Write an ALP to count number of ‘1’ in 16-bit number.


PROGRAM FIND ONES IN GIVEN NUMBERS

DATA SEGMENT
NUM DW 50H
ONES DW ?
RESULT DW ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV CX,02H
MOV AX,NUM
UP: ROR AX,1
JC DOWN
INC ONES
DOWN: LOOP UP
MOV AX, RESULT
MOV AH,4CH
INT 21H
CODE ENDS
END START

10.Write an ALP to count the number of positive and negative numbers in array.
DATA SEGMENT
DATA SEGMENT
NUM DB 10H
POS DB ?
NEG DB ?

RESULT DB ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV AL,NUM
ROL AL,1
JNC DOWN
ROL AL,1
MOV POS,AL

DOWN: ROL AL,1


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

11.Write an ALP to find the smallest number in the Array.


DATA SEGMENT
ARRAY DB 78H,23H,12H,04H,08H
SMALLEST DB ?
RESULT DB ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV CX,05H
MOV AL,[SI]
DEC CX
UP: INC SI
CMP AL,[SI]
JC NEXT
MOV AL,[SI]
NEXT: LOOP UP
CMP AL,[SI]
MOV SMALLEST,AL
MOV AH,4CH
INT 21H
CODE ENDS
END START

12.State the advantages and disadvantages of using Procedure.


Advantages:
1) Modular programming
2) Reduced to work load and development time
3) Debugging of program easier
4) Reduction of line of code
5) Reusability of code
6) Library of procedure can be implemented.

Disadvantages of using Procedure


 Disadvantage using the procedures is the need for the stack
 Extra code is require to integrated procedure i.e. CALL and RET instruction.
 Run time required more between small procedure.

13.Define Procedure and write its syntax.

1) Procedure is a series of instructions is to be executed several times in a program, and


called whenever required.
2) Program control is transferred to the procedure, when CALL instruction is executed at
run time.
3) Memory required is less
4) Stack is required at Procedure CALL.
5) Extra overhead time is required for linkage between the calling program and called
procedure.
6) Parameters passed in registers, memory locations or stack.
7) RET is required at the end of the Procedure.
8) Procedure is called using: CALL <Procedure_name>
Directives used: PROC, ENDP, FAR,NEAR

General Form :
Procedure Name PROC
-------------------------------------
Procedure Statements
-------------------------------------
Procedure Name ENDP.

14.What do you mean by Recursive procedure?


Definition Recursive Procedures:
A recursive procedure is a procedure which calls itself. Here, the program sets aside
a few locations in stack for the storage of the parameters which are passed each
time the computation is done and the value is returned. Each value returned is then
obtained by popping back from the stack at every RET instruction when executed at
the end of the procedure.

15.Give the difference between Inter segment and Intra segment CALL.
16.Compare Procedure and macro based on i) length of code ii) generation of object code
iii) Calling method iv) Passing parameter.

Parameters Procedure macro


Length of code Length of object code file is Length of object code file become
less lengthy
Generation of Object code is generated Object code is generated everytime
object code only once in memory the macro is called
Calling method CALL and RET instructions Macro can be called just by writing
are used to call procedure its name.
and return from procedure
Passing parameter. Parameters can be passed in Parameters are passed as a part of
register memory location or the statement in which macro is
stack. called.

17.Describe re-entrant and Recursive procedure with diagram.

Explain re-entrant procedure with diagram

Ans:

 In some situation it may happen that Procedure 1 is called from main program
 Procrdure2 is called from procedure1And procedure1 is again called from procdure2.
 In this situation program execution flow re-enters in the procedure1. These types of
 procedures are called re-entrant procedures.
 A procedure is said to be re-entrant, if it can be interrupted, used and re-entered
without losing or writing over anything.,
18.What is the difference between Near and Far Procedure?
19.Define Macro.

20.Write an ALP for addition of two 8 bit BCD numbers using MACRO.
ASSUME CS:CODE,DS:DATA
DATA SEGMENT

NUM1 DB 04H
NUM2 DB 06H
BCD_SUM DB ?
DATA ENDS
CODE SEGMENT
START:MOV AX,@DATA
MOV DS, AX
MOV AL, NUM1
MOV BL, NUM2
ADD AL,BL
DAA
MOV BCD_SUM, AL
MOV AH,4CH
INT 21H
ENDM
ENDS
END START

You might also like