7 Addressing Modes Immediate data: MOV A, #60H (A) #60H #: constant “Immediate” meansthe data is in the instructionand can be accessed by the CPU immediately.The processor:Reads the opcode into the CPUActs according to the opcode
8 Addressing Modes Direct addressing: MOV A,60H [ (A) (60H) ] 60H = memory addressE5Hopcode60HAddress of dataACPU“Direct” means the data address is contained in the instruction and the CPU can access the data directly with the data address.
10 Address of R0 ~ R7RS1, RS00, 00, 11, 01, 1Register bank,selectedRB0RB1RB2RB3R000H08H10H18HR101H09H11H19HR202H0AH12H1AHR303H0BH13H1BHR404H0CH14H1CHR505H0DH15H1DHR606H0EH16H1EHR707H0FH17H1FHPSW (Program Status Word)CYACF0RS1RS0OVP
11 Addressing Modes Indirect addressing: MOV A,@R0 @: pointer @R0 = an address whose value is stored at R0MOV DPTR, #1234HMOVMOV SP,#30HPUSH H5FH28H60H3FHData to be accessed61H41HR060H(3)(2)E6Hopcode(1)A“Indirect” means the data address is not contained in the instructionCPU
12 Addressing Modes 30H 31H SP before & after pushing Indirect addressing:MOV@: pointer@R0 = an address whose value is stored at R0類似: 托人帶來支票MOV DPTR, #1234HMOVMOV SP,#30HPUSH H30H25HTop of stack before pushing31H38HTop of stack after pushing60HData to be pushed(3)75HOpcode of mov SP,#30H81H30HC0HOpcode of push 60H60H“Indirect” means the data address is not contained in the instruction(1)A(2)CPU
13 Addressing Modes Index addressing (只能用於程式記憶體) MOVC A , @A + DPTR Possible base registers: DPTR, PCPossible index register: A