Using mainly the books, The Elements Of Computing Systems and Code, I built my own computer. I also programmed some features the computer can be used for, these I shall explain in greater depth below.
First I will show a poorly mapped out layout of some key components of the computer.
The whole computer is not shown but merely combines the CPU with the RAM. Here's the pdf in fullscreen.
This of course abstracts away a lot of information. Below is everything it took to get to this point. Starting with only a NAND gate.
With such NAND gates I built the computer depicted above, and all the sub componenets it needs, found here. These hdl files represent each logic gate implementation.
For example, to build a NOT gate, here is my implementation:
CHIP Not {
IN in;
OUT out;
PARTS:
Nand( a=in, b=in, out=out);
}
IN declares all the inputs this chip will take, being only one input, "in". OUT declares all the outputs the chip outputs, being only one, "out". PARTS is the internal part of the chip. Here I used a nand gate and made both its a and b input pins "in" and its out pin "out". Now I can treat this chip as a black box and use it in the same way as the nand gate for other chips.
Having built the computer I wrote programs for it. The computer can compute machine language (.hack files), in which I wrote some programs. Machine language is terrible so I wrote other programs in assembly language (.asm files). In order to translate from assembly to machine language I wrote an assembler (.py file). All these can be found here.