AndyGeo wrote
Further down, I'm not too sure on the @sum part.
@i
D=M //D=i
@sum
M=D+M // sum =sum+i
so D register is set to i.
Then A register is set to sum,
It's the next line i'm not too sure on. I'm reading it as sum= i + sum.
They mean the same thing as the example but I'm just wondering if i'm on the right track.
Is M=M+D not valid?
Yes, M=D+M and M=M+D mean the same thing. The assembler built in to the CPU Emulator accepts either, although it changes M=M+D into M=D+M. I think that earlier versions of the assembler may have been pickier and only accepted M=D+M which is why the code doesn't quite match the comment.
--Mark