Presentation is loading. Please wait.

Presentation is loading. Please wait.

Addressing Mode Wannachai Wannasawade Department of Computer Education Faculty of Technical Education, KMITNB.

Similar presentations


Presentation on theme: "Addressing Mode Wannachai Wannasawade Department of Computer Education Faculty of Technical Education, KMITNB."— Presentation transcript:

1

2 Addressing Mode Wannachai Wannasawade Department of Computer Education Faculty of Technical Education, KMITNB.

3 2 Addressing Mode วิธีการ อ้างตำแหน่ง ในการพัฒนาโปรแกรมต่าง ๆ มีการอ้าง ถึงตำแหน่งของข้อมูล ตามที่มีในคำสั่งของ ไมโครโพรเซสเซอร์ ซึ่งมีหลายวิธีในการ ติดต่อ ดังนั้นสิ่งที่จะต้องเรียนรู้คือ Addressing Mode หรือ วิธีการ อ้างตำแหน่ง วิธีการอ้างตำแหน่งแบ่งได้ 3 แบบคือ Data Addressing Mode  Data Addressing Mode Program Memory Addressing Mode  Program Memory Addressing Mode Stack Memory Addressing Mode  Stack Memory Addressing Mode

4 3 Data Addressing Mode  Register addressing  Immediate addressing  Direct addressing  Register indirect address  Base-plus-index addressing  Register relative addressing  Base relative-plus-index addressing  Scaled-index address

5 4 Register Addressing Transfer byte or word from source register or memory location to destination register or memory location Data Addressing Mode

6 5 MOV BX,CX

7 6 Immediate Addressing Transfer source immediate byte or word of data into the destination register or memory location Data Addressing Mode

8 7 MOV EAX,13456H

9 8 Direct Addressing Moves byte or word between a memory location and register  Direct Addressing move between memory location and AL,AX or EAX  Displacement Addressing applies to almost any instruction in the instruction set Data Addressing Mode

10 9

11 10 Data Addressing Mode MOV AL,[1234H]

12 11 Register Indirect Addressing Transfer byte or word between register and memory location address by index or base register Data Addressing Mode

13 12 Data Addressing Mode MOV AX,[BX]

14 13 Base-Plus-Index Addressing Transfer byte or word between register and memory location address by base register (BX or BP) plus index register (DI or SI) Data Addressing Mode

15 14 Data Addressing Mode MOV DX,[BX+DI]

16 15 Register-Relative Addressing Moves byte or word between register and memory location address by index or base register plus displacement Data Addressing Mode

17 16 Data Addressing Mode MOV AX,[BX+1000H]

18 17 Base Relative-Plus-Index Addressing Transfer byte or word between register and memory location address by base register and index register plus displacement Data Addressing Mode

19 18 Data Addressing Mode MOV AX,[BX+SI+1000H]

20 19 Scale-Index Addressing Available Pentium used second register of pair of register is modified by the scale factor of 2X, 4X or 8X to generate the operand memory address Data Addressing Mode

21 20 Program Memory Addressing Mode Used with the JMP and CALL instruction มีใช้งาน 3 แบบคือ Direct Program Memory Addressing  Direct Program Memory Addressing  Relative Program Memory Addressing  Indirect Program Memory Addressing

22 21 OpcodeOffset(low)Offset(High)Segment(high)Segment(low) E A0 1 0 Direct Program Memory Addressing What many early microprocessors used for all jumps and calls and also used in high-level languages. For example, JMP [10000H] intersegment jumps far jump Used in intersegment jumps or often called far jump

23 22 Relative Program Memory Addressing short jump near jump Not available in all early microprocessors, but available to some family of microprocessors. Relative means relative to instruction Pointer (IP) used in short jump or call (+127 and -128 byte from next instruction) and near jump or call (64K bytes)

24 23 Indirect Program Memory Addressing indirect-indirect double-indirect jump Allows several forms of program indirect memory addressing for JMP and CALL. This type of jump is sometimes called indirect-indirect or double-indirect jump Examples of indirect program memory addressing JMPAX JMPCX JMPNEAR PTR [BX] JMPTABLE [BX] JMPECX

25 24 Stack Memory Addressing Mode PUSHPOP The stack plays an importance role in all microprocessor. It holds data temporarily and stores return address of procedures. Used by PUSH and POP that maintained by two register  Stack Pointer register (SP or ESP)  Stack Segment register (SS)

26 25 Stack Memory Addressing Mode PUSH BXPOP CX PUSH and POP a) PUSH BX b) POP CX

27 26 เป็นกลุ่มคำสั่งที่ไมโครโพรเซสเซอร์รู้จัก และเข้าใจ ซึ่งสามารถแบ่งเป็นกลุ่มต่าง ๆ ได้ดังนี้  Data Movement Instructions  Arithmetic and Logic Instructions  Program Control Instructions

28 27 Opcode 1-2 bytes MOD-REG-R/M 0-1 bytes Displacement 0-1 bytes Immediate 0-2 bytes 16 bits Instruction mode Opcode 1-2 bytes MOD-REG-R/M 0-1 bytes Displacement 0-4 bytes Immediate 0-4 bytes Scaled-index 0-1 bytes Operand size 0-1 bytes Address size 0-1 bytes 32 bits Instruction mode (80386,80486 and Pentium) MOV Instruction

29 28  PUSH and POP  Load-Effective Address LEALDSLES LFSLGSLSS  String Data Transfer LODSSTOSMOVS INSOUTS  XCHG  LAHF and SAHF  XLAT  IN and OUT

30 29  MOVSX and MOVZX  BSWAP  CMOV  Segment Override Prefix

31 30 Addition  Register Addition  Immediate Addition  Memory to Register Addition  Array Addition  Increment Addition  Addition with Carry

32 31 Subtraction  Register Subtraction  Immediate Subtraction  Decrement Subtraction  Subtract with Borrow

33 32 Comparison  CMP (Compare)  CMPXCHG (Compare and Exchange) used in Pentium

34 33 Multiplication  8 bit Multiplication  16 bit Multiplication  Special Immediate 16 bit Multiplication  32 bit Multiplication

35 34 Division  8 bit Division  16 bit Division  32 bit Division

36 35 BCD and ASCII  BCD Arithmetic  DAA  DAS  ASCII Arithmetic  AAA  AAD  AAM  AAS

37 36 Basic Logic  AND  OR  XOR  TEST and Bit Test  NOT and NEG

38 37 Shift  SHL  SHR  SAR  SAL  SHLD  SHRD

39 38 Rotate  ROL  ROR  RCL  RCR

40 39 Bit Scan Instruction  BSF  BSR String Comparisons  SCAS  CMPS

41 40 Jump Group  Unconditional Jump (JMP)  Short Jump  Near Jump  Far Jump  Jumps with Register Operands  Indirect Jumps Using Index

42 41 Jump Group  Conditional Jump and Condition Sets JAJAEJBJBE JCJE or JZJGJGE JLJLEJNCJNE or JNZ JNOJNSJNP or JPOJO JP or JPEJSJCXZ JECXZ LOOPCondition LOOPs

43 42 Procedures  CALL  Near CALL  Far CALL  CALL with Register Operands  CALL with Indirect Memory Address  RET

44 43 Other Instructions  Interrupt Instructions  INT X  IRET/IRETD  WAIT  HLT  NOP

45 44 Other Instructions  LOCK Prefix  ESC  BOUND  ENTER and LEAVE


Download ppt "Addressing Mode Wannachai Wannasawade Department of Computer Education Faculty of Technical Education, KMITNB."

Similar presentations


Ads by Google