The Tiny Computer
The Tiny Computer (TTC) is a virtual computer that comes with an assembler and an interactive simulator. It is used to teach computers architecture and most of the information is delivered during the lectures. (So forgive the very sparse documentation on this page.)
Installation
Windows
- Download ttc-windows.exe (should work starting from Windows-7 32 bits)
- Rename the downloaded file to
ttc.exe
- Copy it to the installation directory of your choice, for instance
C:\TTC\
- Make sure that this directory is in your
PATH
environment variable: search "modify environment variables" in the configuration panel and add;C:\TTC
at the end of the current value forPATH
(orPath
, or...)
MacOS-X and Linux
- Download ttc-darwin for MacOS-X (should work starting from Yosemite 64 bits), ttc-linux32 for Linux (any decently recent 32 bits Linux), or ttc-linux64 for Linux (any decently recent 64 bits Linux)
- Copy it to the installation directory of your choice, and make it
executable, for instance (replace
ttc-xxx
with the file you have downloaded) - Make sure that this directory is in your
PATH
environment variable (WARNING: take care to use>>
with TWO>
in the command below)
$ mkdir -p ~/.local/bin # create installation directory
$ cp ttc-xxx ~/.local/bin/ttc # copy
$ chmod +x ~/.local/bin/ttc # make executable
$ echo 'export PATH=$PATH:$HOME/.local/bin' >> ~/.bashrc # add to PATH
$ . ~/.bashrc # apply changes
Test you installation
From your shell, run ttc -h
, it should print the help:
$ ttc -h
usage: ttc [-h] {run,web,asm,usr} ...
The Tiny Computer
optional arguments:
-h, --help show this help message and exit
available commands:
{run,web,asm,usr}
run run the machine in a shell
web start a simulator server
asm assemble a program into a BIOS
usr manage user databases
Install from sources
Don't try this if you don't understand the explanations below, I will not help with this (except if you are really familiar with Python development and have technical questions).
- You will need Python 2.7 with
pip
installed - Install the dependencies (
pywin32
is for Windows only) - Clone the repository, you will need
git
installed: - From the cloned directory, use
python ttc.py
instead of justttc
$ pip install --user gevent gevent-websocket numpy # install dependencies
$ pip install --user pywin32 # install dependencies on Windows
$ git clone http://forge.ibisc.univ-evry.fr/fpom.ttc.git # clone repository
Usage
Assembly language
Get help about the assembly language by running ttc asm -s
which
will describe the syntax of the language, information about the
registers, and all the instructions.
Create a BIOS
- Edit a file
myprogram.asm
with your BIOS programmed in assembly language - Compile it with
ttc asm myprogram.asm
- If no error is prompted, this produces a file
myprogram.bios
with the assembled program and the interruption table - Optionally, use
ttc asm -p myprogram.asm
to also print the resulting BIOS in a human readable format. - Alternatively, use
ttc asm -h
to get more help about the assembler
Simulate a BIOS
- Run
ttc web -s myprogram.bios
to start the interactive simulator. (DON'T forget the-s
flag.) This will open a browser window from which you will be able to inspect the machine state and control the simulation. This should work with most recent browser but it has been much better tested with Firefox - Alternatively, run
ttc run myprogram.bios
to start the simulation in the dedicated shell