Dallas wrote
I still don't fully understand when to use A and when to use M. Obviously they are not interchangeable. Anyone have a good explanation why they aren't?
Use A when you want to read or set the value in the A register. For example, to set the D register to 123 you need to use
@123
D=A
If you need to triple the value in D, you would start by setting A
A=D
D=D+A
D=D+A
Use M when you want to read or set a value in RAM. The current value in A is the address of the RAM cell that will be used. To read RAM variable
foo into D use
@foo
D=M
and to write it back to RAM
@foo
M=D
You can do both at the same time. To add 42 to
foo @42
D=A
@foo
M=M+D
--Mark