I've found something this morning deep into the colorforth code that I
really liked, in the early uxn days, I started off from a pforth-like
implementation, in which things like ROT, are subsequence storing of
values from pop()
https://wiki.xxiivv.com/etc/lbforth9.c.txt
Today, I realized that a possibly more interesting set of primitives
for the microcode or implementation of the stack operators would be
the use the DROP, ROLL, PICK operators to create the rest, as per:
https://wiki.xxiivv.com/site/forth.html ( bottom of the page, I
created a little table )
With this ordering of the primitives, we have something like J1's
bytecode packing:
DROP 0 = POP
DROP 1 = NIP
ROLL 0 = SWP
ROLL 1 = ROT
PICK 0 = DUP
PICK 1 = OVR
This change would impact the keep mode, from my experiments it also
creates a few issues, it seems to be creating redundancy where the
Keep mode of one operator, is also found as the default behavior of
another. In any case, I find that this order of opcode is so
beautiful, that I thought I should put it here while I toy around with
it. Without changing the implementation details, it might be worth
using this ordering of stack manipulating opcode.
Let me know what you think :)
P.S. I'm taking some time off IRC while we're traveling.
On Sun, 2022-04-17 at 13:13 -0700, Devine Lu Linvega wrote:
> https://wiki.xxiivv.com/site/forth.html ( bottom of the page, I> created a little table )
A line explainig the stack preset is `a b c` might help readers that
see this page before sailing thru the page about stack permutations.
On Sun, Apr 17, 2022 at 01:13:59PM -0700, Devine Lu Linvega wrote:
>In any case, I find that this order of opcode is so>beautiful, that I thought I should put it here while I toy around with>it. Without changing the implementation details, it might be worth>using this ordering of stack manipulating opcode.
The opcode shuffling has been added to main now:
https://git.sr.ht/~rabbits/uxn/commit/d5253086b54911bf33db635fa5eadf03eee35a6a
The patch to uxnasm.c shows the changes most concisely:
- "LIT", "INC", "POP", "DUP", "NIP", "SWP", "OVR", "ROT"
+ "LIT", "INC", "POP", "NIP", "SWP", "ROT", "DUP", "OVR"
This means that .rom files won't be compatible with before this change,
but .tal files can be reassembled with uxnasm or asma and they will work
fine.
Best wishes,
Andy
Hi,
>The opcode shuffling has been added to main now:>https://git.sr.ht/~rabbits/uxn/commit/d5253086b54911bf33db635fa5eadf03eee35a6a
The OP code changes have been updated for uxngba [1] and uxn-linuxfb [2].
[1]: https://git.sr.ht/~rabbits/uxn-gba
[2]: https://git.badd10de.dev/uxn-linuxfb/
--
Bad Diode