instruction system transfer instruction n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Instruction System - Transfer Instruction PowerPoint Presentation
Download Presentation
Instruction System - Transfer Instruction

Loading in 2 Seconds...

play fullscreen
1 / 35

Instruction System - Transfer Instruction - PowerPoint PPT Presentation


  • 114 Views
  • Uploaded on

Instruction System - Transfer Instruction. 计算机学院 李征 Tel : 13882153765 Email : lizheng@cs.scu.edu.cn OICQ: 1340915. Transfer Instruction. All transfer instructions only move data from one cell to another. ALU is not used in these instructions.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Instruction System - Transfer Instruction' - amelie


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
instruction system transfer instruction

Instruction System -Transfer Instruction

计算机学院 李征

Tel:13882153765

Email:lizheng@cs.scu.edu.cn

OICQ: 1340915

transfer instruction
Transfer Instruction
  • All transfer instructions only move data from one cell to another.
  • ALU is not used in these instructions.
  • So, transfer instruction does not affect flags unless FR is its destination.
transfer instruction1
Transfer Instruction
  • (1) MOV
  • (2) XCHG
  • (3) LAHF
  • (4) SAHF
  • (5) PUSH (PUSHF)
  • (6) POP (POPF)
  • (7) LEA
  • (8) LDS (LES)
1 mov move
(1) MOV (Move)
  • Example:
  • mov al, 06h
  • mov 0100h[bx], al
  • mov ds, ax
1 mov move1
(1) MOV (Move)
  • Error Usage:
  • mov [bx], [0102h]
  • mov 0020h[si], 03h
  • mov ds, 1000h
  • mov ds, es
2 xchg exchange
(2) XCHG (Exchange)
  • Example: exchange the data in var1 and var2 cell.
  • mov al, var1
  • xchg al, var2
  • mov var1, al
2 xchg exchange1
(2) XCHG (Exchange)
  • Error Usage:
  • XCHG AL, 03H
  • XCHG VAR1, VAR2
3 lahf load ah from fr
(3) LAHF (Load AH from FR)
  • LAHF
  • No operation data, but two implied address used.
  • AH <=(FR)7-0
  • Usage: protect FR temporally
4 sahf store ah into fr
(4) SAHF (Store AH into FR)
  • SAHF
  • No operation data, but two implied address used.
  • FR7-0 <= (AH)
  • Usage: Restore previous FR
example for lahf and sahf
Example for LAHF and SAHF
  • CMP BYTE PTR [BX], 02H
  • LAHF ; Protect FR
  • INC BX
  • SAHF ; Restore FR
  • JA L1 ; FR is from CMP, not INC
  • JMP L2
  • ……
5 push pushf
(5) PUSH (PUSHF)
  • PUSH SRC
  • SP <=(SP)-2
  • (SP) <= (SRC)
  • PUSHF : Send FR to stack top
slide14

源地址

SP

6 pop popf
(6) POP (POPF)
  • POP DEST
  • DEST <= (SP)
  • SP <= (SP)+2
  • POPF: Restore FR from stack top.
example for stack operation
Example for Stack Operation
  • STACK1 SEGMENT STACK
  • DB 40H DUP(0) ;堆栈空间为32个字
  • STACK1 ENDS
  • PUSH AX ;假定(AX)=0E43DH
  • PUSH DS ;假定(DS)=3638H
  • PUSH DATAW ;假定(DATAW)=0D245H
  • PUSHF ;假定(FR)=0C243H
  • POPF
  • POP DATAW
  • POP DS
  • POPAX
note for all stack operation
Note for all stack operation
  • Important:
  • The pop order is inverse to the push order.
7 lea load effective address
(7) LEA (Load Effective Address)
  • LEA DEST,SRC
  • DEST <= EA of SRC
  • SRC can only be memory cell. Why?
  • DEST can only be 16-bit register. Why?
7 lea load effective address1
(7) LEA (Load Effective Address)
  • Example:
  • MOV BX,0024H
  • LEA BX,[BX]
  • Data stored in(DS):0024H is 0056H.
  • So, after instruction execution, (BX)=?
7 lea load effective address2
(7) LEA (Load Effective Address)
  • Example:
  • LEA SI,DS:[0056H]
  • Data stored in(DS):0056His 0048H.
  • So, after execution, (SI)=?
8 lds les
(8) LDS (LES)
  • LDS DEST, SRC
  • LES DEST, SRC
  • LDS:DEST <=(SRC)
  • DS <=(SRC+2)
  • LES:DEST <=(SRC)
  • ES <=(SRC+2)
slide33

16位通用寄存器

源地址

DS或

ES

8 lds les1
(8) LDS (LES)
  • Example:
  • MOV BX,0024H
  • LDS BX,[BX]
  • MOV AX,[BX]
  • (DS)=02F8H
  • (02F8H:0024H)= 0056H
  • (02F8H:0026H)= 06A4H
  • (02F8H:0056H)= 00B2H
  • (06A4H:0056H)= 0008H
  • After execution, (DS)=?(BX)=? (AX)=?
difference between lea and lds
Difference between LEA and LDS
  • LEA calculate the EA of SRC.
  • LDS explain the SRC as the EA and segment base value.