#149800 - asiekierka - Fri Jan 25, 2008 2:24 pm
subleqDS
Subleq DS is a mod of original subleq.
Subleq consists of just one command "subtract and branch(jump) if negative or zero)
Each subleq command consists of 3 words: a, b and c.
a, b and c are memory addresses.
If b - a is negative or zero, jump to c. Otherwise, go to the next command.
The code IS in the memory, so Subleq DS is self-modyfing.
Special memory addresses are addresses that don't execute subleq; instead, they execute
a command they're made to do. The addresses are put to b.
Command positions:
-1 - outputs a. (in relative mode it's still -1, but it shouldn't be a problem)
Limitations:
- 512kb of memory (thus, up to 512kb of code)
- Speed (fix the source code if you want it faster)
Well, if you think this is slow, I'd like to tell you that it uses 15 vblanks,
because only then you can see the results pretty fast.
If you still think it's slow, check the source.
How to use
1) DLDI patch subleqDS.nds
2) Put it on your flashcart device.
3) Put "test.slq" (a subleq file) in the root of your flashcart device.
Changes:
Controls:
B - switch between silent mode (only output is shown on the screen) and
debug mode (everything is shown).
Start - pause/unpause.
FAQ:
Q: Can you implement an (put any real CPU here)?
A: No. I want to do fun things.
Q: Why is it so slow?
A: Go and check the source code.
Q: Can you add (some feature)?
A: Go and implement it yourself, you have source.
Q: This sucks!
A: Do any better from scratch and I'll agree.
Download
I WARN YOU, THE SOURCE CODE IS A MESS!
subleqDS 0.2
Source code
Last edited by asiekierka on Sun Jan 27, 2008 12:41 pm; edited 5 times in total
Subleq DS is a mod of original subleq.
Subleq consists of just one command "subtract and branch(jump) if negative or zero)
Each subleq command consists of 3 words: a, b and c.
a, b and c are memory addresses.
If b - a is negative or zero, jump to c. Otherwise, go to the next command.
The code IS in the memory, so Subleq DS is self-modyfing.
Special memory addresses are addresses that don't execute subleq; instead, they execute
a command they're made to do. The addresses are put to b.
Command positions:
-1 - outputs a. (in relative mode it's still -1, but it shouldn't be a problem)
Limitations:
- 512kb of memory (thus, up to 512kb of code)
- Speed (fix the source code if you want it faster)
Well, if you think this is slow, I'd like to tell you that it uses 15 vblanks,
because only then you can see the results pretty fast.
If you still think it's slow, check the source.
How to use
1) DLDI patch subleqDS.nds
2) Put it on your flashcart device.
3) Put "test.slq" (a subleq file) in the root of your flashcart device.
Changes:
Quote: |
0.2:
- removed test code - fixed a bug or two 0.1: - first release - do not use it, or do not even download it |
Controls:
B - switch between silent mode (only output is shown on the screen) and
debug mode (everything is shown).
Start - pause/unpause.
FAQ:
Q: Can you implement an (put any real CPU here)?
A: No. I want to do fun things.
Q: Why is it so slow?
A: Go and check the source code.
Q: Can you add (some feature)?
A: Go and implement it yourself, you have source.
Q: This sucks!
A: Do any better from scratch and I'll agree.
Download
I WARN YOU, THE SOURCE CODE IS A MESS!
subleqDS 0.2
Source code
Last edited by asiekierka on Sun Jan 27, 2008 12:41 pm; edited 5 times in total