|
The following jack program induces an error in the VM emulator:
class m3 {
function void main() {
do.Output.printString("I")
}
}
The Jack compiler translates this into:
function m3.main 0
push constant 1
call String.new 1
push constant 73
call String.appendChar 2
call Output.printString 1
pop temp 0
push constant 0
return
In the vmEmulator, single stepping through the program, I get to the line
"push constant 73" and before executing it I get the error message "A built-in
function tried to access memory outside the Heap or Screen range".
Anyone know why?
The state of RAM at that point is:
SP: 0 268
LCL: 1 268
ARG: 2 262
...
The rest are 0.
The global stack is:
256 1
257 3
258 0
259 0
260 0
261 0
262 3
263 -1
264 262
265 256
266 0
...
The rest are 0.
|