Added usage instructions to readme and a small fix.

This commit is contained in:
Kyler 2024-03-08 14:07:18 -07:00
parent c655bb8982
commit 30a1ce5dbc
2 changed files with 128 additions and 11 deletions

133
README.md
View File

@ -1,11 +1,11 @@
# YTD 12-bit Computer
*Yeahbut, aka Kyler Olsen*
**NOTICE: Most of this document is unfinished.**
**NOTICE: This project is still a *work in progress*.**
It is a custom computer and instruction set architecture. It also has its own
assembly language with assembler written in Python. Custom high level language
coming soon!
currently in development.
## ISA
@ -67,14 +67,14 @@ coming soon!
About
- Paradigm: Multi-Paradigm: Procedural (Imperative), Structured
- Designer: Kyler Olsen
- Created: *Future*
- Typing Discipline: ~~Typeless~~ Static, Weak
- Created: Mar 2024
- Typing Discipline: Static, Weak
- Platform: ytd 12-bit computer,
ytd 12-bit emulator (from *pytd12dk*, multi-platform)
- License: MIT
- Filename extension: `.ytd12c`
- Compiler Implementations: `pytd12dk` (Python),
`ytd12nc` (*bootstrapped compiler*)
`ytd12nc` (*native compiler*)
### Lexical
@ -423,12 +423,135 @@ semicolon (`;`).
to assist in developing software for the ytd 12-bit computer. It includes a
compiler, assembler with linker, and emulator.
**NOTICE: `pytd12dk` requires Python version 3.12 (or higher).**
### Compiler
The first part of the tool kit is the compiler. It is currently unfinished and
can not yet produce an executable.
Running the following command we can get the arguments for the
compiler `python -m pytd12dk cm -h`:
```
usage: __main__.py cm [-h] [-t TOKEN_FILE] [-x SYNTAX_FILE] input_file
positional arguments:
input_file
options:
-h, --help show this help message and exit
-t TOKEN_FILE, --token_file TOKEN_FILE
-x SYNTAX_FILE, --syntax_file SYNTAX_FILE
```
The only required positional argument is `input_file`. This is the source
code file to be compiled.
The optional argument `--token_file` is a text file output which contains debug
information from the output of the lexer. It is a list of the tokens parsed from
the source file and their lexical types.
The optional argument `--syntax_file` is a text file output which contains debug
information from the output of the syntactical analyzer. It is a text
representation of the syntax tree.
Additional optional arguments for semantical debug info, object file, and
executable file will be added.
### Assembler
The second part of the tool kit is the assembler. Included with the assembler is
a simple linker.
Running the following command we can get the arguments for the
compiler `python -m pytd12dk am -h`:
```
usage: __main__.py am [-h] [-o OUTPUT_FILE] [-l LABELS_FILE] [-x HEX_FILE] input_file
positional arguments:
input_file
options:
-h, --help show this help message and exit
-o OUTPUT_FILE, --output_file OUTPUT_FILE
-l LABELS_FILE, --labels_file LABELS_FILE
-x HEX_FILE, --hex_file HEX_FILE
```
The only required positional argument is `input_file`. This is the assembly
code file to be assembled.
The optional argument `--labels_file` is a text file output which contains a
list of the labels found and their address locations in the executable.
The optional argument `--hex_file` is a text file output which contains the
generated machine code in hexadecimal representation.
The optional argument `--output_file` is a binary file output which contains the
generated machine code which can directly be executed by the emulator.
### Emulator
The second part of the tool kit is the assembler. Included with the assembler is
a simple linker.
Running the following command we can get the arguments for the
compiler `python -m pytd12dk em -h`:
```
usage: __main__.py em [-h] [-m {tty}] [-v] [-s] [-c CLOCK] rom_file
positional arguments:
rom_file
options:
-h, --help show this help message and exit
-m {tty}, --machine {tty}
-v, --verbose
-s, --step
-c CLOCK, --clock CLOCK
```
The only required positional argument is `rom_file`. This is the executable
binary generated by the assembler or compiler.
The optional argument `--machine` allows for the selection of a pre-configured
virtual machine. Later in the section [Pre-configured VMs] are a list of
included machines. The default selection is `tty`.
The optional argument `--verbose` turns on printing the current program address,
the value at the address, the interpreted instruction, and each register and
their current values every clock cycle.
The optional argument `--step` turns on waiting for user input between each
clock cycle. This disables any set or default value of the option `--clock`,
making it essentially zero.
The optional argument `--clock` sets the time between each clock cycle in
thousandths of a second. The default value is `100` (one tenth of a second).
#### Pre-configured VMs.
Here are the pre-configured virtual machines included with `pytd12dk`.
##### tty
The machine `tty` includes a tty IO device.
Writing to address `0x7FD` outputs a signed integer.
Writing to address `0x7FE` outputs an unsigned integer.
Writing to address `0x7FF` outputs an ASCII/UTF-8 character.
<!-- Reading from address `0x7FD` inputs a signed integer. -->
<!-- Reading from address `0x7FE` inputs an unsigned integer. -->
Reading from address `0x7FF` inputs an ASCII/UTF-8 character.
## ytd12nc
`ytd12nc` (ytd 12-bit native compiler) is a compiler and assembler with linker

View File

@ -1,8 +1,2 @@
# Kyler Olsen
# Feb 2024
from . import compiler
__all__ = [
'compiler',
]