|
1 | 1 | # TIS-100
|
2 |
| -A TIS-100 emulator, for the wonderful Zachtronics game of the same name. Uses TIS-100 save file format. |
| 2 | +A TIS-100 emulator, for the wonderful Zachtronics game of the same name. Uses TIS-100 save file format for code; the layout/specification is a proprietary format. |
3 | 3 |
|
4 |
| -None of the others available did quite what I wanted, so I'm going to try my hand at making my own. |
| 4 | +None of the other emulators available did quite what I wanted, so I'm going to try my hand at making my own. |
| 5 | + |
| 6 | +My goals with this emulator are not to re-implement the game, but to mold this design into something more like a niche, but usable programming language. |
| 7 | +There is no verification of outputs against a predefined list; that is the duty of the programmer. |
| 8 | +The variety of input and output styles will be expanded from the simple number lists and graphical display of the game, including ASCII input and output. |
| 9 | +The layout and arrangement of nodes will be modifiable, and (in the long term) more node types will be added, such as a RAM node. |
5 | 10 |
|
6 | 11 | This is all very WIP, so a bunch of things aren't implemented. However, the instruction set should be functional
|
7 |
| -and complete. Also no documentation yet, sorry. It's on my short list. |
| 12 | +and complete. Also no real documentation yet, sorry. It's on my short list. Draft below. |
| 13 | + |
| 14 | +=== |
8 | 15 |
|
9 | 16 | (useful links for dev'ment:)
|
| 17 | +http://www.zachtronics.com/images/TIS-100P%20Reference%20Manual.pdf |
10 | 18 | https://alandesmet.github.io/TIS-100-Hackers-Guide/
|
| 19 | + |
| 20 | +=== |
| 21 | + |
| 22 | +## TIS Assembly Language |
| 23 | + |
| 24 | +### The official manual |
| 25 | +The official TIS-100 manual is available from the Zachtronics website here: http://www.zachtronics.com/images/TIS-100P%20Reference%20Manual.pdf |
| 26 | +If you are new to TIS, this is the best place to start whether you intend to play the game, or use this emulator. |
| 27 | + |
| 28 | +### Differences, deviations, addendums and errata |
| 29 | +(additional details, especially where this deviates from the maunal, and details on how the save file works) |
| 30 | +Deviations between the manual and this emulator include: |
| 31 | +- HCF still exits the system immediately, but the emulator attempts a clean exit. |
| 32 | + |
| 33 | +One thing to be aware of is that, like the game, compute nodes are numbered left to right, top to bottom, indexed from zero to n-1, where n is the number of compute nodes. Not all nodes must be present. |
| 34 | +When counting, nodes other than compute nodes are skipped. |
| 35 | + |
| 36 | +## TIS Configuration |
| 37 | + |
| 38 | +### Components of a TIS: |
| 39 | +The majority of a TIS is made of several parts called nodes; each node is of a specific type that does a specific job. |
| 40 | +These nodes are arranged in a rectangle, and each node can communicate with its four immediate neighbors. (Border nodes will have fewer neighbors.) |
| 41 | + |
| 42 | +The most common node is a execution, or compute node. This node type can hold up to 15 instructions, and those instructions are run on a loop until termination. |
| 43 | +Each node has internal registers to store data, and port registers to communicate with its neighbors. See the documentation in the official manual for more details. |
| 44 | + |
| 45 | +Another node type is the stack memory node. This node can store up to 15 numbers in a stack; this stack may be accessed by all four neighbors. See the documentation in the official manual for more details. |
| 46 | + |
| 47 | +If a node is detected to be damaged, it will be disabled and therefore will not interact with neighboring nodes. |
| 48 | + |
| 49 | +The top row of nodes may have an input pseudo-node as their upward neighbor. These pseudo-nodes provide data from an external source. |
| 50 | +See the TIS Input/Output section below for more details on available input pseudo-node types. |
| 51 | + |
| 52 | +Likewise, the bottom row of nodes may have an output pseudo-node as their downward neighbor. These pseudo-nodes provide data to an external destination. |
| 53 | +See the TIS Input/Output section below for more details on available output pseudo-node types. |
| 54 | + |
| 55 | +### The default configuration |
| 56 | +The default configuration of a TIS is 3 rows of 4 nodes each. All twelve nodes will be configured as compute nodes. |
| 57 | +A simple ASCII input from stdin will be made available to the upper-left node, and a simple ASCII output will be made available to the lower-right node. |
| 58 | +The configurations encountered in the game differ only slightly to this; exhibiting different node types and input/output style and indexes. |
| 59 | + |
| 60 | +Assuming the TIS assembly code is in 'code.tisasm', this is the simplest method of running the emulator: |
| 61 | + $ tis code.tisasm |
| 62 | + |
| 63 | +### Changing the size of the default layout |
| 64 | +If two numbers are provided on the command line, the configuration will be initialized to a different size that corresponds to the given rows and columns. |
| 65 | +All other aspects will remain default; all nodes will be compute nodes, and the upper-left input and lower-right output willl remain. |
| 66 | + |
| 67 | +Using these rows and columns arguments might look like this, for two rows and 5 columns: |
| 68 | + $ tis code.tisasm 2 5 |
| 69 | + |
| 70 | +### Defining a custom layout |
| 71 | +For maximum control, use a layout file or string. A file is recommended, but the layout may be provided as a quoted string instead with the -l flag. |
| 72 | + |
| 73 | +The first three elements of a layout file are required, and all elements in a layout file are separated by whitespace (space, tab, newline), with one exception that will be covered below. |
| 74 | + |
| 75 | +The first two elements are the rows and columns of the layout. The third element is a map describing what type each node is. |
| 76 | +A total of rows*columns characters are then read, skipping whitespace (this is the exception to the whitespace-delimiter rule). The valid node types are (case insensitive): |
| 77 | +- C - compute node; T21 Basic Execution Node |
| 78 | +- M or S - stack node; T30 Stack Memory Node (Not yet implemented) |
| 79 | +- R - ram node; T31 Random Access Memory Node (Not yet implemented) |
| 80 | +- D - damaged/disabled node; (Not yet implemented) |
| 81 | + |
| 82 | +A sample layout may be: |
| 83 | + 5 4 |
| 84 | + CCSD |
| 85 | + CCCC |
| 86 | + CCCC |
| 87 | + CCCC |
| 88 | + CSCC |
| 89 | +Which is 5 rows and 4 columns with two stack nodes and one disabled node listed. |
| 90 | + |
| 91 | +Following the layout details are (optional) definitions of the various input and output pseudo-nodes. Input nodes start with the token I<n> where n is the index. I0 is the first column, I3 is the fourth, etc. |
| 92 | +Output pseudo-nodes are similar, but start with the token O<n> instead. If one of these tokens is encountered, it is assumed that the previous definition is complete. These definitions need not be in any specific order, |
| 93 | +and if there are conflicts, the later definitions will override the earlier ones. Be warned: this may leak memory or file handles if not used with care. |
| 94 | + |
| 95 | +A sample layout, including some input/output definitions may look like this: |
| 96 | + 2 3 |
| 97 | + CCS |
| 98 | + CCC |
| 99 | + I0 NUMERIC numbers.txt |
| 100 | + O0 NUMERIC - 32 |
| 101 | + O2 ASCII - |
| 102 | + |
| 103 | +The details for each type of input and output pseudo node are described below, in the TIS Input/Output section. |
| 104 | + |
| 105 | +Assuming that the file 'layout.tiscfg' contains the above configuration, the command line might look something like this: |
| 106 | + $ tis code.tisasm layout.tiscfg |
| 107 | + |
| 108 | +Since whitespace is the delimiter, this layout produces the same result: |
| 109 | + 2 3 CCSCCC I0 NUMERIC numbers.txt O0 NUMERIC - 32 O2 ASCII - |
| 110 | + |
| 111 | +It is less readable, but more suitable for using as a string on the command line with the -l flag. Note the quotes around the layout string. |
| 112 | + $ tis code.tisasm -l "2 3 CCSCCC I0 NUMERIC numbers.txt O0 NUMERIC - 32 O2 ASCII -" |
| 113 | + |
| 114 | +## TIS Input/Output |
| 115 | + |
| 116 | +(describe the various options for IO, both original and new) |
0 commit comments