ttc

ttc

The Tiny Computer

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

  1. Download ttc-windows.exe (should work starting from Windows-7 32 bits)
  2. Rename the downloaded file to ttc.exe
  3. Copy it to the installation directory of your choice, for instance C:\TTC\
  4. 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 for PATH (or Path, or...)

MacOS-X and Linux

  1. 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)
  2. Copy it to the installation directory of your choice, and make it executable, for instance (replace ttc-xxx with the file you have downloaded)
  3. 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).

  1. You will need Python 2.7 with pip installed
  2. Install the dependencies (pywin32 is for Windows only)
  3. Clone the repository, you will need git installed:
  4. From the cloned directory, use python ttc.py instead of just ttc
$ 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

  1. Edit a file myprogram.asm with your BIOS programmed in assembly language
  2. Compile it with ttc asm myprogram.asm
  3. If no error is prompted, this produces a file myprogram.bios with the assembled program and the interruption table
  4. Optionally, use ttc asm -p myprogram.asm to also print the resulting BIOS in a human readable format.
  5. Alternatively, use ttc asm -h to get more help about the assembler

Simulate a BIOS

  1. 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
  2. Alternatively, run ttc run myprogram.bios to start the simulation in the dedicated shell