Error question

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Error question

LinearChaos
I have a question: Why would the first 4 digits for M=D by 1110, instead of 1111, since M=D is an M instruction?

Reply | Threaded
Open this post in threaded view
|

Re: Error question

WBahn
Administrator
How is the computation mnemonic "D" an M instruction???

The fourth bit dictates whether the A register or the M register is fed to the Y-input of the ALU. Since the computation in M=D is simply D, it doesn't matter whether your instruction uses the A or the M.
Reply | Threaded
Open this post in threaded view
|

Re: Error question

LinearChaos
Ah, yes! Thank you so much!

I've finished my Hack Assembler now (I used C++) and it's successfully completed all of the comparison tests! Phew!