Hi 4tH-ers!
I recently made a video about encoding the Chao cypher in 4tH. And that one was highly educational - at least to me. I came across a sequence >R OVER R> SWAP, which kind of irritated me, because it smelled like stack acrobatics.
Later it dawned to me, it was a familiar word, called THIRD in COMUS. It was proposed by my mentor - and although I hold this guy in high regard, I don't like this name. It doesn't fit in the line of DUP, SWAP, ROT.
Now, it also has another name, PLUCK. Not quite happy with that, but better than THIRD. So, next step was to see how often it had been used. Very few times in application programs, but quite often in libraries. Most uses are not by my hand, but still - they're part of 4tH.
So, I implemented it as an inline macro (internal word, expanded by the compiler itself). And I replaced all former uses in the repository by PLUCK.
While I was at it, I came across the "wildcard" libraries. Now, these are relatively old (2006 and 2014), so I patched them up. Note - these are not too beautiful. Just out of curiosity I recoded them. And this came out of that exercise:
- The new code is much more understandable;
- The new code is less than half the size of the old one (in opcodes);
- The new code requires NO libraries at all;
- The new code also works with addr/count strings (not ASCIIZ);
- The new code uses two variables (instead of none);
- The new code balances the parameters between the Data and the Return stack (less stack acrobatics due to shallow stack usage).
I thought that was quite interesting. Code in SVN.
Hans Bezemer