Write a program to demonstrate indirect bank register addressing
A total of 32 bytes of RAM are set aside for the register banks and the stack. These 32 bytes are divided into four register banks in which each bank has 8 registers, R0—R7. The third bank of R0—R7 starts at memory location 10H and goes to location to 17H.
If RAM locations 00—1F are set aside for the four registers banks, which register bank of R0—R7 do we have access to when the is powered up? The answer is register bank 0; that is, RAM locations from 0 to 7 are accessed with the names R0 to R7 when programming the Because it is much easier to refer these RAM locations by names such as R0 to R7, rather than by their memory locations. Register bank 0 is the default when the is powered up.
We can switch to the other banks using PSW register. The stack is a section of a RAM used by the CPU to store information such as data or memory address on temporary basis. The CPU needs this storage area considering limited number of registers. R0 and R1 are 8 bits wide only. The limitations to accessing any information in the internal RAM memory of 30H to 7FH or special function registers only.
In this case DPTR is used. View the discussion thread. All Rights Reserved www. Skip to main content. The first operand defines the length of the data. When operands are specified in memory addressing mode, direct access to main memory, usually to the data segment, is required.
This way of addressing results in slower processing of data. To locate the exact location of data in memory, we need the segment start address, which is typically found in the DS register and an offset value. This offset value is also called effective address. In direct addressing mode, the offset value is specified directly as part of the instruction, usually indicated by the variable name.
The assembler calculates the offset value and maintains a symbol table, which stores the offset values of all the variables used in the program. In direct memory addressing, one of the operands refers to a memory location and the other operand references a register. This addressing mode uses the arithmetic operators to modify an address.
This addressing mode utilizes the computer's ability of Segment:Offset addressing. Indirect addressing is generally used for variables containing several elements like, arrays. Starting address of the array is stored in, say, the EBX register.
0コメント