shell script testing (im not a shell sripter)
yea this is bare bones, i wrote it on the commute home
i will expand it with more tests and what not later on
this mostly switches from using a resizeable hash table to store macros
and whatnot to using a binary search tree (i was having some heisenbugs
with the hash table that i didn't really feel like debugging it).
a BST has a simpler implementation and uses a bit less memory, however
it is potentially slower (O(log n) vs O(1)) & less cache performant
however, currently i care more about ease of implementation so i can
muck about with my impl without running into bugs. when i care more
about performance i will probably revert this change (or rewrite a
working hash table), but not without benchmarks
as:$ keep flag
keep flag, whether to decrement the stack pointers for
the arguments used in the instruction
e.g. (a--n) --> (a--a n)
this is useful in situations where we want to keep the
arguments on the stack to do something else with, e.g.
a lot of the times we'll do `du fb` or something. now
we can save bytes and just do `$fb`. yippee!
{d/kmm32-as,s/vim}:{document,highlight} ^ literal
this allows us to create relative addresses easily
eg. `pr ^l ju :l ;` & `pw @l ju :l ;` are equivelant
this also enables us to easily make pascal-style (?)
length-prefixed strings, given the string size is <127:
`:str ^l "meow" :l ; ;`
`pr x` (where x is a byte) puts ip+(int8)x onto the stack
eg. `pr #04 ju xx yy zz` skips bytes xx&yy and jumps to zz
0 1 2 3 4
^
+- relative to
this allows us to cut down by a full 3 bytes when referring
to labels that are closer than 128 bytes away, and allows
us to relocate less labels
(if we ever have relocatable binaries or something)
rationale:i was thinking about adding some instructions to
disable/enable interrupt vectors but, it's not really
necessary to have peripherals running in parallel with the
instructions on the CPU, and it simplifies code a lot by
assuming they are not
adds F flag to instructions (~op in the assembler)
makes stack management on the return stack much easier,
and now returning from a function only takes 1 instruction
(~ju) rather than two (mr ju). also, this allows us to
remove some opcodes from the opcode set that were kind of
unneccessary