Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
INDEX
Instruction Queue
1. To increase the execution speed, BIU fetches as many as six instruction bytes ahead
to time from memory.
2. All six bytes are then held in first in first out 6 byte register called instruction
queue.
3. Then all bytes have to be given to EU one by one.
4. This pre fetching operation of BIU may be in parallel with execution operation of
EU, which improves the speed execution of the instruction.
1. AX Register:
AX register is also known as accumulator register that stores operands for arithmetic
operation like divided, rotate.
2. BX Register:
This register is mainly used as a base register. It holds the starting base location of a
memory region within a data segment.
3. CX Register:
It is defined as a counter. It is primarily used in loop instruction to store loop counter.
4. DX Register:
DX register is used to contain I/O port address for I/O instruction.
4
Segment Registers
Additional registers called segment registers generate memory address when
combined with other in
Flags Register determines the current state of the processor. They are modified
automatically by CPU after mathematical operations, this allows to determine the type
of the result, and to determine conditions to transfer control to other parts of the
program. 8086 has 9 flags and they are divided into two categories:
1. Conditional Flags
2. Control Flags
Conditional Flags
Conditional flags represent result of last arithmetic or logical instruction executed.
Conditional flags are as follows:
· Carry Flag (CF): This flag indicates an overflow condition for unsigned integer
arithmetic. It is also used in multiple-precision arithmetic.
· Auxiliary Flag (AF): If an operation performed in ALU generates a carry/barrow
from lower nibble (i.e. D0 – D3) to upper nibble (i.e. D4 – D7), the AF flag is set i.e.
carry given by D3 bit to D4 is AF flag. This is not a general-purpose flag, it is used
internally by the processor to perform Binary to BCD conversion.
· Parity Flag (PF): This flag is used to indicate the parity of result. If lower order
8-bits of the result contains even number of 1’s, the Parity Flag is set and for odd
number of 1’s, the Parity Flag is reset.
· Zero Flag (ZF): It is set; if the result of arithmetic or logical operation is zero else
it is reset.
· Sign Flag (SF): In sign magnitude format the sign of number is indicated by MSB
bit. If the result of operation is negative, sign flag is set.
· Overflow Flag (OF): It occurs when signed numbers are added or subtracted. An
OF indicates that the result has exceeded the capacity of machine.
Control Flags
Control flags are set or reset deliberately to control the operations of the execution
unit. Control flags are as follows:
2.ARITHMETIC INSTRUCTIONS
These instructions are those which are useful to perform Arithmetic calculations, such
as addition, subtraction, multiplication and division.They are again classified into four
groups.They are:
4. STRING INSTRUCTIONS
The string instructions function easily on blocks of memory.They are user friendly
instructions, which help for easy program writing and execution. They can speed up
the manipulating code.They are useful in array handling, tables and records.
STRING INSTRUCTIONS
REP
REPE / REPZ
REPNE / REPNZ
MOVS / MOVSB / MOVSW
COMPS / COMPSB / COMPSW
SCAS / SCASB / SCASW
LODS / LODSB / LODSW
STOS / STOSB / STOSW
These instructions transfer the program control from one address to other address.
( Not in a sequence). They are again classified into four groups.They are:
JBE/ JO
JNA JP / JPE
JC JS
JE / JZ
JG/
JNLE
JGE/
JNL
JL/
JNGE
These instructions are used to change the process of the Microprocessor. They change
the process with the stored information. They are again classified into Two
groups.They are:
FLAG SET / EXTERNAL HARDWARE
CLEAR INSTRUCTIONS SYNCHRONIZATION
INSTRUCTIONS
STC HLT
CLC WAIT
CMC ESC
STD LOCK
CLD NOP
STI
CLI
10
The Microsoft Macro Assembler (MASM) is an x86 assembler that uses the Intel
syntax for MS-DOS and Microsoft Windows. Beginning with MASM 8.0 there are
two versions of the assembler - one for 16-bit and 32-bit assembly sources, and
another (ML64) for 64-bit sources only.
MASM is maintained by Microsoft, but since version 6.12 has not been sold as a
separate product, it is instead supplied with various Microsoft SDKs and C compilers.
Recent versions of MASM are included with Microsoft Visual Studio.
History
The earliest versions of MASM date back to 1981.
Up to version 5.0, MASM was available as an MS-DOS application only. Versions 5.1
and 6.0 were available as both MS-DOS and OS/2 applications.
Version 6.0, released in 1992, added high-level programming support and a more
C-like syntax. By the end of the year, version 6.1A updated the memory management
to be compatible with code produced by Visual C++. In 1993 full support for 32-bit
applications and the Pentium instruction set was added. The MASM binary at that
time was shipped as a "bi-modal" DOS-extended binary (using the Phar Lap TNT
DOS extender).
Versions 6.12 to 6.14 were implemented as patches for version 6.11. These patches
changed the type of the binary to native PE format; version 6.11 is the last version of
MASM that will run under MS-DOS.
By the end of 1997 MASM fully supported Windows 95 and included some
AMD-specific instructions.
In 1999 Intel released macros for SIMD and MMX instructions, which were shortly
after supported natively by MASM. With the 6.15 release in 2000, Microsoft
discontinued support for MASM as a separate product, instead subsuming it into the
Visual Studio toolset. Though it was still compatible with Windows 98, current
versions of Visual Studio were not. Support for 64-bit processors was not added until
the release of Visual Studio 2005, with MASM 8.0.
Early versions of MASM generated object modules using the OMF format, which was
used to create binaries for MS-DOS or OS/2.
Since version 6.1, MASM is able to produce object modules in the Portable
Executable (PE/COFF) format. PE/COFF is compatible with recent Microsoft C
compilers, and object modules produced by either MASM or the C compiler can be
routinely intermixed and linked into Win32 and Win64 binaries.
11
IDEs
• RadASM
• WinAsm Studio
• EasyCode
• Visual Studio
Debuggers
• OllyDbg
Disassemblers
• IDAPro the Interactive Disassembler
ASSEMBLE A [ADDRESS]
COMPARE C RANGE ADDRESS
DUMP D [RANGE]
ENTER E ADDRESS [LIST]
FILL F RANGE LIST
GO G [=ADDRESS] [ADDRESSES]
HEX H VALUE 1 VALUE 2
INPUT I PORT
LOAD L [ADDRESS] [DRIVE] [FIRSTSECTOR] [NUMBER]
MOVE M RANGE ADDRESS
NAME N [PATHNAME] [ARGLIST]
OUTPUT O PORT TYPE
PROCEED P [=ADDRESS] [NUMBER]
QUIT Q
REGISTER R [REGISTER]
SEARCH S RANGE LIST
TRACE T [=ADDRESS] [VALUE]
UNASSEMBLE U [RANGE]
WRITE W [ADDRESS] [DRIVE] [FIRSTSECTOR] [NUMBER]
14
6(i)
6(i).. Aim
Aim:: To perform (i) addition and (ii) subtraction of two 8 bit numbers using
80866 microprocessor and get the result in hexadecimal.
808
Apparatus UsedUsed:: MASM SOFTWARE
SOFTWARE..
Program:
DATA SEGMENT
NUM DW 00h
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA, CS:CODE
6(ii)
6(ii).. Aim
Aim:: To perform (i) addition and (ii) subtraction of two 8 bit numbers using
80866 microprocessor and get the result in hexadecimal.
808
Apparatus UsedUsed:: MASM SOFTWARE
SOFTWARE..
Program:
DATA SEGMENT
NUM DW 00h
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA, CS:CODE
7(i)
7(i).. Aim
Aim:: To perform (i) addition and (ii) subtraction of two 16 bit numbers
80866 microprocessor and get the result in hexadecimal.
using 808
Apparatus UsedUsed:: MASM SOFTWARE
SOFTWARE..
Program:
DATA SEGMENT
NUM1 DW 1111H
NUM2 DW 2222H
RESULT DW 00
DATA ENDS
CODE SEGMENT
ASSUME CS: CODE, DS: DATA
START:
MOV AX, DATA
MOV DS, AX
MOV AX, 00H
MOV AX, NUM1
ADD AX, NUM2
MOV RESULT, AX
INT 03H
CODE ENDS
END START
END
17
7(ii)
7(ii).. Aim
Aim:: To perform (i) addition and (ii) subtraction of two 16 bit
bitss numbers
using 8085 microprocessor and get the result in hexadecimal.
Apparatus UsedUsed:: MASM SOFTWARE
SOFTWARE..
Program:
DATA SEGMENT
NUM1 DW 5555H
NUM2 DW 2222H
RESULT DW 00
DATA ENDS
CODE SEGMENT
ASSUME CS: CODE, DS: DATA
START:
MOV AX, DATA
MOV DS, AX
MOV AX, 00H
MOV AX, NUM1
SUB AX, NUM2
MOV RESULT, AX
INT 03H
CODE ENDS
END START
END
18
8. Aim
Aim:: To perform multiplication of two 8s bit numbers using 808
80866
microprocessor and get the result in hexadecimal.
Used:: MASM SOFTWARE
Apparatus Used SOFTWARE..
Program:
MAIN SEGMENT
NUM1 DB 02
NUM2 DB 05
REST1 DB 00
REST2 DB 00
MAIN ENDS
MAT SEGMENT
START: MOV AX, MAIN
MOV DS, AX
MOV AX, 00
MOV AL, NUM1
MOV BL, NUM2
MUL BL
MOV REST1, AL
MOV RSET2, AH
INT 03H
MAT ENDS
END START
END
19
9. Aim
Aim:: To perform multiplication of two 16 bit bitss numbers using 808
80866
microprocessor and get the result in hexadecimal.
Used:: MASM SOFTWARE
Apparatus Used SOFTWARE..
Program:
DATA SEGMENT
DATA1 DW 3333H
DATA2 DW 2222H
PROD DW 00
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
MOV AX,DATA
MOV DS,AX
MOV AX,DATA1
MUL DATA2
MOV PROD,AX
MOV PROD+2,DX
INT 03H
CODE ENDS
END START
END
20
10. Aim
Aim:: To perform division of 16 bits number by 8 bit
bitss numbers using 808
80866
microprocessor and get the result in hexadecimal.
Used:: MASM SOFTWARE
Apparatus Used SOFTWARE..
Program:
DATA SEGMENT
NUM1 DW 0048H
NUM2 DB 08H
QUO DB 01H DUP(?)
REM DB 01H DUP(?)
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV AH, 00H
MOV AL, NUM1
DIV NUM2
MOV QUO, AL
MOV REM, AH
INT 03H
CODE ENDS
END START
END
21
11. Aim
Aim:: To perform division of 16 bit
bitss number by 16 bits number using 808
80866
microprocessor and get the result in hexadecimal.
Used:: MASM SOFTWARE
Apparatus Used SOFTWARE..
Program:
DATA SEGMENT
NUM1 DW 4848H
NUM2 DW 1111H
QUO DW 01H DUP(?)
REM DW 01H DUP(?)
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV AX, NUM1
DIV NUM2
MOV QUO, AX
MOV REM, DX
INT 03H
CODE ENDS
END START
END
22
12. Aim
Aim:: Write an ALP to find the factorial of a given number using 808
80866
microprocessor and get the result in hexadecimal.
Used:: MASM SOFTWARE
Apparatus Used SOFTWARE..
Program:
DATA SEGMENT
NUMBER DW 0005
FACT DW ?
DATA ENDS
STACK_SEG SEGMENT STACK
DW 40 DUP (0)
STACK_TOP LABEL WORD
STACK_SEG ENDS
CODE SEGMENT
START:
MOV AX, DATA
MOV DS, AX
MOV AX, STACK_SEG
MOV SS, AX
MOV SP, OFFSET STACK_TOP
MOV CX, NUMBER
MOV BX, 01
NEXT: MOV AX, CX
CMP AX, 0H
JE FINISH
MUL BX
MOV BX, AX
LOOP NEXT
FINISH: MOV FACT, BX
INT 03H
CODE ENDS
END START
END
23
24
13. Aim
Aim:: Write an ALP to find the number of characters in a given string using
80866 microprocessor
808 microprocessor..
Used:: MASM SOFTWARE
Apparatus Used SOFTWARE..
Program:
DATA SEGMENT
DATA1 DB 'BaLKRISHNaPRaVEEN$'
ALPHABET DB ?
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV ALPHABET, 0
MOV DH, 0
MOV AH, 0
MOV BX, OFFSET DATA1
MOV CX, 21
NEXT: MOV AL, [BX]
CMP AL, 61H
JNE APHA
MOV AL, ALPHABET
ADD AL, 01
DAA
MOV ALPHABET, AL
APHA: INC BX
LOOP NEXT
MOV AL, ALPHABET
INT 03H
CODE ENDS
END START
END
25
26
14. Aim
Aim:: Write an ALP to arrange an array of Data in ascending/descending
80866 microprocessor
order using 808 microprocessor...
Used:: MASM SOFTWARE
Apparatus Used SOFTWARE..
Program:
DATA SEGMENT
DATA1 DB 20H,28H,15H,26H,19H,27H,16H,29H
TEMP DB ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA, SS:STACK_SEG
1.What is a Microprocessor?
Microprocessor is a CPU fabricated on a single chip, program-controlled device,
which fetches the instructions from memory, decodes and executes the instructions.
3. What is Bandwidth ?
The number of bits processed by the processor in a single instruction.
37.What is an Interrupts
Def:- An interrupt operation suspends execution of a program so that the system can
take special action.The interrupt routine executes and normally returns control to the
interrupted procedure, which then resumes execution.BIOS handles Int 00H-1FH,
whereas DOS handles INT 20H-3FH.
39.What is an Operand?
A:-The data on which the operation is to be performed is called as an Operand.
A CALL instruction leaves information on the stack so that the original program
execution sequence can be resumed.
43.What is an Instruction?
A:-An instruction is a binary pattern enetered through an input device to command the
microprocessor to perform that specific function.
45.What is Assembler?
A:-The assembler translates the assembly language program text which is given as
input to the assembler to their binary equivalents known as object code.
The time required to translate the assembly code to object code is called access
time.The assembler checks for syntax errors&displays them before giving the object
code.
46.Define Variable?
A:-A Variable is an identifier that is associated with the first byte of data item.
47.Explain Dup?
A:-The DUP directive can be used to initialize several location & to assign values to
these locations.
48.Define Pipelining?
A:-In 8086,to speedup the execution program,the instructions fetching and execution
of instructions are overlapped each other.this is known as Pipelining.
The signal M/IO is used to differentiate memory address and 1/0 address When the
processor is accessing memory locations MI 10 is asserted high and when it is
accessing 1/0 mapped devices it is asserted low.
38
17. How clock signal is generated in 8086? What is the maximum internal clock
frequency of 8086?
The 8086 does not have on-chip clock generation circuit. Hence the clock generator
chip, 8284 is connected to the CLK pin of8086. The clock signal supplied by 8284 is
divided by three for internal use. The maximum internal clock frequency of8086 is
5MHz.
18. Write the special functions carried by the general purpose registers of 8086.
The special functions carried by the registers of 8086 are the following.
Register Special function
1. AX 16-bit Accumulator
2. AL 8-bit Accumulator
3. BX Base Register
4. CX Count Register
5. DX .Data Register
six T-states.
26. What is the difference between CPU bus and system bus?
The CPU bus has multiplexed lines but the system bus has separate lines for each
signal. (The multiplexed CPU lines are de-multiplexed by the CPU interface circuit to
form system bus).
29. Why EPROM is mapped at the beginning of memory space in 8085 system?
In 8085 microprocessor, after a reset, the program counter will have OOOOH address.
If the monitor program is stored from this address then after a reset, it will be
executed automatically. The monitor program is a permanent program and stored in
EPROM memory. If EPROM memory is mapped at the beginning of memory space,
i.e., at OOOOH, then the monitor program will be executed automatically after a
reset.
31.What is DMA?
The direct data transfer between I/O device and memory is called DMA.
40
33.What is a port?
The port is a buffered I/O, which is used to hold the data transmitted from the
microprocessor to I/O device or vice-versa.
43. How many machine cycles constitute one instruction cycle in 8085?
Each instruction of the 8085 processor consists of one to five machine cycles.
46. What operation is performed during first T -state of every machine cycle in
8085 ?
In 8085, during the first T -state of every machine cycle the low byte address is
latched into an external latch using ALE signal.
48. How the 8085 processor differentiates a memory access (read/write) and 1/0
access (read/write)?
The memory access and 1/0 access is differentiated using 10 I M signal. The 8085
processor asserts 10 I M low for memory read/write operation and 10 I M is asserted
high for 1/0 read/write operation.
56.What is Polling?
Polling is a scheme or an algorithm to identify the devices interrupting the processor.
Polling is employed when multiple devices interrupt the processor through one
interrupt pin of the processor.
43
70. What are the control words of 8251A and what are its functions ?
The control words of 8251A are Mode word and Command word. The mode word
informs 8251 about the baud rate, character length, parity and stop bits. The command
word can be send to enable the data transmission and reception.
71. What are the information that can be obtained from the status word of
8251 ?
The status word can be read by the CPU to check the readiness of the transmitter or
receiver and to check the character synchronization in synchronous reception. It also
provides information regarding various errors in the data received. The various error
conditions that can be checked from the status word are parity error, overrun error and
framing error.
45