80 likes | 260 Views
Assembly Language – Lab 6. Register Indirect Mode, Based and Indexed Addressing Modes. Register Indirect Mode. Transfer a byte or word between a register and a memory location addressed by an index or base register. Example MOV AL, [SI] SI – index register
E N D
Assembly Language – Lab6 Register Indirect Mode, Based and Indexed Addressing Modes
Register Indirect Mode • Transfer a byte or word between a register and a memory location addressed by an index or base register. • Example MOV AL, [SI] • SI – index register • The symbol [] always refer to an indirect addressing. • The register must be one of the following: BX, SI, DI, BP.
Example 1 • Program that display the array elements.
Example 2 • Program calculate sum in AX of 10 elements in the array. Use Indirect Mode.
Based and Indexed Addressing Modes • The operand’s offset address is obtained by adding a number called a displacement to the contents of a register. • Displacement may be offset address of a variable, constant, offset address of a variable + or - a constant. • Syntax of the based-indexed addressing mode: • The register must be one of the following: Based: BX, BP– Indexed: SI, DI. • [register + displacement] • [displacement + register] • [register] + displacement • displacement + [register] • displacement[register]
Example 3 • Replace each lower case letter in string by it’s upper case equivalence.
Based and Indexed Addressing Modes • Suppose that LIST is declared as LIST DW 0542H,0126H,0953H,0DEFH BX contains 2 offset 0002 contains 1043H SI contains 4offset 0004 contains 0ABDH DI contains 1 • The result of following instructions:
Example 4 • Program calculate the sum in AX of 10 elements in the array. Use Based and IndexedMode.