# M register == RAM[A], Why?

7 messages
Open this post in threaded view
|

## M register == RAM[A], Why?

 As I understand: - M register sits in the main memory (RAM) - A register is a CPU register - D register is a CPU register - M register is RAM[A] - That means the value of RAM in the address of A As I understand, we need it to be able to access the value of A because of the lack of instruction bits. So why don't we have some register to access D value? It seems like we are able to do operations with D value, for example, D = D+M, but not with A value. I'll be happy to get an explanation to fill the lack of my understanding.
Open this post in threaded view
|

## Re: M register == RAM[A], Why?

 Administrator I don't understand the question. What do you mean by a register to access D value? As you will see in the next chapter, the architecture has one input of the ALU tied to the D register. The other input of the ALU can have EITHER the value in the A register OR the value from the RAM (at the locations whose address is in the A register). So there's no way to feed BOTH the A and the M values to the ALU. They could have altered the architecture to make it possible, but the instances when you would want to add a memory locations contents to its address are few. Having said that, it would have some advantages for working with arrays, but they decided that those advantages weren't worth the added complexity of the architecture.
Open this post in threaded view
|

## Re: M register == RAM[A], Why?

 Excuse me, I'll paraphrase myself. What is this M  and why do we use it?
Open this post in threaded view
|

## Re: M register == RAM[A], Why?

 Administrator You said it yourself, M is RAM[A], the RAM cell located at the address whose contents are in the A register. We use it because we would like to be able to read and write information to more than just two locations, namely D and A.
Open this post in threaded view
|

## Re: M register == RAM[A], Why?

 Why can we write RAM[A]?