Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Microprocessors Chapter 3. Programming Model (8086)  Shows the various internal registers that are accessible to the programmer.

Similar presentations


Presentation on theme: "Introduction to Microprocessors Chapter 3. Programming Model (8086)  Shows the various internal registers that are accessible to the programmer."— Presentation transcript:

1 Introduction to Microprocessors Chapter 3

2 Programming Model (8086)  Shows the various internal registers that are accessible to the programmer

3 General Purpose Registers

4 Data Registers

5 Pointer and Index Registers

6 Example  MOV AH,[SI]  Assume SI=1000  After executing program  AH = 26H

7 Status and Control Flags

8 Flags  Carry Flag (CF) - this flag is set to 1 when there is an unsigned overflow. For example when you add bytes 255 + 1 (result is not in range 0...255). When there is no overflow this flag is set to 0.  Parity Flag (PF) - this flag is set to 1 when there is even number of one bits in result, and to 0 when there is odd number of one bits.  Auxiliary Flag (AF) - set to 1 when there is an unsigned overflow for low nibble (4 bits).  Zero Flag (ZF) - set to 1 when result is zero. For non-zero result this flag is set to 0.  Sign Flag (SF) - set to 1 when result is negative. When result is positive it is set to 0. (This flag takes the value of the most significant bit.)  Trap Flag (TF) - Used for on-chip debugging. Processor operate in a single stepping mode.  Interrupt enable Flag (IF) - when this flag is set to 1 CPU reacts to interrupts from external devices.  Direction Flag (DF) - this flag is used by some instructions to process data chains, when this flag is set to 0 - the processing is done forward, when this flag is set to 1 the processing is done backward.  Overflow Flag (OF) - set to 1 when there is a signed overflow. For example, when you add bytes 100 + 50 (result is not in range -128...127).

9 Example  If AL=7F and instruction ADD AL,1 is given, the flags are (7F+1=80H)  CF=0  PF=0  AF=1  ZF=0  SF=1  OF=1

10 Memory Address Space and Organization Memory space of 8086 consists of 1,048,576 bytes or 524,288 16- bits words

11 Even addressed and odd-addressed banks IF 16-bit word begins at an odd address, 8086 will require two memory read or write cycles

12 Origin and Definition of a Segment  A segment is an area of memory that includes up to 64Kbytes and begins on an address divisible by 16 (such an address ends with an hex digit 0h or 0000b)  In the 8086/88, 64 K is assigned to each category  Code segment  Data segment  Stack Segment  Extra Segment

13 Advantages and disadvantages of Segmented Memory  One program can work on several different sets of data. This is done by reloading register DS to a new value.  Programs that reference logical addresses can be loaded and run anywhere in the memory: relocatable  Segmented memory introduces extra complexity in both hardware in that memory addresses require two registers.  They also require complexity in software in that programs are limited to the segment size  Programs greater than 64 KB can be run on 8086 but the software needed is more complex as it must switch to a new segment.  Protection among segments is provided.

14 Segment Registers

15 Logical and Physical Addresses

16 Example

17 16 bit Segment Register Assignments

18 Addressing Modes  When the 8086 executes an instruction, it performs the specified function  on data  These data, called operands,  May be a part of the instruction  May reside in one of the internal registers of the microprocessor  May be stored at an address in memory  Register Addressing Mode  MOV AX, BX  MOV AL,BH  Immediate Addressing Mode  MOV AL,15h  MOV AX,2550h  MOV CX,625

19 Direct Addressing Mode  A memory location is to be referenced  Ex: MOV CL,[20H] ; 8 bit transfer  Note the brackets around 20h  Ex2: MOV CX,[20H] ; 16 bit transfer

20 Example for Register Indirect Addressing

21 MOV instructions  MOV destination, source  8 bit moves  MOV CL,55h  MOV DL,CL  MOV BH,CL  16 bit moves  MOV CX,468Fh  MOV AX,CX  MOV BP,DI

22 MOV Instruction

23 MOV instruction

24 ADD Instruction

25 Data Segment

26

27


Download ppt "Introduction to Microprocessors Chapter 3. Programming Model (8086)  Shows the various internal registers that are accessible to the programmer."

Similar presentations


Ads by Google