v0.51-Beta information

For this same file in TEXT format, click here.
...for PostScript format click here

TIC Release Date 04/02/97
Documentation Last Modified 04/13/97

Installing and Compiling
  1. Download TIC.ZIP
  2. Unzip the file into a directory
  3. Unzip FARGO.ZIP into that same directory
  4. Write your TIC source-code file (let's say it's called MY_FILE.TIC) in that directory
  5. Type TICC MY_FILE to compile your file
  6. Upload MY_FILE.92P to the calculator
  7. Type MY_FILE on TI's command line
Program Creation
Programs consist of a set of variable declarations followed by a set of procedures. One of the procedures must be 'main'. The 'main' procedure is where excution begins and ends (just like in C).

Example Program:
int I;
proc main()
{
setfont(0);
for (I=0;I<10;I=I+1) putch(0,I*10,'0'+I);
}
This program puts out the numbers '0' - '9' on the screen in a vertical collumn.


Variable Declarations
Variable Declarations: Must be at the head of the file.
Must be of the following format:
int VARNAME;
int VARNAME=NUMBER;
int VARNAME[NUMBER];


Procedures
Format: proc PROCNAME '(' ')' STATEMENT PROCNAME ';' Example: proc main() x=10; main; Note that, unlike regular C, '{' and '}' are not nessesary if there is only one statment.

Example: proc main()
{ for ( ; X ; )
{ X=X-1;
Y=X;
}
} main;
All procedures automaticly return the integer value 0. To return a different value explicitly, use the 'return' statement (like C). For details, look at the statement section.


Statements
A statement can be: return; (return from procedure)
examples: return;
return expression; (return from procedure with the result of the expression)
examples: return 45;, return(X*5);
expression; (run the expression, ignore the result)
(note, assignment statments DO return results)
examples: 67;, x=14;, this=that=15;
{statements} (any number of sequential statments inside a {} block)
examples: {67;}, {x=54;y=23;}
if (expression) statement (if the expression evaluates to non-zero, statement is executed)
examples: if (A==B) A=A+1;, if (Done) IsDone=true;
if (expression) true_statement else false_statement (if expression is 0, false_statement gets executed otherwise true-statement gets executed)
examples: if (X==0) XZero=true; else XZero=false;
for ( optional_expression ; optional_expression ; optional_expression ) statement (SEE: Optional expressions)
(for loop, like 'C')
examples: for (I=0;I<10;I=I+1) This=This+I;
while (optional_expression) statement (SEE: Optional expressions)
(while optional_expression evaluates to true)
examples: while (NotDone) NotDone=NotDone-1;


Expressions
An expression can be: expression binary_operator expression examples: 1+2, 5%X, This==That '(' expression ')' examples: (x), (5+6) constant (see constans section)
examples: 45, true, false, 'T'
function_name '(' ')' (function call)
examples: getch(), pxl_on(), main()
left_value '=' expression (assignment)
examples: X=10, This=ValueOfThat


Opitonal Expressions
Certain statements, such as the 'for' and 'while' statements have fields for optional expressions. This means they can be left blank if desired. All optional expressions that are left blank evaluate to 1 (true). This allows you to leave the test field blank and create infinite loops. Since the 'break' statement is not currently supported, you probably don't want to do this just yet. However, when break is enabled, this may indeed be usefull.


Binary Operators
The supported binary operators are:
>= Greater than or equal to
<= Less than or equal to
== Equal to
!= Not equal to
+ Addition
- Subtraction
* Multipliation
/ Division
% Modulo (division remainder)
< Less than
> Greater than
| Bit-wise OR
& Bit-wise AND
^ Bit-wise XOR
<< Left bitshift
>> Right bitshift
&& Logical AND
|| Logical OR

NOTE: In the current version of TIC, there is NO OPERATOR PRECIDENCE! Therefor it is UNPREDICTABLE as to what order the operators will be evaluated in.
EXAMPLE: 5+4*9 This will evaluate to 41 if the * is done first, or 81 if the + is done first. If the order does not matter, don't worry about it. EXAMPLE: 1+2+3 The result is 6, no matter the order. If there is a question of order, use parenthesis to explicitly specify order. EXAMPLE: (5+4)*9 This will evaluate to 81. This problem includes all binary operators. EXAMPLE: This || That && Red || Green It is unlikely that this expression will be evaluated in the order wanted. Use: (This || That) && (Red || Green) FUTURE ADDITION: We do plan to fix this at some point.


Unary Operators
FUTURE ADDITION: In the future we will support unary operators including the following:
- Negatate
! Not
++ Increment
-- Decrement


