A microprocessor is an electronic component that is used by a computer to do its work. It is a central processing unit on a single integrated circuit chip containing millions of very small components including transistors, resistors, and diodes that work together. Some microprocessors in the 20th century required several chips. Microprocessors help to do everything from controlling elevators to searching the Web. Everything a computer does is described by instructions of computer programs, and microprocessors carry out these instructions many millions of times a second. [1]
Microprocessors were invented in the 1970s for use in embedded systems. The majority are still used that way, in such things as mobile phones, cars, military weapons, and home appliances. Some microprocessors are microcontrollers, so small and inexpensive that they are used to control very simple products like flashlights and greeting cards that play music when you open them. A few especially powerful microprocessors are used in personal computers.
2. 8086 Instruction Set
Sequential control flow instructions
• After execution transfers the control to the next instruction
appearing immediately after it (in sequence)
• Example: Arithmetic, data transfer, logical, processor control,
bit manipulation,
Control transfer instructions
• After execution transfers the control to some predefined or to
the address somehow specified in the instruction
3. 8086 Instruction Set
Categories
a. Data copy/Transfer
b. Arithmetic and Logical
c. Branch
d. Loop
e. Machine Control
f. Flag Manipulation
g. Shift and Rotate
h. String
4. Data Copy/Transfer Instructions
MOV AX,5000H IMMEDIATE
MOV AX,BX REGISTER
MOV AX,[SI] INDIRECT
MOV AX,[2000H] DIRECT
MOV AX,50H[BX] BASED RELATIVE, 50H DISPLACEMENT
PUSH AX POP AX
PUSH DX POP DX
PUSH [5000H] POP [5000H]
PUSHF POPF
XCHG [5000H], AX XCHG BX,AX
14 Instructions
6. • IN destination, source : reads the port
– Destination: AX or AL
– Source: address of the port (16 bit address must be in DX,
8 bit address specified in the instruction)
Examples:
IN AL,03H : AL [03H]
IN AX,DX : AX [DX]
MOV DX, 0800H
IN AX, DX : AX [0800H]
7. • OUT destination, source : writing to the port
– Destination: address of the port (16 bit address must be in
DX, 8 bit address specified in the instruction)
– Source: AX or AL
– Odd address port data on higher data bus
– Even address port data on lower data bus
– Examples:
OUT 03H,AL
OUT DX, AX
MOV DX, 7000H
OUT DX, AX
8. • LEA destination, source : load effective address (offset)
– Destination: any register which can hold the offset address
– i.e.
– Source: operand name
Examples:
LEA BX, A : BX offset of variable A
LEA SI, A[BX] : SI offset of variable A + BX
11. DATA SEGMENT
A1 DW -9852H
A2 DW -0147H
B DW 2222H
QUO DW ?
REM DW ?
DATA ENDS
12. Data Copy/Transfer Instructions
• LES/ LDS BX, add16
– Loads the pointer to DS or ES
– Starting with the address mentioned in the instruction two
bytes are copied to BX and next two bytes are copied to ES
or DS. (1st byte to BL, 2nd byte to BH, 3rd byte to lower byte
and 4th byte to higher byte of DS/ ES )
– Examples:
– LES BX, 5000H
– LDS BX, 5000H
13. XY 5000H
LM 5001H
WZ 5002H
JK 5003H
LDS BX,5000H or LES BX,5000H
BH BL
LM XY
Higher byte of DS/ES Lower byte of DS/ES
JK WZ
15. Data Copy/Transfer Instructions
• LAHF : load AH from lower byte of Flag
AH lower byte of flag
• SAHF : store AH to lower byte of Flag
Lower byte of flag AH
16. Data Copy/Transfer Instructions
• XLAT : translate
– Can be used for look up table
– Default source & destination operand is AL
– Default base address of look up table is in BX
– Physical address in look up table = 10H * DS + AL + BX
– Example:
MOV AL, NUM ; read the number
MOV BX, OFFSET_TABLE ; store the base address of look up
table
XLAT
17. Data Copy/Transfer Instructions
SQR_TABLE DB 00, 01, 04, 09, 16, 25, 36, 49, 64, 81
LEA BX, SQR_TABLE
MOV AL, 03H
XLAT
after execution AL = 09h
XLAT = MOV AL, AL[BX]
AL [10H*DS + AL + BX]
DEC AL
XLAT
AL=??