News for hackers. Stuff that matters.
Re:The ancient world before computers had stacks or heaps by howerj on Wednesday April 03, 2024 @02:20PM (#39921021)
Yeah, it really is a pain to do anything in it. I got around that by writing in another language instead as soon as possible. You can paper over many issues with a VM, although it will slow things down on such limited computers.
Re:The ancient world before computers had stacks or heaps by anthk on Wednesday April 03, 2024 @03:19PM (#39921805)
How does muxleq work? It looks like a 'concurrent' subleq...
Re:The ancient world before computers had stacks or heaps by howerj on Wednesday April 03, 2024 @03:43PM (#39922112)
I am not sure what you mean by concurrent in this case, muxleq is just subleq with one extra instruction. The extra instruction is based off of multiplexing (see https://en.wikipedia.org/wiki/Multiplexer). Subleq as you know is incredibly inefficient, muxleq is an experiment to add a single instruction to Subleq in order to greatly improve its efficiency.

The `mux` instruction added computes:

   m[operand2] = (m[operand1] & ~selector) | (m[operand2] & selector)
As multiplexing is a universal gate (so long as you have access to true and false as constants) you can use this to calculate AND/OR/XOR, which are very expensive to do in a pure Subleq machine. It also means you can do a MOV in a single instruction instead of four (set the `selector` to zero in this case). This in turns speeds up indirect loads and stores.