Tim wrote
I was wondering while working on VM I about detecting the borders of your registers.
For example, we use the the fixed 8 entry segments for the 'temp' segment in the RAM. But on what level do you begin to detect whether someone is actually still writing in that part?
What if someone ask for 'push temp 10'? Do we save it in R15? Or in temp 7 anyways? Or is this a command that cannot occur due to a higher layer (e.g. VM II or High Level Language)?
Since the VM code is indended to be written by the Jack Compiler, and not by humans, it is assumed to be error free, so there is no need to deal with out-of-bounds issues.
My VM Translator does no bounds checking. It might be helpful for debugging the compiler, however, to issue a message and abort the translation on out-of-bounds errors.
--Mark