This virtual machine of Ms. Albright's is not packaged like UCSD's, but in spirit it is the same animal: a stack machine with byte-coded instructions - one opcode plus inline operands; locals addressed by slot rather than by name; one constant pool per code unit, referenced by index; conditional jump on a popped boolean; 16-bit integer math.
Where it differs is more interesting, and some of it is ambition while other parts are just immaturity:
- Values carry tags: nil, bool, int, string, builtin. That is dynamic typing, which Pascal exists specifically to avoid.
- Parallel stack arrays: not just one array of records, but metadata in a parallel array object.
- Strings are first-class variables.
- Comparisons produce a value rather than just setting a condition.
- No procedures, frames or static links, no lexical levels, and no segments, code relocation or memory manager. This reads to me as her machine is young; it was not a decision.
- Dispatch is an if/else ladder ordered by how often she guessed each opcode would come up, not a 256-entry jump table.
And then there is this one comment in the file, which shapes my opinion of everything that follows.
VPUSHB 11 ; apple home()
She's fundamentally calling the Apple ][ specific functionality a library. On the first weekend that her virtual machine exists; with no actual language for this to be a library in. There is no opcode in her instruction set that knows what an Apple is. Everything that touches the hardware, the text page, the keyboard strobe, the monitor'sHOME, sits behind a numbered call. Three of them at this point: poke is 1, key is 10, home is 11.
Everything on this drive that impressed me later is telegraphed by that one comment, and we will come back to it in a few years of Ms. Albright's time.
Jorj Bauer
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.