First, all of the commands are Forth words, and they're using the text interpreter to do dispatch. It's like passing a string to Lisp EVAL (but vetting it first).
Second, they're using the Forth BLOCK system, which is a crude "virtual memory". But this makes things quite easy for them I/O wise. Everything is stored as absolute offsets, they MOD is by the block size, and say "give me a pointer to BLOCK N", and the system returns that. Side effects? Everything is just done "in memory". The BLOCK system does the rest (including caching and flushing change blocks back to disk). Instead of mmap, you wanted a miracle? I give you BLOCK.
Neat stuff, 600ish lines of code.
(If someone wants to read the pristine .SCR file, Emacs has a Forth Block major mode you can hunt down to make reading it easy.)
Couple of takeaways.
First, all of the commands are Forth words, and they're using the text interpreter to do dispatch. It's like passing a string to Lisp EVAL (but vetting it first).
Second, they're using the Forth BLOCK system, which is a crude "virtual memory". But this makes things quite easy for them I/O wise. Everything is stored as absolute offsets, they MOD is by the block size, and say "give me a pointer to BLOCK N", and the system returns that. Side effects? Everything is just done "in memory". The BLOCK system does the rest (including caching and flushing change blocks back to disk). Instead of mmap, you wanted a miracle? I give you BLOCK.
Neat stuff, 600ish lines of code.
(If someone wants to read the pristine .SCR file, Emacs has a Forth Block major mode you can hunt down to make reading it easy.)