3 ms·
The code just ignores variable declarations. All variables are 16-bit words. It just hashes the variable name and uses twice the hash value as the address of t
by devit 3y ago
The code just ignores variable declarations. All variables are 16-bit words.
It just hashes the variable name and uses twice the hash value as the address of the variable in memory
For functions instead it uses twice the hash to store and lookup the function address at compile time, dedicating the whole compiler data segment except it seems for ds:0 to that table.
Note that in segmented x86-16, the code (plus constants) and stack are in dedicated segments, and string functions used to write the generated code write to yet another segment selected by es.
This seems to be the best strategy for compiler code size, although obviously it's vulnerable to hash collisions and only supports global non-array variables.