English The 4K CS2D 8-bit machine icon

19 comments
25.05.20 01:54:37 am
like 12 like it!
8 kb, 656 Downloads
Hador
User
Offline Off
∗ This is a fully functional 8-bit computer with 4KB of RAM implemented in CS2D using buildings. ∗

• Free Turing-complete instruction set inside!!! •


> Did anybody ask for this?
> Does anybody need this?
> Does it have any use to anyone?

> Answer to all three: No! But I made it anyway.


> Does it work?
I haven't tested everything, as this was a 12-hour challenge, but the important parts do, and I will fix bugs if you find any!



How does this work? >



How do I use this? >



How do I write code? >




That's pretty much it. Please leave a comment if you have any questions and feel free to expand upon this project in any (non-commercial) manner you like, I'd love to hear of anything useful that actually comes from this!

Also, due to math, code can go out of bounds in several places, so be weary of bytes popping up in random places. Literally.

Spoiler >
imageimageimageimage
edited 13×, last 26.05.20 12:30:48 pm
ok This file has been reviewed and approved by BcY (25.05.20 02:17:24 am)

Comments

19 comments
Goto Page
To the start Previous 1 Next To the start

Log in!

You need to log in to be able to write comments!Log in
05.06.20 08:24:14 pm
like I like it!
Up
ImSick4Fun
User
Offline Off
Looks epic gonna try this
31.05.20 11:29:15 am
Up
Hador
User
Offline Off
@user The Dark Shadow: It's a computer within CS2D.

The map is used for memory, with different buildings representing different values with the registers at the sides of the players, while the Lua script handles the actual functionality, so it's basically the CPU.

If you press the "execute" button, the program starts running, like a real computer would, but only at ~10Hz with current settings.

The script checks the value of the program counter bytes, which represent a position in memory, and then translates the byte at that position into an operation, with the following bytes used for the data of that operation.
What the script reads might be:
CT Barbed Wire: ADD
Nothing: Register[0]
T Barbed Wire: Register[1]

The script now removes all buildings from Register[0] and replaces them with the buildings that represent the value of Register[0] + Register[1].

Then the program counter is set to the next byte after the data for the last operation and continues there until you press the abort button.
31.05.20 11:12:58 am
Up
1uP
User
Offline Off
Yo what
31.05.20 10:03:07 am
like I like it!
Up
The Dark Shadow
User
Offline Off
I couldn't understand anything, Could you introduce us what actually it is?
28.05.20 09:57:40 am
like I like it!
Up
G3tWr3ck3d
User
Offline Off
intersting
27.05.20 10:43:57 pm
Up
Hador
User
Offline Off
The name was kind of half-intentional, but when computer memory was still advertised in KB, they were generally called 4K or 8K machines, as memory was the limiting factor and I guess KB was just a bit clunky to use, so it’s definitely also a nod to early 80s computers
27.05.20 09:05:30 pm
like I like it!
Up
medeiros
User
Offline Off
Just when I thought I've seen in it all in this tiny lil' 2D game we all love... extremely impressive!

One little thing though: I think you forgot a "B" after "4K" in the title of the upload; when I first read it, I was like "what? A 3840×2160-capable computer running inside of CS2D!?"
27.05.20 05:57:44 am
like I like it!
Up
Dousea
User
Offline Off
Damn impressed.
26.05.20 12:29:52 pm
Up
Hador
User
Offline Off
Thanks!

@user Avo: Thanks for the notice, I wasn't entirely sure about that any more! NOP doesn't technically stop the execution in this implementation, it just infinitely loops on the NOP because it doesn't update the program counter - it doesn't make much of a difference though I guess with the logic implemented in lua, so you could always just add 0 or something like that for the same effect
26.05.20 11:58:32 am
like I like it!
Up
Elfing
User
Offline Off
This is awesome!
26.05.20 11:14:40 am
Up
Avo
User
Offline Off
I like it! The only thing that is surprising is that
user Hador has written:
0: NOP - the program stops

since as far as I remember, NOP usually does nothing, not stops the execution
26.05.20 11:08:15 am
Up
Hador
User
Offline Off
It was created because that's what I felt like doing last Sunday. It has no practical use that I know of, but if you think of one, let me know!
26.05.20 11:03:00 am
like I like it!
Up
Pagyra
User
Offline Off
Hmm cool... but how can we apply this in practice, why is it created?
26.05.20 07:16:12 am
like I like it!
Up
Pseudon
User
Offline Off
Lovely and inspiring. Indeed; computation is amazing and I can appreciate your project!
25.05.20 10:07:34 pm
Up
Hador
User
Offline Off
It's probably a deep-seated desire to make all of the knowledge accumulated in a computer science degree useful for something.

But thanks for the positive, if confused feedback, it means a lot! cookies
25.05.20 07:19:49 pm
like I like it!
Up
VADemon
User
Offline Off
I've never understood this passion, here or in Minecraft, to rebuild computers.
But you get a double-chocolate cookie with milk!
25.05.20 05:50:47 pm
like I like it!
Up
_Lima_
User
Offline Off
I didn’t understand anything, but I think it's cool.
25.05.20 05:33:37 pm
like I like it!
Up
Xirot
Idiot
Offline Off
Good job.
25.05.20 09:20:22 am
like I like it!
Up
Gaios
Reviewer
Offline Off
What the hell..
To the start Previous 1 Next To the start