1 / 15

PART B-3

PART B-3. Symbolic Instructions and Addressing. 指令与寻址方式. 一、 instruction Sentence ( 指令语句 ) 按指令的用途划分有: 1. Data Transfer ( 数据传送 ) —— MOV 、 PUSH 、 POP … 2. Arithmetic Operations ( 算术运算 ) —— ADD 、 SUB 、 INC … 3. Logical Operations ( 逻辑运算 ) —— OR 、 AND 、 NOT …

mihaly
Download Presentation

PART B-3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PART B-3 Symbolic Instructions and Addressing 指令与寻址方式

  2. 一、instruction Sentence (指令语句) 按指令的用途划分有: 1. Data Transfer (数据传送)—— MOV、PUSH、POP… 2. Arithmetic Operations (算术运算)—— ADD、SUB、INC… 3. Logical Operations (逻辑运算)—— OR、AND、NOT… 4. String Operation (字串操作)—— MOVS、LODS(取字串)… 5. Transfer (程序转移)—— JMP、CALL、RET… 6. CPU Control (控制语句)—— CLC(清进位)、CLI(关中断)

  3. 按指令的结构划分有: 1. 单操作数指令 —— OPR DEST 2. 双操作数指令 —— OPR DEST, SRC 3. 无操作数指令 —— OPR

  4. 二、Operands Addressing(操作数寻址方式) —— How to lookup the Operands. Assembler Format: 标号 操作码 目标 源 注释 [Identifier:] Operation [[Source][,Object]] [;Comment] Operands 1. Immediate Addressing(立即寻址) —— Operand in the instruction. For Example:MOV AX, 14 ;14 AX MOV SUM, 13 2. Register Addressing(寄存器寻址) —— Operand in some registers. For Example:MOV AH, BL ; BL AH

  5. 3. Direct Addressing (直接寻址) —— Operand address in the instruction. ForExample:MOV AX, [2000H] ;[DS:2000H] AX

  6. 4. Register Indirect Addressing(间接寻址) —— Operand address in some registers. For Example: MOV AX, [BX] ;[DS:BX] AX MOV AX, [BP] ;[SS:BP] AX 5. Indexed Addressing(变址寻址) For Example 1: MOV AX, [BX][SI] ;[DS:(BX+SI)] AX MOV AX, [BP][SI] ;[SS:(BP+SI)] AX 〖8-5〗

  7. For Example 2: MY_2 DW 100 DUP(?) ... MOV AX, MY_2[BX] ;[DS:(MY_2+BX)] AX For Example 3: MY_3 DW 100 DUP(?) ... MOV AX, MY_3[BX][SI] ;[DS:(MY_3+BX+SI)] AX MOV AX, MY_3[BP][SI] ;[SS:(MY_3+BP+SI)] AX 注意: 变址的以下书写方式等效: MY_3[BX][SI] [BX][SI]+MY_3 [BX+SI]+MY_3 [BX+SI+MY_3] 〖8-6〗

  8. 几条指令说明: • MOV • Transfers data referenced by address of the second operand to the address of the first operand • General format [Label:] MOV register/memory,register/memory/immediate • Invalid MOV operations: • Memory to memory • Immediate to segment register • Segment register to segment register • The operands must agree in size The only instructions that allow both operands to address memory directly are MOVS and CMPS

  9. XCHG • Swaps data items • General format [Label:] XCHG register/memory,register/memory • Example: Wordq dw ? … XCHG CL, BH XCHG CX, WORDQ

  10. LEA • Initialize a register with an offset address • General format [Label:] lea register, memory • Example: Databl db 25 dup(?) Bytefld db ? … Lea bx, datatbl ;和mov bx,offset datatbl相同 Mov bytefld, [bx]

  11. INC and DEC Increments and decrements the contents of registers and memory locations by 1,respectively. • Format: [label:] INC/DECregister/memory • Depending on the result,the operations clear or set the OF,SF,and ZF flags. This instruction does not set the carry flag.

  12. INT • INT指令退出正常处理过程并访问位于低端存储器的中断向量表,以便确定所请求的例程的地址。然后该操作转到BIOS或操作系统中去完成指定的动作并返回程序继续原来的处理过程。 (An int instruction interrupts processing and accesses the interrupt vector table in low memory to determine the address of the requested routine.The operation then transfers to DOS or to BIOS for specified action and returns to your program to resume processing.)

  13. INT performs the following: • 标志寄存器的内容进栈 • 清除中断与陷阱标志 • CS寄存器进栈 • 指令指针(IP)(内有下一条指令的地址)进栈 • Causes the required operation to be performed • 从中断中返回使用IRET • The preceding process is entirely automatic.

  14. 〖8-7〗 数据传送的方向:

  15. Questions: Page 106 6 - 2 6 - 3 6 - 6 6 - 7 6 – 13

More Related