计算机组成原理ppt课件第5章.ppt
《计算机组成原理ppt课件第5章.ppt》由会员分享,可在线阅读,更多相关《计算机组成原理ppt课件第5章.ppt(63页珍藏版)》请在三一办公上搜索。
1、Chapter 1 The 80 x86 Microprocessor,THE 80 x86 IBM PC AND COMPATIBLE COMPUTERS,CHAPTER 1,Main Content,Registers of the 80 x86 MOV and ADD instructions Code segment, Data segment, Stack segment and Extra segment Logical address and Physical address PUSH and POP instructions Flag register Addressing m
2、odes of the 8086,Sec.1.2 Inside the 8088/8086,CHAPTER 1,Sec.1.2 Inside the 8088/8086,Registers,CHAPTER 1,Different registers in the 8088/86 are used for different functions.,Sec.1.3 Introduction to assembly programming,CHAPTER 1,A program that consists of 0s and 1s is called machine language. Assemb
3、ly languages provides mnemonics for the machine code instructions, plus other features that made programming faster and less prone to error. Assembly language programs must be translated into machine code by a program called an assembler. Assembly language is referred to as a low-level language beca
4、use it deals directly with the internal structure of the CPU.,CHAPTER 1,One of the most commonly used assemblers is MASM by Microsoft. Other tools: Link Debug Debug. exe can be found in C:windowssystem32 OS ( XP ),Sec.1.3 Introduction to assembly programming,Sec.1.3 Introduction to assembly programm
5、ing,MOV instruction,CHAPTER 1,Simply stated, the MOV instruction copies data from one location to another. It has the following format: MOV destination, source ; copy source operand to destination The following program first loads CL with value 55H, then moves this value around to various registers
6、inside the CPU. MOV CL, 55H MOV DL, CL MOV AH, DL The use of 16-bit registers is demonstrated below. MOV CX, 468FH MOV AX, CX MOV DX, AX,Sec.1.3 Introduction to assembly programming,MOV instruction,CHAPTER 1,In the 8086 CPU, data can be moved among all the registers shown in Table 1-2 (except the fl
7、ag register) as long as the source and destination registers match in size. Code such as “MOV AL, DX” will cause an error. The exception of the flag register means that there is no such instruction as “MOV FR, AX”. Data can be moved directly into nonsegment registers only, using the MOV instruction.
8、 For example, MOV AX, 58FCH ;LEGAL MOV DX, 6678H ;LEGAL MOV SI, 924BH ;LEGAL MOV BP, 2459H ;LEGAL MOV DS, 2341H ;ILLEGAL MOV CX, 8876H ;LEGAL MOV CS, 3F47H ;ILLEGAL MOV BH, 99H ;LEGAL,Sec.1.3 Introduction to assembly programming,MOV instruction,CHAPTER 1,From the discussion above, note the following
9、 three points:1. Values cannot be loaded directly into any segment register (CS, DS, ES, or SS). MOV AX, 2345H ;load 2345H into AX MOV DS, AX ;then load the value of AX into DS MOV DI, 1400H ;load 1400H into DI MOV ES, DI ;then move it into ES, now ES=DI=14002. If a value less than FFH is moved into
10、 a 16-bit register, the rest of the bits are assumed to be all zeros. For example, in “MOV BX, 5” the result will be BX = 0005; that is BH = 00 and BL = 05.3. Moving a value that is too large into a register will cause an error. MOV BL, 7F2H ;ILLEGAL: 7F2H is larger than 8 bits MOV AX, 2FE456h ;ILLE
11、GAL,Sec.1.3 Introduction to assembly programming,ADD instruction,CHAPTER 1,The ADD instruction has the following format: ADD destination, source ;ADD the source operand to the destination To add two numbers such as 25H and 34H, each can be moved to a register and then added together: MOV AL, 25H ;mo
12、ve 25 into AL MOV BL, 34H ;move 34 into BL ADD AL, BL ;AL = AL + BL The program above can be written in many ways, depending on the registers used. Another way might be: MOV DH, 25H ;move 25 into DH MOV CL, 34H ;move 34 into CL ADD DH, CL ;add CL to DH: DH = DH + CL,Sec.1.3 Introduction to assembly
13、programming,ADD instruction,CHAPTER 1,It is not necessary to move both data items into registers before adding them together. MOV DH, 25H ;load one operand into DH ADD DH, 34H ;add the second operand to DH The program above can be written in many ways, depending on the registers used. Another way mi
14、ght be: MOV DH, 25H ;move 25 into DH MOV CL, 34H ;move 34 into CL ADD DH, CL ;add CL to DH: DH = DH + CL The largest number that an 8-bit register can hold is FFH. MOV AX, 34EH ;move 34EH into AX MOV DX, 6A5H ;move 6A5H into DX ADD DX, AX ;add AX to DX: DX = DX + AX Again, any 16-bit nonsegment regi
15、sters could have been used to perform the action above. E. g. MOV CX, 34EH; ADD CX, 6A5H,Sec.1.4 Introduction to program segments,CHAPTER 1,A typical Assembly language program consists at least three segments: a code segment, a data segment, and a stack segment.The code segment contains the Assembly
16、 language instructions that perform the tasks that the program was designed to accomplish.The data segment is used to store information (data) that needs to be processed by the instructions in the code segment.The stack is used to store information temporarily. A segment is an area of memory that in
17、cludes up to 64K bytes and begins on an address evenly divisible by 16 (Such an address ends in 0H). The 8088/86 can only handle a maximum of 64K bytes of code and 64K bytes of data and 64K bytes of stack at any given time, although it has a range of 1 megabyte of memory because of its 20 address pi
18、ns (220 = 1 megabyte). How to move this window of 64K bytes to cover all 1 megabyte of memory ?,Sec.1.4 Introduction to program segments,Logical address and physical address,CHAPTER 1,In Intel literature concerning the 8086, there are three types of addresses mentioned frequently: the physical addre
19、ss, the offset address, and the logical address.The physical address is the 20-bit address that is actually put on the address pins of the 8086 microprocessors and decoded by the memory interfacing circuitry. This address can have a range of 00000H to FFFFFH for the 8086 and real-mode 286, 386, and
20、486 CPUs. This is an actual physical location in RAM or ROM within the 1 megabyte memory range.The offset address is a location with a 64K-byte segment range. There, an offset address can range from 0000H to FFFFH.The logical address consists of a segment value and an offset address.,Sec.1.4 Introdu
21、ction to program segments,Code segment,CHAPTER 1,The logical address of an instruction always consists of a CS (code segment) and an IP (instruction pointer), shown in CS:IP format. CS IP,0,0,5,2,3,F,5,9,:,Start with CS.Shift left CS.Add IP.,0,0,5,2,0,0,0,5,2,3,F,5,E,2,Sec.1.4 Introduction to progra
22、m segments,Code segment,CHAPTER 1,Example 1-1 If CS = 24F6H and IP = 634AH, show:The logical addressThe offset addressAnd calculate:(c) The physical address(d) The lower range(e) The upper range of the code segmentSolution:24F6:634A (b) 634A(c) 2B2AA (24F60 + 634A) (d) 24F60 (24F60 + 0000)(e) 34F5F
23、(24F60 + FFFF),Sec.1.4 Introduction to program segments,Logical address vs. physical address in the code segment,The three columns show the logical address of CS:IP, the machine code stored at that address and the corresponding Assembly language code.,ADD AX, 1F35H,05351F,1132:0112,ADD CX, BX,01D9,1
24、132:0110,ADD AX, DX,01D0,1132:010E,MOV AH, 20H,B420,1132:010C,MOV BL, 9FH,B39F,1132:010A,MOV BH, AL,88C7,1132:0108,MOV CX, DX,89D1,1132:0106,MOV DL, 72H,B272,1132:0104,MOV DH, 86H,B686,1132:0102,MOV AL, 57H,B057,1132:0100,Assembly languagemnemonics and operand,Machine languageOpcode and operand,Logi
25、cal address CS:IP,Sec.1.4 Introduction to program segments,Data segment,CHAPTER 1,Assume that a program is being written to add 5 bytes of data, such as 25H, 12H, 15H, 1FH, and 2BH, where each byte represents a persons daily overtime pay. One way to add them is as follows. MOV AL, 00H ADD AL, 25HADD
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机 组成 原理 ppt 课件

链接地址:https://www.31ppt.com/p-1595947.html