Model Answer Paper Winter 2019
Model Answer Paper Winter 2019
(Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2013 Certified) (ISO/IEC - 27001 - 2013 Certified)
Page 1 | 23 Page 2 | 23
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2013 Certified) (ISO/IEC - 27001 - 2013 Certified)
5. More stack locations are Less stack locations are I-Interrupt Flag it is used to mask(disable) or unmask(enable)the INTR
required required interrupt. When this flag is set,8086 recognizes interrupt INTR. When it
is reset INTR is masked.
Page 3 | 23 Page 4 | 23
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2013 Certified) (ISO/IEC - 27001 - 2013 Certified)
D-Direction Flag It selects either increment or decrement mode for DI &/or Operation
SI register during string instructions.
Destination OR source
c Explain assembly language program development steps. 4M
Ans 1. Defining the problem: The first step in writing program is to think very Correct steps Flags Affected :CF=0,OF=0,PF,SF,ZF
carefully about the problem that the program must solve. 4M This instruction OR’s each bit in a source byte or word with the
2. Algorithm: The formula or sequence of operations to be performed by the corresponding bit in a destination byte or word. The result is put in a
program can be specified as a step in general English is called algorithm. specified destination.
3. Flowchart: The flowchart is a graphically representation of the program
operation or task. Example :
4. Initialization checklist: Initialization task is to make the checklist of
entire variables, constants, all the registers, flags and programmable ports • OR AL,BL
5. Choosing instructions: Choose those instructions that make program • AL 1111 1100
smaller in size and more importantly efficient in execution. • BL 0000 0011
6. Converting algorithms to assembly language program: Every step in ---------------------
the algorithm is converted into program statement using correct and efficient
• AL1111 1111
instructions or group of instructions.
d Explain logical instructions of 8086.(Any Four) 4M
3) NOT – Logical Invert
Ans Logical instructions. Any 4
instruction Syntax : NOT destination
1) AND- Logical AND correct
explanation Operation: Destination NOT destination
Syntax : AND destination, source
1M each
Flags Affected :None
Operation
The NOT instruction inverts each bit of the byte or words at the
Destination ←destination AND source
specified destination.
Flags Affected :CF=0,OF=0,PF,SF,ZF
Example
This instruction AND’s each bit in a source byte or word with the
NOT BL
same number bit in a destination byte or word. The result is put in
destination. BL = 0000 0011
Example: AND AX, BX NOT BL gives 1111 1100
• AND AL,BL 4) XOR – Logical Exclusive OR
• AL 1111 1100
• BL 0000 0011 Syntax : XOR destination, source
---------------------
Operation : Destination Destination XOR source
• AL0000 0000 (AND AL,BL)
Flags Affected :CF=0,OF=0,PF,SF,ZF
2) OR – Logical OR This instruction exclusive, OR’s each bit in a source byte or word
with the same number bit in a destination byte or word.
Syntax :OR destination, source
Page 5 | 23 Page 6 | 23
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2013 Certified) (ISO/IEC - 27001 - 2013 Certified)
Example(optional)
XOR AL,BL
• AL 1111 1100
• BL 0000 0011
---------------------
5)TEST
Syntax : TEST Destination, Source
This instruction AND’s the contents of a source byte or word with the
contents of specified destination byte or word and flags are updated, ,
flags are updated as result ,but neither operands are changed.
Operation performed:
Flags set for result of (destination AND source)
Example: (Any 1)
TEST AL, BL ; AND byte in BL with byte in AL, no result, Update PF,
SF, ZF.
Page 7 | 23 Page 8 | 23
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2013 Certified) (ISO/IEC - 27001 - 2013 Certified)
INC SI PROG x, y
Page 9 | 23 Page 10 | 23
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2013 Certified) (ISO/IEC - 27001 - 2013 Certified)
Page 11 | 23 Page 12 | 23
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2013 Certified) (ISO/IEC - 27001 - 2013 Certified)
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START: MOV DX,DATA
MOV DS, DX
MOV CL,05H
MOV SI, OFFSET NUM1
UP: CALL SUM
INC SI
LOOP UP
MOV AH,4CH
INT 21H
Page 13 | 23 Page 14 | 23
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2013 Certified) (ISO/IEC - 27001 - 2013 Certified)
OFFSET
OFFSET is an operator, which tells the assembler to determine the offset or
displacement of a named data item (variable), a procedure from the start of
the segment, which contains it.
Example
MOV BX;
OFFSET PRICES;
It will determine the offset of the variable PRICES from the start of the
segment in which PRICES is defined and will load this value into BX.
SEGMENT
The SEGMENT directive is used to indicate the start of a logical segment.
DS=345AH and SI=13DCH
Preceding the SEGMENT directive is the name you want to give the
Physical adress = DS*10H + SI segment.
For example, the statement CODE SEGMENT indicates to the assembler
= 345AH * 10H + 13DCH the start of a logical segment called CODE. The SEGMENT and ENDS
directive are used to “bracket” a logical segment containing code of data
= 345A0+13DC
EVEN (ALIGN ON EVEN MEMORY ADDRESS)
= 3597CH As an assembler assembles a section of data declaration or instruction
b Explain the use of assembler directives. 1) DW 2) EQU 3) ASSUME 4) 2M statements, it uses a location counter to keep track of how many bytes it is
OFFSET 5) SEGMENT 6) EVEN from the start of a segment at any time. The EVEN directive tells the
Ans DW (DEFINE WORD)
assembler to increment the location counter to the next even address, if it is
Each
not already at an even address. A NOP instruction will be inserted in the
The DW directive is used to tell the assembler to define a variable of type Directive
location incremented over.
word or to reserve storage locations of type word in memory. The statement Use : 1M
MULTIPLIER DW 437AH, for example, declares a variable of type word each c Describe any four string instructions of 8086 assembly language. 2M
named MULTIPLIER, and initialized with the value 437AH when the Ans 1] REP: each correct
program is loaded into memory to be run. instruction
REP is a prefix which is written before one of the string instructions. It will 1½ M each
EQU (EQUATE) cause During length counter CX to be decremented and the string instruction
EQU is used to give a name to some value or symbol. Each time the to be repeated until CX becomes 0.
assembler finds the given name in the program, it replaces the name with
the value or symbol you equated with that name.
Page 15 | 23 Page 16 | 23
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2013 Certified) (ISO/IEC - 27001 - 2013 Certified)
Page 17 | 23 Page 18 | 23
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2013 Certified) (ISO/IEC - 27001 - 2013 Certified)
5] LODS/LODSB/LODSW: Example:
Load String byte into AL or Load String word into AX. MOV AX,CX
Syntax: 3. Direct addressing mode
LODS/LODSB/LODSW 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
Operation: AL/AX < ----- DS: [SI] direct addressing mode.
IT copies a byte or word from string pointed by SI in data segment into AL Example:
or AX.CX
MOV CL,[2000H]
may contain the counter and DF may be either 0 or 1 4. Register Indirect addressing mode
Example 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
LEA SI, destination
indirect addressing mode.
CLD
Example:
LODSB
MOV AX, [BX]
6] STOS/STOSB/STOSW (Store Byte or Word in AL/AX)
5. Indexed addressing mode
Syntax STOS/STOSB/STOSW
An instruction in which the offset address of an operand is stored in index
Operation: ES:[DI] < ----- AL/AX registers (SI or DI) then the addressing mode of such instruction is known as
indexed addressing mode.
It copies a byte or word from AL or AX to a memory location pointed by DI
in extra DS is the default segment for SI and DI.
segment CX may contain the counter and DF may either set or reset 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.
6. Attempt any Two of the following: 12M
Example:
a Describe any 6 addressing modes of 8086 with one example each. 6M
Ans 1. Immediate addressing mode: Any 6 mode MOV AX,[SI]
with example
An instruction in which 8-bit or 16-bit operand (data) is specified in the 1 M each 6. Based Indexed addressing mode:
instruction, then the addressing mode of such instruction is known as
Immediate addressing mode. An instruction in which the address of an operand is obtained by adding the
content of base register (BX or BP) to the content of an index register (SI or
Example: DI) The default segment register may be DS or ES
MOV AX,67D3H Example:
2. Register addressing mode MOV AX, [BX][SI]
An instruction in which an operand (data) is specified in general purpose 7. Register relative addressing mode: An instruction in which the address
registers, then the addressing mode is known as register addressing mode. of the operand is obtained by adding the displacement (8-bit or 16 bit) with
Page 19 | 23 Page 20 | 23
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2013 Certified) (ISO/IEC - 27001 - 2013 Certified)
the contents of base registers or index registers (BX, BP, SI, DI). The default Or
segment register is DS or ES.
MOV CL, 04H
Example:
ROR AX, CL
MOV AX, 50H[BX]
Page 21 | 23 Page 22 | 23
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
MOV [DI],AL
INC SI
DEC DI
LOOP UP
MOV AH,4CH
INT 21H
CODE ENDS
END START
Flowchart:
Page 23 | 23