From Ninerpedia
Revision as of 12:36, 15 October 2014 by Stephen Shaw (talk | contribs) (Sample c99 source code: add a little explanation to sample code)
Jump to navigation Jump to search

c99 is a language for the TI99/4a where you create a text file which is then converted to 9900 source code to assemble into 9900 object code.

The files were originally on one single sided single density disks, later on two which included some source files and some utilities.


In order to write C99 programs you need an Editor, either the one supplied in the Editor/Assembler package or TI Writer(TIW). If you use TIW you must save the file by using the Print option and naming a disc file as destination. (This avoids the problems caused by the format information included. when you save TIW files in the usual way.).

Start with c99 source

The first step in writing a C99 program is to write the C99 source using an Editor and save it. As well as C99 source you can instruct the compiler to include other files and the library functions provided.

Compile the source to 9900 source

Then using option 5 of the E/a module you run the c99 compiler. This writes 9900 assembly language source statements to a file of your choice.

One option is to include the C99 source in this assembly language file as comments.

Assemble to 9900 Object code

Having done this and hopefully avoided errors, you now run the assembler against the file you have just produced with the compiler.

The usual assembler options are available although you never need to specify the R option.

To load the resulting 9900 object code

First it is necessary to load CSUP, a C99 support file, any other library files that may be needed (perhaps for file handling), and then load your object file. This is with the E/a option 3. The program name is always START in these programs. At this stage we can hope that our program works as expected.

Sample c99 source code

This is a simple listing, which just fills the screen with asterisks, one at a time

/* Malcolm's test program 1 */ 
#include dsk1.conio 
int row,col; 
{ while(1) 
{ row=0 
   { col=6; 
      { locate(row,co1); 
   if(getchar()<1) break; 

Notice that the variables row and col are DECLARED as INTEGERS before we use them.

PUTCHAR places a single character on the screen - FF is predefined in the CONIO file as "clear screen and home cursor to top left".

The double plus sign acts to increment the variable while locate merely locates the cursor. C99 is based on the 40 column screen