Standard mapping for argument-, local- and pointer segment?
As there is no specific range declared, where these segments should reside in RAM. Is it preferable to place them somewhere in the range of the stack or the heap?
Why did Schocken and Nisan decide not to mention their placement at all, or did I just miss it?
Re: Standard mapping for argument-, local- and pointer segment?
The "pointer" segment is fixed at RAM address 3. "pointer 0" is THIS and "pointer 1" is THAT.
"argument" and "local" segments are based on the memory addresses in ARG and LCL, just like "this" and "that" segments are based on the memory addresses in THIS and THAT.
You might like to look ahead to figures 8.3 and 8.4 to see how the stack frames work and where the "argument" and "local" segments are on the stack and how they move based on the currently active function.
You can look at the BasicTest.vm code to see where it should write.
// Executes pop & push commands using the virtual memory segments.
push constant 10
pop local 0 RAM[300+0]
push constant 21
push constant 22
pop argument 2 RAM[400+2]
pop argument 1 RAM[400+1]
push constant 36
pop this 6 RAM[3000+6]