greenwhat wrote
I want to know where each pointer actually points, but how can I know this after it changes from its initial position? Until FibonnacciSeries I had been using a function from a class that I implemented that would return this location.
For example,
return "@" + memory.getTHAT(int fromBase) + "\nD=M\n";
The formula was (THAT = RAM[4] + fromBase), but this no longer works because the base position of THAT changes during each loop.
I don't understand what loops have to do with anything.
The value of the THAT pointer changes whenever a "pop pointer 1" VM command occurs.
The code that is generated for "push that 17" is independent of the actual value of the THAT pointer. Your translator needs to write asm code that does something like this:
@THAT
D=M
@17
A=A+D
The A register now has the target RAM address for THAT[17]. Load M into D and do whatever you need to do to push D.
--Mark