I've been having some issues getting this to work, and I just want to make sure:
When we pop or push a value to/from LCL/ARG/THIS/THAT, are we using the address or the literal value in these registers?
If my current local segment starts at address 300 and the value stored in memory location 300 is 42, what information is it that I need to remember so that I can restore the location of my local segment after returning from a function call? Do I need the 300, or the 42?
So you would go to the address of (Memory(RAM) + 7) then get the memory of this RAM address and add it to the stack?
And does this differ to when you create the frame, where you would save the address of the current LCL/ARG/etc position?
That's definitely a far clearer way of describing it.
I found out the root of my issue was in the stack frames - in the translator, I tried to push the registers to reuse code, however this gave the memory instead of the addresses. I've modified it and the program now works, though the translator's code is not as clean as I hoped.
Thanks for the help