Memory Address Register (MAR)

The Memory Address Register (MAR) is a CPU register that holds the address of a memory location where data or an instruction is stored.

How is this different from a Program Counter?

Program Counter holds the address of the instruction to be executed. MAR and MBR are used for


Holds the address of the next instruction to be executed.

Reading from Memory: MAR and MBR

When reading from memory, data is first placed into the MBR from the memory location and then it is moved to the appropriate CPU register or location. Conversely, when writing to memory, the data is first stored in the MBR and then written to the memory location specified by the MAR.

When the CPU needs to read from or write to a specific location in memory, it first loads the address of that location into the MAR. The memory controller then uses this address to access the correct memory location.