Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Contents: 3.1 Instruction format and Addressing Modes 3.2 Instruction Introduction Chapter 3 Instruction system.

Similar presentations


Presentation on theme: "1 Contents: 3.1 Instruction format and Addressing Modes 3.2 Instruction Introduction Chapter 3 Instruction system."— Presentation transcript:

1 1 Contents: 3.1 Instruction format and Addressing Modes 3.2 Instruction Introduction Chapter 3 Instruction system

2 2 Assemble Language: symbolic language Assembler: A computer program used to assemble Source Program  Assembler  Object program ( Source codes ) ( Machine codes ) Instruction Set: can not transplant directly Chapter 3 Instruction system 3.1 Instruction format and Addressing Modes

3 3 3.1.1 Instruction format Instruction = opcode operand = opcode destination operand, source operand Instruction types: 1-byte Instruction: includes opcode and operand 2-byte Instruction: 1th byte is opcode 2th byte is operand 3-byte Instruction: 1th byte is opcode 2th, 3th byte are operands

4 4 3.1 Instruction format and Addressing Modes Addressing: how to get the location of (source) operand. Addressing Modes: 7 types 1. Register Addressing 2. Direct Addressing 3. Register Indirect Addressing 4. Immediate Constants Addressing 5. Indexed Addressing 6. Boolean Addressing 3.1.2 Addressing Modes 7. Relative Addressing ( get the jumping destination address of PC )

5 5 3.1.2 Addressing Modes 1. Register Addressing Operand: denoted by register. For example: MOV A, R0 Addressing Range: ① General register: 4 banks × 8 ( R0 ~ R7 )= 32 registers ② Some SFRs: A, AB, DPTR, etc.

6 6 3.1.2 Addressing Modes Operand: denoted directly by 8-bit address. For example: MOV A, 3AH Addressing Range: ① Lower 128 bytes of internal RAM ② SFRs 2. Direct Addressing

7 7 3.1.2 Addressing Modes Operand: specifies a register to contain operand address with the prefix “ @ ”. Addressing Range: ① Lower 128 bytes of internal RAM ( 8-bit address ) ② 64KB of external RAM ( 16-bit address ) 3. Register Indirect Addressing address register of 8-bit address: Ri ( i = 0, 1 ) SP ( PUSH, POP ) address register of 16-bit address: DPTR For example: MOV A, @ R0 MOVX A, @DPTR

8 8 3.1.2 Addressing Modes Operand: specifies the value of a 8-bit or 16-bit constant with the prefix “ # ”. For example: MOV A, #3AH MOV DPTR, # 0200H 4. Immediate Constants Addressing

9 9 3.1.2 Addressing Modes Only three instruction: MOVC A, @A+DPTR MOVC A, @A+PC JMP @A+DPTR Addressing Range: Program Memory ( ROM ) 5. Indexed Addressing Program Memory can only be accessed via this mode. Designed for reading look-up tables in Program Memory or executing unconditional jumps. A 16-bit base register ( DPTR or PC ) points to the base address of table, and A is set up with the table entry number. The 16-bit address in ROM is formed by adding the A data to the base pointer.

10 10 3.1.2 Addressing Modes Addressing Range: 1. Bit addressable area in Internal RAM cell address: 20H~2FH, bit address: 00H~7FH  2 ways to specifies the addressing bit: ① Cell address + bit: 20H.6 ② Bit address: 06H 6. Boolean Addressing 2. Addressable bit in SFRs  4 ways to specifies the addressing bit ① SFR symbol + bit: PSW.5 ② Bit address: 0D5H ③ Cell address + bit: 0D0H.5 ④ Bit name: F0

11 11 3.1.2 Addressing Modes offset Range: - 128 ( backward ) ~ + 127 ( forward ) 7. Relative Addressing Used for getting the jumping destination address of PC in Jump Instruction. Destination address = PC + rel PC = ( address + byte number ) of Jump instruction rel = 8-bit relative offset byte Return


Download ppt "1 Contents: 3.1 Instruction format and Addressing Modes 3.2 Instruction Introduction Chapter 3 Instruction system."

Similar presentations


Ads by Google