Image:
 Author: Little Group: Default Filesize: 67.13 kB Date added: 2022-08-23 Rating: 5 Downloads: 2136 Views: 337 Comments: 3 Ratings: 1 Times favored: 0 Made with: Algodoo v2.1.0 Tags:
|
This might look a little bit - I take that back.
This looks a lot different from my regular computer scenes.
And indeed it is! Most of my Algodoo computers run the programming language "Chives", meant to be a human-friendly general-purpose programming language.
But this processor here runs an Esolanguage known as "SUBLEQ", or SUbtract and Branch if Less than or EQual to zero.
Included in the scene is the processor, detailed instructions, a memory map, sample programs, and a compiler so you don't have to strain yourself manually writing SUBLEQ.
Notes:
*The Basil compiler could seriously get an efficiency upgrade for addn. There's a way to do it way more efficiently (about 3x faster to run), however I can't really be bothered right now.
*I highly recommend NOT looking at the Memory monitor while the processor is actively running if you have Epilepsy.
*I didn't feel like writing a graphics processor for the terminal, so if there's too much text on it text will start to scale down.
Basically, Subleq takes the following opcode:
SUBLEQ a, b, c
What it does is set B to itself minus A, and if B is less than or equal to zero, it will jump to line C.
Subleq is a OISC language, meaning it is a turing-complete language (heck, if you managed to create a memory expansion pack, and an ASCII parser for this thing, you could THEORETICALLY run Chives on it).
Any turing-complete instruction set can emulate its own turing-complete instruction set, and run any program for any Turing-complete computer.
Some examples of Turing-Complete instructions sets are:
SUBLEQ
C++
Chives
Javascript
Java
Python
So what's the catch?
Unfortunately, Subleq has one major drawback.
Subleq requires that one address MUST be zero, and another one must be a non-zero value.
This is usually solved because Subleq's program memory is usually inside of the WRAM (working memory), however due to Thyme's inability to directly change an element in a list, this cannot be achieved without absolute snail speed.
For simplicity sake, I have set the processor so that, upon reset, Address 0 is 1 and Address 1 is 0.
Despite this, Subleq is still generally considered Turing-Complete even though the memory does have to be pre-set in order for it to do anything at all.
Subleq is considered an "Esoteric" language, which is a language designed to be purposely confusing or to push a boundry of computing.
This falls into the second aforementioned category, being designed as the simplest turing-complete language.
There is a slightly more advanced, less esoteric variant of SUBLEQ known as SUBLEQX, which has a 4th argument to replace 0. This allows for hardcoded loops.
UPDATE:
Added a terminal, and added print/clear functions in "Basil+" for said terminal.
The terminal reads from addresses 30 and 31, where address 30 is the terminal command and address 31 is the terminal data.
For example, setting 30 to -1 and 31 to 7 will print "7" on the terminal.
Setting 30 to 1 will clear the terminal.
Also replaced the Fibbonacci and regular Counter programs with upgraded versions that output to the terminal.
"Some unqualified nerds thought this was cool."
2022 Xarbian Computer Science Team. Free to use, modify, and reupload with credit to XCS. |