Currently it is stored in RAM. You should see something like this:
00000001
00000010
00000011
00001010
00001000
00001101
00010101
ect.
(note: the values will dissapear after the program finishes, because the RAM is no longer being refreshed. If needed, I will tweak it so the RAM continues to refresh after program completion).
Tonight I am creating STDIN/STDOUT. I will then redesign the program to send the values to a decimal display of some sort. I intend to create something similar to the output mechanism arK used in his 'teh CALC'. It's smaller and looks nicer than 7-segment. Also I made the program purposely slow. It sends values from A/B to C and then from C to RAM. I could remove A/B -> C and it would run quicker. I just wanted to leave that in there for now in order to test that function.
Wow. This is probably the best save on TPT.
I created a command-line assembler thing for this in Python, so if anyone has Python installed they can make programming for this computer (slightly) easier*. Instead of writing something like "000011110000000000000001", you can write the more readable "SET A, 15".
Pastebin link: http://pastebin.com/wS9r2e2R
*It's not really much easier at all, since you still have to manually enter the bits, but in terms of writing code it's a fair bit easier.
Also, I have a request: is it possible to have something be able to write to a variable location in RAM? For example, something that writes the value at A to RAM SLOT [C], or maybe just something that writes the value at C to the first "zero" slot in RAM. It would be very useful for infinite loops that keep "piling" up values in RAM (e.g. the Fibonacci example program). I understand that maybe this is impossible (or very hard), but it would be quite nice :)
Unrelatedly, it seems that the example Fibonacci program is setting A to 255 on the 2nd instruction. I can't see that anywhere in the code. Is this a bug, supposed to happen, or have I just made a stupid mistake in reading the code?
Damn thanks for making that. Even though I don't have a clue how to use it, it looks awesome. Is it similar to something like a .class you can just compile and run with the Python compiler? (never used Python in my life).
I was actually thinking about loops earlier. The fibonacci sequence came to mind, and also the possibility of making writing a loop to output many values in RAM with just a few instructions.
Kinda confused by your explaination though. Can you try explain it in the clearest way you can muster :D I am useless when it comes to visualizing these sorts of things.
Before then though, I just want to add the input and extra bitwise functions + remove some bugs that may exist. Already found a couple earlier today. Hoping they are the last.
This is Freaking amazing. There are no other words I can use to describe this... this art.
You deserve an award for this.
To anyone who can't work out how to use my assembler:
Python's .py files are a lot simpler than Java's .class files (you don't need to compile anything), so all you have to do is download & install the Python 3.3 interpreter and run it. To do that just download this file
(which is slightly different from the last one), rename it something ending in .py (remember to show file extensions), and double-click on it. Assuming you've installed the Python interpreter, it should work.
About the variable locations in RAM, my idea was that you'd be able to write to a location in RAM based on the value of a register. Normally, if I were transferring A to RAM SLOT 6, this is what would happen:
,---------------, ,--------------,
| | A goes to | |
| A | ---------> | RAM SLOT 6 |
| | | |
'---------------' '--------------'
This instruction is already possible, and says "Pick up the value in A, and put it into RAM SLOT 6."
However, what if I had another number in B, and I wanted to put a into the RAM slot with that number? So, if B was 15, I'd put it in RAM slot 15, but if B was 12, I'd put it in slot 12.
,---------------, ,---------------,
| | A goes to | (12) |
| A | ---------> | RAM SLOT [B] |
| (A = 13) | | | |
'---------------' '-----------|---'
|
|
,---------------,
| |
| B |
| (B = 12) |
'---------------'
What I'm trying to show here is an example where A = 13 and B = 12 (but they could be anything). In this situation, which, right now, is not possible, it would pick up A, look at B and see that it's 12, and then find RAM SLOT 12. It would then put A's value (13) into that slot.
Anyway, this is probably far too complicated for TPT's window size (and there's only space in the instructions for two more "data flow" functions). But the input & extra bitwise operators sound great!
I just want to say again that I truly cannot overstate how amazing this is.
I think there are some far better computers than mine still. Maybe it will compare when I get the extra features in, and make it 100% reliable (which are pretty much all timing related).
As for only having 2 bits left (1110, 1111) that is actually really annoying me. I wonder if I should sneakily add another bit to the ROM. I could always just put the operations in with the ALU specific operations, but that would be confusing. I'll probably just add a 5th bit to the group which will give me like 15 more spaces for operations.
As for using B as a location value..
It doesn't sound immediately impossible. I am just thinking of how I could impliment this. I could probably fairly easily route the value wires and connect them to the location wires, and therefore allow you to send the value within C to RAM as a location. Or I could connect the wires from B up to the location wires, allowing the same for B (or A).
Actually now that I think about it. All I would need to do is turn on a switch that redirects the output from B away from the ALU into the location wires. At the same time, A will pass through the ALU (maybe directly through the adder or ill just make some simple passthrough wires, both resulting in its value being unaltered) and directly to RAM. edit: lol OR gate would be perfect.
If I get time I will add that tonight. Seems easy enough now that I think about it. Would you need the ability for both A and B to act as location values? Or would just B be enough. Because I have literally visualized the whole modification in my head already for B.
Once I add that sneaky extra bit to the data flow group, I will create a command for clearing specific RAM locations. There's also some shifty business I need to take care of (when you're outputting A/B to the ALU and one of them holds 0).
EDIT: I finished creating the instruction. I haven't updated the save yet. Will soon.
How to use (when I update save): [00000000][0][0000000][0000][01110]
Places A in RAM. Uses B to specify location in RAM.
EDIT 2: Updated the save. Also updated the thread starter with the new info.
Just a really noob question... where did you learn about RAM, machine code, etc.? I know all about TPT electronics, so I can see whats happening from an electronic standpoint, but otherwise I'm clueless. Ex. ALU? 00111000 = 56? I just want to learn about how computers work so I can make one myself.
Well that's just binary.
00111000 = ((128x0) + (64x0) + (32x1) + (16x1) + (8x1) + (4x0) + (2x0) + (1x0)) = 32+16+8 = 56
Search binary on wikipedia and learn about it. And then start learning about logic gates.
Actually I created a tutorial for this site awhile ago concerning boolean algebra/binary and how it's used to create circuits. Here:
https://powdertoy.co.uk/Wiki/W/Creating_Logic_Circuits.html
Also I suggest learning from this site. They give you full access to an extremely useful computer science book for free, and create activities that guide you through building your own theoretical computer from the ground up. I have never actually read further than the first couple of pages (I just learned over time from watching other people) I have heard many good things about it:
Thanks! :D