 Hello myself, Ravindra Chauhan from Valtran Institute of Technology, Solapur. Now today in this session, we will discuss about the ARM 7 addressing modes. At the end of this session, the students will able to demonstrate the ARM addressing mode. Also, students can able to write the ARM instructions using various addressing modes. The outline of this discussion, first we will see what is addressing mode. Then addressing modes defined for data processing instruction in ARM 7 processor. Now what do you mean by addressing mode? Now while writing the instructions, we are writing first the operation to be performed that is the upcode and next there is need to specify the data that is the values on which the said operation is to be performed that is called the operands. So these operands or data to be processed can be write in the instruction in number of phase which is called the addressing mode. So the addressing mode can be defined as the way in which operands are specified in the instruction is called addressing mode. Now the addressing modes defined for data processing instruction in ARM 7. Now see the general syntax of the data processing instruction. First is the upcode that is operation to be performed then the condition then the speed and the destination register and the two operands RN and shifter operand. Now this shifter operand can be specified in number of phase. So the various addressing modes are used to calculate the shifter operand in ARM data processing instruction. The first way is called the immediate addressing mode. So syntax of immediate addressing mode this shifter operand can be specified by writing hash and the value. So the example of this move r0, hash 0 means r0 will be load with the value 0. The one more example you consider add r3, r3, hash 1. So the r3 will be equal to r3 plus 1. The next addressing mode is called the register addressing mode. And the syntax is simply you write the register. So example move r2, r0. So here the data is in the register and that register we are specifying in the instruction. That's why it is called the register addressing mode. So this move instruction transfers the contents of r0 into r2 register. The next example shown here is add r4, r3, r2. So the operands are in r2 register and r3 register. So the value stored in r2 and r3 that will be get added and the result that is sum will get stored in r4 register. Next addressing mode is called the shifted register operand. So here the second operand is first pre-processed by two operations, the shift operation and rotate operation. So syntax is first write the register comma, shift or rotate operation, hash the value. Another register operand value is the value of a register shifted or rotated before it is used as the data processing operand. That means the second operand first it is pre-processed and then the actual operation will takes place. value types of shifts are defined for R7, arithmetic shift write, logical shift left, logical shift write, rotate write and rotate write with extend. So example shown here for shifted register operand addressing modes. First move r2 comma r0 comma lsl hash 2. So what this instruction does, first this instruction shifts the r0 left by two position and then write the new value into r2 register. Similarly add r9 comma r5 comma r5 comma lsl hash 3. So here r5 first shifted left by three position which gives the result r5 into 8 and this product will gets add into the original value of r5 and the result will get stored in register r9. Now move r12, r4, r0, r3. Now this instruction first rotates the r4 register with the value stored in r3 register and that new value will get stored in r12 register. Now you pause the video, think and write for this instruction does add eq r9 comma r5 comma r5 lsl hash 4. Now this instruction will first multiply r5 by 16 and then the second register will gets add and whatever the result that will be get stored in r9 register. Now this instruction execute conditionally because of the eq is written in the instruction. So this instruction execute when 0 flag is set. Now the addressing modes defined for load store instruction. So first addressing mode is called the immediate offset. So immediate offset means the offset is the part of the instruction. See the example ldr r4 comma into bracket r2 comma hash 5. So this hash 5 is the offset will gets add into the value in r2. So this instruction loads the r4 register with the value stored at pymery address r2 plus 5. Next addressing mode is called the register offset addressing mode where the register is the part of the instruction and the data is stored in the register. See the example ldr r4 comma into bracket r2 comma r3. So r4 will load with the value stored at pymery address r2 plus r3. Next addressing mode is called the scaled register offset addressing mode. So here first register will be preprocessed and then the actual address will be gets calculated. So example see str r0 comma r1 comma r2 lsl hash 2. So r2 register will be gets preprocessed. So for this instruction first r2 will be get shipped by two position then that value will be gets add into the r1 register and at that particular address the r0 will get stored. So this instruction stores r0 to an address equal to the sum of r1 and 4 times r2. Now immediate pre-indexed addressing mode. Now these addressing modes used for address pointer to access an array type of data. So example here str r0 comma into bracket r1 comma hash 2 and the special character shown in the instruction. Now this special character indicates that the address pointer will gets incremented. Now what this instruction does? This instruction stores r0 to an address equal to r1 plus 2 and write the new address that is r1 plus 2 into r1 register. So the new value in r1 is equal to r1 plus 2. Now register pre-indexed addressing mode. Here see the example ldr r4 comma into bracket r2 comma r3 and special character. So this instruction loads the r4 register with the memory address calculated by the value stored in r2 plus value stored in r3 register. And the new address that is equal to r2 plus r3 will be get stored in r2 register. So scaled register pre-indexed addressing mode. In this particular addressing mode the register will be gets pre-processed first. Now see the example here in this instruction return r3 comma lsl hash 2. So first r3 will shift left by 2 position. And then that value will gets add into the register r2. So what this instruction does? This instruction loads the r4 register with the memory address calculated by r2 plus r3 left rotating by 2. And also because of that special character the new address that is r2 plus r3 shift left by 2 position is right into the r2 register. So references considered for this particular presentations are the book from Andrew Schloss, Stu Fervor and the ARM7 datasheet. Thank you.