Ghost is a computer archecture I made as a thought experiment, and also as an easy way to introduce people to the ideas of assembly. It's both the definitions I've created, and a collection of python scripts including an assembler and simulator. The assembler runs in two passes: the first pass clears comments, resolves shorthand, validates the instructions, and records labels. The second pass fills in the labels, does math, and validates each byte to ensure the hex is ready to be output. Then it's output in a variety of formats. Additionally, the compiler supports basic definitions, data definition, labels/names, 5 different output formats, and a dictionary called 'debugging' that allows you to configure the differrent debugging features. The other main program is the simulator. It loads each isntruction from memory, converts it to it's mnemonic, and executes it in an el/if tower. It automatically process writes to screen memory, key inputs, reads from the random IO device, halts, and breaks. Other assorted tools are: Sublime Text syntax highlighting, downloader to get current information from the notion document, and a few example assembly programs.
Mostly just performance changes.
This is an upload of an old version, but it's special enough to deserve an upload because it comes with a bit of a bonus: it has a circuit simulator to go with it. Attatched is a circuitverse file that will let you watch how the computer works in real-time! However, I cannot remember how many of the instructions are implemented, nor how effectivly. Nevertheless, it was an amazingly fun project that whiled away many hours.
Also attached is a very cool piece of what I'm calling 'live documentation'. Attatched is a python script that has some pretty cool capabilities, listed below:
This is the most interesting one! Loops through the whole database and reads the information from it to store in the reference file. However, it also recompiles the micro ASM, a simple simple language, into the microcode. The micro ASM is a list of symbols seperated by commas that are intended to be human readable, where an arrow designates a move from one location to another, and special codes are 4 bit data prefixed with the code 'area'. There are two areas, MF for math flags, and MC for mini commands. The mini commands are commands that don't need a 'to' and 'from' section, so can be seperated from the rest. The microcode architecture is built such that the first four bits are the 'from' or the area code, while the last four bits are the 'to' section or, if in an area, the instruction within the area. This 'index' command validates the microcode, checks the unique assembly name, and saves all of it to the reference file.
The rom creator takes information stored in the reference file and compiles the microcode into a ROM for the simulated computer
Missnamed by ignorance, this assembler uses the reference file to assemble into a hex format that can be pasted into the circuitverse simulator.
Because it doesn't have a screen, this release of Ghost uses a beautiful python-curses terminal simulator that can display tons of information at once, including decoding the microcode instructions for each instruction and a cool scrolling memory dump.