AR101 Week 6 Data Transfer Instructions
AR101 Week 6 Data Transfer Instructions
•Data transfer instructions are the instructions which transfers data in the
microprocessor. They are also called copy instructions.
Classifications of Instructions:
Format: MOV D, S
Action: D [S]
MOV Instruction
Destination Source Example
Register Register MOV CX, BX
Register Main Memory MOV CX, [BP + SI]
Main Memory Register MOV [BX], DX
Register Immediate MOV CX, 80FEH
Main Memory Immediate MOV word ptr [BX], 1834H
Segment Register Register MOV DS, BX
Register Segment Register MOV AX, CS
Segment Register MM MOV SS, [1AFFH]
Main Memory Segment Register MOV [BP + SI + 1000H], DS
MOV AX, BX
MOV DI, 0005H
MOV [BP + SI], AX
AR101 - Computer Architecture and Organization
Week 6– Data Transfer Instructions
Format: XCHG D, S
Action: [D] [S]
XCHG DI, SI
XCHG BX, [CX]
XCHG [BX + 0020H], AX
AR101 - Computer Architecture and Organization
Week 6– Data Transfer Instructions
Exercise # 1
• Unless otherwise stated, determine the contents of all the affected general-purpose
registers and memory addresses after executing the following program. Each
instruction is dependent of one another. Whenever necessary, use the memory map
(handout) for additional data. Assume the following register contents:
AX = 0015H BP = 0002H CS = 3000H
BX = 0019H SP = 0035H DS = 2000H
CX = 0012H DI = 0017H SS = 2000H
DX = 001BH SI = 001EH ES = 4000H
Exercise #2
• Unless otherwise stated, determine the contents of all the affected general-purpose
registers and memory addresses after executing the following program. Each
instruction is dependent of one another. Whenever necessary, use the memory map
(handout) for additional data. Assume the following register contents:
AX = 0015H BP = 0002H CS = 3000H
XCHG AX, BX
MOV [CX], AX
XCHG BX,[CX + SI + 000FH]
PUSH AX
PUSH [BX]
AR101 - Computer Architecture and Organization
Week 6– Data Transfer Instructions
Exercise # 3
• Unless otherwise stated, determine the contents of all the affected general-
purpose registers and memory addresses after executing the following program.
Each instruction is dependent of one another. Whenever necessary, use the
memory map (handout) for additional data. Assume the following register
contents:
AX = 0015H BP = 0002H CS = 3000H
BX = 0019H SP = 0035H DS = 2000H
CX = 0012H DI = 0017H SS = 2000H
DX = 001BH SI = 001EH ES = 4000H
PUSH DX
PUSH [BX + DI]
AR101 - Computer Architecture and Organization
Week 6– Data Transfer Instructions
POP AX
POP [BX]
AR101 - Computer Architecture and Organization
Week 6– Data Transfer Instructions
Exercise # 4
Unless otherwise stated, determine the contents of all the affected general
purpose registers and memory addresses after executing the following program.
Each instruction is dependent of one another. Whenever necessary, use the
memory map (handout) for additional data. Assume the following register
contents:
AX = 0015H BP = 0002H CS = 3000H
BX = 0019H SP = 0035H DS = 2000H
CX = 0012H DI = 0017H SS = 2000H
DX = 001BH SI = 001EH ES = 4000H
POP CX
POP[BX + DI + 000AH]
AR101 - Computer Architecture and Organization
Week 6– Data Transfer Instructions
Exercise #5
• Unless otherwise stated, determine the contents of all the affected general-purpose registers and
memory addresses after executing the following program. Each instruction is dependent of one
another. Whenever necessary, use the memory map (handout) for additional data. Assume the
following register contents:
AX = 0015H BP = 0002H CS = 3000H
POP CX
POP [BP + SI + 0010H]
PUSH SI
PUSH [DI]
AR101 - Computer Architecture and Organization
Week 6– Data Transfer Instructions
DS = 5000H
LIST = 1800H
AR101 - Computer Architecture and Organization
Week 6– Data Transfer Instructions
Exercise # 6
Unless otherwise stated, determine the contents of all the affected general purpose registers and
memory addresses after executing the following program. Each instruction is dependent of one
another. Whenever necessary, use the memory map (handout) for additional data. Assume the
following register contents:
AX = 0015H BP = 0002H CS = 3000H
BX = 0019H SP = 0035H DS = 2000H
CX = 0012H DI = 0017H SS = 2000H
DX = 001BH SI = 001EH ES = 4000H
End of Lesson…
•References:
•
•[1]
https://www.includehelp.com/embedded-system/data-transfer-instructions-8086-microprocesso
r.aspx
•
•[2] Data transfer instructions in 8086 microprocessor - GeeksforGeeks
•[3] Williams, Stallings (2010), Computer Organization and Architecture:
• Designing for Performance (8th Edition, Prentice Hall, New Jersey).
•
•[4] Stalling, William, Computer Organization and Architecture:
• Principles of Structure and Function (4th Edition)
AR101 - Computer Architecture and Organization
Week 6– Data Transfer Instructions
PUSHA none put all the registers into the stack PUSHA
POPA none gets words from the stack to all registers POPA
LAHF none loads AH with the lower byte of the flag register LAHF
SAHF none stores AH register to lower byte of the flag register SAHF
PUSHF none copies the flag register at the top of the stack PUSHF
POPF none copies a word at the top of the stack to the flag register POPF