Download presentation
Presentation is loading. Please wait.
Published byKory Harrington Modified over 9 years ago
1
Princess Sumaya Univ. Computer Engineering Dept. Chapter 4:
2
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 1 / 20 Direct Data Transfers Immediate Operands ●Constant Values ●Exclude Segment Registers Example:
3
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 2 / 20 Direct Data Transfers Direct Memory Addressing ●Numerical Value ●Variable Name Example: Memory 0000 0001 0002 0003 0004 0005 Program File.Data DB0 CountDB5 SUMDW1234h.Code END
4
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 3 / 20 Direct Data Transfers MOV Instruction ●MOVreg, reg ●MOVmem, reg ●MOVreg, mem ●MOVmem, imm ●MOVreg, imm ●MOVreg, sreg ●MOVsreg, reg ●MOVmem, sreg ●MOVsreg, mem
5
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 4 / 20 Direct Data Transfers XCHG Instruction ●XCHGreg, reg ●XCHGreg, mem ●XCHGmem, reg
6
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 5 / 20 Direct Data Transfers Direct-Offset Memory Addressing ●Effective Address Example: Memory 0000 0001 0002 0003 0004 0005 Program File.Data Grades DB0 DB0 Profits DW0 DW0 END
7
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 6 / 20 Increment & Decrement INC and DEC Instructions ●INCreg ●INCmem ●DECreg ●DECmem Program File.Data Var1 DB5 DB6 DB7 Var2 DW1 Var3 DW2 Var4 DW3 END
8
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 7 / 20 Addition ADD Instruction ●ADDreg, reg ●ADDreg, mem ●ADDreg, imm ●ADDmem, reg ●ADDmem, imm Program File.Data Var1 DB5 DB6 DB7 Var2 DW1 DW2 DW3 END
9
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 8 / 20 Subtraction SUB Instruction ●SUBreg, reg ●SUBreg, mem ●SUBreg, imm ●SUBmem, reg ●SUBmem, imm NEG Instruction ●NEGreg ●NEGmem Program File.Data Var1 DB5 DB6 DB7 Var2 DW1 DW2 DW3 END
10
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 9 / 20 Implementing Arithmetic Expressions Example: Result = - X + (Y – Z) Program File.Data X DW5 Y DW6 Z DW7 Result DW1 DW2 DW3 END
11
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 10 / 20 Flags After Arithmetic Operations INC and DEC Instructions ●Zero Flag ●Sign Flag Program File.Data Var1 DB- 1 DB0 DB7Fh Var2 DW1 Var3 DW2 Var4 DW3 END
12
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 11 / 20 Flags After Arithmetic Operations ADD and SUB Instructions ●Zero Flag ●Sign Flag ●Carry (Borrow) Flag ●Overflow Flag Program File.Data Var1 DB- 1 DB1 DB7Fh Var2 DW1 Var3 DW2 Var4 DW3 END
13
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 12 / 20 Flags After Arithmetic Operations NEG Instruction ●Zero Flag ●Sign Flag ●Carry (Borrow) Flag ●Overflow Flag Program File.Data Var1 DB- 1 DB1 DB7Fh Var2 DW1 Var3 DW2 Var4 DW3 END
14
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 13 / 20 Indirect Addressing Indirect Memory Addressing ●SI, DI, BX Example: Memory 0000 0001 0002 0003 0004 0005 Program File.Data T DB5 DB7 DB2 V DW8 DW3 DW4 END
15
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 14 / 20 Indirect Addressing Array Example: Var1 = Σ Array1 Program File.Data Array1 DB5 DB6 DB7 Var1 DB0 Var2 DW0 Var3 DW0 END
16
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 15 / 20 Indirect Addressing Indexed Memory Addressing ●Constant + Pointer Example: Memory 0000 0001 0002 0003 0004 0005 Program File.Data X DB10 DB11 DB12 Y DW20 DW21 DW22 END
17
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 16 / 20 Indirect Addressing Base-Index Memory Addressing ●BX + (SI or DI) Example: Memory 0000 0001 0002 0003 0004 0005 Program File.Data Array1 DB11 DB12 DB13 DB21 DB22 DB23 END Array1 111213 212223 313233
18
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 17 / 20 Transferring Control Unconditional Transfer ●Jump ●Call Routine ●Return Example:
19
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 18 / 20 Transferring Control Conditional Transfer ●Jump on Condition Example:
20
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 19 / 20 Transferring Control Conditional Transfer ●Repeat a number of times Example:
21
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. 20 / 20 Transferring Control Conditional Transfer ●Repeat While (Another Chapter)
22
Princess Sumaya University 22342 – Computer Org. & Assembly Lang. Computer Engineering Dept. Chapter 4
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.