There is something I don't understand with controlling the SP. As I understand it, we want to move the pointer by incrementing its address, controlled by the A-register in the hack language. So for example, if I want to perform the following command:
push local 2
@SP //go to SP
D=A //store the current address of SP
@R13
M=D // store the address of SP in the memory of R13
@LCL
A=A+2 //go to the base address of local(A)+2
D=M // Store the value at local 2
@R13
A=M //go to the address of SP
M=D //Store the value from local 2
@SP
A=A+1 //increment the SP pointer so that it points above the top value
To me, this makes sense. Have I got it all wrong?
Sorry for the convoluted post.