Beruflich Dokumente
Kultur Dokumente
7/12/2012
Baiju Karun
8086 Features
16-bit Arithmetic Logic Unit 16-bit data bus (8088 has 8-bit data bus) 20-bit address bus - 220 = 1,048,576 = 1 Mega
The address refers to a byte in memory. In the 8088, these bytes come in on the 8-bit data bus. In the 8086, bytes at even addresses come in on the low half of the data bus (bits 0-7) and bytes at odd addresses come in on the upper half of the data bus (bits 8-15).
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
8086 Features
The 8086 can read a 16-bit word at an even address in one operation and at an odd address in two operations. The 8088 needs two operations in either case. The least significant byte of a word on an 8086 family microprocessor is at the lower address
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
BIU &EU
The BIU fetches instructions, reads and writes data, and computes the 20-bit address. The EU decodes and executes the instructions using the 16-bit ALU
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
Registers
AX (16 bits) -- AH and AL (each 8 bit) BX (16 bits) -- BH and BL (each 8 bit) CX (16 bits) -- CH and CL (each 8 bit) DX (16 bits) -- DH and DL (each 8 bit)
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
Data Registers are general purpose registers but they also perform special functions AX
Accumulator Register Preferred register to use in arithmetic, logic and data transfer instructions because it generates the shortest Machine Language Code Must be used in multiplication and division operations Must also be used in I/O operation
BX
Base Register Also serves as an address register Count register Used as a loop counter Used in shift and rotate operations Data register Used in multiplication and division Also used in I/O operations
CX
DX
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
DI destination index for string operations SI source index for string operations SP stack pointer for accessing stack top BP base pointer for accessing any location in stack IP instruction pointer-points to the next instruction to be executed
Flag Register
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
Used with SS to access the stack segment Primarily used to access data on the stack Can be used to access data in other segments is required for some string operations When string operations are performed, the SI register points to memory locations in the data segment which is addressed by the DS register. Thus, SI is associated with the DS in string operations
is also required for some string operations. When string operations are performed, the DI register points to memory locations in the data segment which is addressed by the ES register. Thus, DI is associated with the ES in string operations
FLAGS
CONDITIONAL FLAGS OF = Overflow flag SF = Sign Flag ZF = Zero Flag AF = Auxiliary carry Flag PF = Parity Flag CF = Carry Flag
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
Registers
Registers are in the CPU and are referred to by specific names Data registers
Hold data for an operation to be performed There are 4 data registers (AX, BX, CX, DX) Address registers Hold the address of an instruction or data element Segment registers (CS, DS, ES, SS) Pointer registers (SP, BP, IP) Index registers (SI, DI) Status register Keeps the current status of the processor On an IBM PC the status register is called the FLAGS register In total there are fourteen 16-bit registers in an 8086/8088
is responsible for address calculations pre-fetching instructions for the queue and sequencing instructions one by one
The BIU fetches instructions using the CS and IP, written CS:IP, to contract the 20-bit address. Data is fetched using a segment register (usually the DS) and an effective address (EA) computed by the EU depending on the addressing mode
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
There is a queue which fetches instructions ahead of the execution time and places them in a six byte first in first out (FIFO) queue Pre-fetching belongs to a class of ideas called pipelining, which means that both execution and fetching take place at the same time.
MEMORY SEGMENTATION
Each address is 20 bit But address registers are only 16 bits long There are four types of memory segments They cater to data, code, stack and another data segment called the extra segment
10
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
CS code segment register DS data segment register SS stack segment register ES extra segment register
Calculation of a physical address from the logical address for a data segment
11
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
Code segment ---- Instruction pointer (IP) Stack segment . Stack pointer (SP)
12
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
performs all arithmetic and logic computations. is the most important unit of the processor instructions that are fetched and decoded, are executed in the ALU. the ALU has direct access to the general purpose registers and flags.
13
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
Example
The content of DS is 345BH. The amount of data that is to be stored in the data segment is 12K bytes. Where in memory, will this segment be located?
14
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
Solution
The base address of the segment is 345B0H The last address will have an offset of 12K from the base address . 1K = 1024 bytes 12 K = 12 1024 = 12288 = 3000H The last address of the segment = 345B0H + 3000H = 375B0H
Advantages of Segmentation
All address registers are only 16 bit long, though the physical address is 20 bits All addresses are re-locatable
15
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
In the case of a word of data stored in memory if the lower byte is in the lower address and the higher byte is in the higher address it is called the little endian format
16
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
ADDRESSING MODES
The way in which operands are specified in an assembly language instruction is called its addressing mode For a move instruction, the format is MOV destination, source
The operands can be in registers, in memory, or may be in the instruction itself. But the 8086 does not have an addressing mode in which both operands are in memory locations In the case of two operands, one of them can be in memory, but the other will have to be placed in a register . Data types should match i.e., the source and destination should both be either bytes or words
17
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
Register Addressing
Here both the source and destination are registers MOV AL, AH MOV CH, BL MOV SI, BX MOV ES,AX
Immediate Addressing
Here, the source will be a constant data MOV AL, 45H MOV BX, 34E3H MOV CL,Q MOV PRICE,40 MOV NUMS, 0FC6H PRICE and NUMS are labels for memory addresses
18
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
Direct Addressing
Here either the source or the destination will be a memory address MOV AX,[2345H] MOV [1089H],AL MOV AX , PRICE MOV COST,AL PRICE and COST are labels for memory addresses
In this mode, the address of the data is held in a register Effective address EA = EA = { [BX] / [DI] /[SI]} MOV AL,[BX] MOV [SI], CL MOV [DI],AX
19
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
In this mode, an index register and a base register together carry the effective address . The content of these two registers are added and called the effective address. MOV AL,[BX][SI] MOV [BX][DI],CX
20
Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.7/12/2012
The effective address is the sum of the two registers and a displacement . MOV DL ,5[BX][DI] MOV 5[BP][SI], AX MOV CL,COST[BX[[SI]
Effective Address and Referred Segments for Various Memory Based Addressing Modes
21