Built-In Functions
There are several built-in functions for TIC. They are:
getch() If the keyboard buffer is empty, it returns the next key pressed. Otherwise, it returns the next key in the buffer. (Does the TI-92 have a keyboard buffer?) setfont(int font) Sets the font to font. There are 3 fonts on the TI-92 (0-2). Font #0 is the same font as the status-bar at the bottom of the screen. Font #1 is the font used in the TI92's program and text editors. Font #2 is the same font as the one that is used to tell you the %-done when graphing in 3-D. delay(int ticks) Delays for ticks time. We have not timed how long a tick is, but that should be easy to do. We're not sure, but think that this is somthing that changes for different ROM versions. We will soon have a testing program out for this, so you can help us determine the number of ticks for a certain ROM version. clrscr() Clears the screen. This is a ROM call and therefore does not actually clear the whole screen, it leaves the status line at the bottom of the screen. random(int maxnum) DOES NOT WORK YET! Eventually, it will return a random number between 0 and maxnum-1. kbhit() Returns true of there is a key in the keyboard buffer. pxl_on(int x,int y) Turns a pixel on at locaiton x,y (black is on). pxl_off(int x,int y) Turns a pixel off at location x,y (white is off). pxl_chg(int x,int y) Toggles the value of the pixel at locaiton x,y (black->white, white->black) putch(int x,int y,int character) Puts character to screen at location x, y. character is an ASCII character (0 to 255). FUTURE ADDITIONS: Make 'random' work.


Constants
Accepted formats for constants:
Type Format Example Value
Decimal constant DECIMAL_NUMBER 10 10
Literal character 'CHAR' 'a' 97
True true true 1
False false false 0


Comments
We currently support only C-style comments, and there is a limitation. Comments start with a '/*' and end with a '*/', just like C, however, there cannot be any '*' inside the comment.

FUTURE ADDITION: This is a problem we plan to fix. We also plan to add C++ style comments.
EXAMPLE: X=5; /* this is a comment */
for (/*I=0*/I=1;I<10;I=I+1) ...


Limitations
TIC currently has many limitations (which we hope to fix): -No local variables. All variables are global.
-No procedure parameters. You can't pass values to procs.
-No unary operators.
-No pointers.
-No 'include' directive.
-Only 32-bit ints. (we will support chars and shorts, floats may or maynot be supported)


Other Problems/Conciderations
Some of the built-in functions have their X and Y reversed (and hense this DOC is incorrect). This is a problem with the ROM functions we 'blindly' implemented. We will soon correct them to be X and then Y always so as to abstract you from the silly methods employed by the ROM.

Some of the symbols you can name in TIC (such as variables and function names) are NOT CHECKED BY TIC. The FARGO assembler has an adiquate checking process for these labels and hence we left them to the assembler. In the future we will to more checking in TIC so that you can know what line number the problem occurs on.


Things That Do Work

There are a few things that do work, though you might not think they would given the limitations.

Recursion. We do use the stack for procedure calls and therefore recursion does work. However, without local variables it's usefullness is limited.

Getch(). Getch returns the number value for ALL the keys on the keyboard (including keys that don't map to the ASCII set). Some of these keys are >255. We will post a complete key-map at some point.

Putch(). Putch's X/Y coordinates are in PIXELS, not rows and columns. This is much more flexable and useful.


Future Additions
Other major things we hope to add: -Fast, graphics library. (source will be provided)
-Inline assembly.
-External object linking (so you can compile in parts).
-Constant optimizations: All constant expressions will be evaluated at compile time (as they should be).
-File I/O support.
-Strings and string manipulation.


About TICC's Creators
We, the authors, started out doing this TIC compiler as a project for our Programming Languages class. However, things have gone so well that we plan to continue develpment after the semester passes. TIC is a sideline project and therefor will get spuratic upgrades and patches. However, most of the improvments we want to do (those listed in this document) should not be extremly difficult.

As may be evident, we are both Computer Science majors. We study at the University of Colorado (which is good for more than skiing and snowboarding).

If you want additional informations on us or the university, visit the following web pages: Shane Brinkman-Davis http://ugrad-www.cs.colorado.edu/~brinkmas/ Kris Wolff http://ucsu.Colorado.EDU/~wolffkj/ University of Colorado http://www.colorado.edu/ University of Colorado Computer Science Department http://www.cs.colorado.edu/ E-mail: Shane Brinkman-Davis
brinkmas@nag.cs.colorado.edu
Shane.Brinkman-Davis@colorado.edu
shanebd@usa.net
(all go to the same place, shanebd@usa.net should allways forward to my current address no matter where I am, however mail is slower to get to me via usa.net)
Kris Wolff
Kristopher.Wolff@colorado.edu
wolffkj@colorado.edu