[理学]中山大学软件学院专业课计算机组成原理课件第5章

上传人:油条 文档编号:49790435 上传时间:2018-08-02 格式:PPT 页数:63 大小:1.66MB
返回 下载 相关 举报
[理学]中山大学软件学院专业课计算机组成原理课件第5章_第1页
第1页 / 共63页
[理学]中山大学软件学院专业课计算机组成原理课件第5章_第2页
第2页 / 共63页
[理学]中山大学软件学院专业课计算机组成原理课件第5章_第3页
第3页 / 共63页
[理学]中山大学软件学院专业课计算机组成原理课件第5章_第4页
第4页 / 共63页
[理学]中山大学软件学院专业课计算机组成原理课件第5章_第5页
第5页 / 共63页
点击查看更多>>
资源描述

《[理学]中山大学软件学院专业课计算机组成原理课件第5章》由会员分享,可在线阅读,更多相关《[理学]中山大学软件学院专业课计算机组成原理课件第5章(63页珍藏版)》请在金锄头文库上搜索。

1、Chapter 1The 80x86 MicroprocessorTHE 80x86 IBM PC AND COMPATIBLE COMPUTERSCHAPTER 1Main Content Registers of the 80x86 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 modes of

2、 the 8086 Sec.1.2 Inside the 8088/8086CHAPTER 1Sec.1.2 Inside the 8088/8086RegistersCHAPTER 1Different registers in the 8088/86 are used for different functions.Sec.1.3 Introduction to assembly programmingCHAPTER 1A program that consists of 0s and 1s is called machine language. Assembly languages pr

3、ovides 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 because it deals di

4、rectly with the internal structure of the CPU. CHAPTER 1One of the most commonly used assemblers is MASM by Microsoft.Other tools:LinkDebugDebug. exe can be found in C:windowssystem32 OS ( XP )Sec.1.3 Introduction to assembly programmingSec.1.3 Introduction to assembly programmingMOV instructionCHAP

5、TER 1Simply stated, the MOV instruction copies data from one location to another. It has the following format:MOV destination, source ; copy source operand to destinationThe following program first loads CL with value 55H, then moves this value around to various registers inside the CPU.MOV CL, 55HM

6、OV DL, CLMOV AH, DLThe use of 16-bit registers is demonstrated below.MOV CX, 468FHMOV AX, CXMOV DX, AXSec.1.3 Introduction to assembly programmingMOV instructionCHAPTER 1In the 8086 CPU, data can be moved among all the registers shown in Table 1-2 (except the flag register) as long as the source and

7、 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. For example,MOV AX, 58FCH ;LEGALMOV D

8、X, 6678H ;LEGALMOV SI, 924BH ;LEGALMOV BP, 2459H ;LEGALMOV DS, 2341H ;ILLEGALMOV CX, 8876H ;LEGALMOV CS, 3F47H ;ILLEGALMOV BH, 99H ;LEGALSec.1.3 Introduction to assembly programmingMOV instructionCHAPTER 1From the discussion above, note the following three points: 1. Values cannot be loaded directly

9、 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 DSMOV DI, 1400H ;load 1400H into DIMOV ES, DI ;then move it into ES, now ES=DI=14002. If a value less than FFH is moved into a 16-bit register, the rest of the bits are assumed

10、 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 bitsMOV AX, 2FE456h ;ILLEGALSec.1.3 Introduction to assembly programmingADD ins

11、tructionCHAPTER 1The ADD instruction has the following format:ADD destination, source ;ADD the source operand to the destinationTo add two numbers such as 25H and 34H, each can be moved to a register and then added together:MOV AL, 25H ;move 25 into ALMOV BL, 34H ;move 34 into BLADD AL, BL ;AL = AL

12、+ BLThe program above can be written in many ways, depending on the registers used. Another way might be:MOV DH, 25H ;move 25 into DHMOV CL, 34H ;move 34 into CLADD DH, CL ;add CL to DH: DH = DH + CLSec.1.3 Introduction to assembly programmingADD instructionCHAPTER 1It is not necessary to move both

13、data items into registers before adding them together.MOV DH, 25H ;load one operand into DHADD DH, 34H ;add the second operand to DHThe program above can be written in many ways, depending on the registers used. Another way might be:MOV DH, 25H ;move 25 into DHMOV CL, 34H ;move 34 into CLADD DH, CL

14、;add CL to DH: DH = DH + CLThe largest number that an 8-bit register can hold is FFH.MOV AX, 34EH ;move 34EH into AXMOV DX, 6A5H ;move 6A5H into DXADD DX, AX ;add AX to DX: DX = DX + AXAgain, any 16-bit nonsegment registers could have been used to perform the action above. E. g. MOV CX, 34EH; ADD CX

15、, 6A5HSec.1.4 Introduction to program segmentsCHAPTER 1A 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 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 includes up to 64K bytes and

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号