[ Go to Stephen's Entry Page ]   
[ TI99/4a Articles index   |   TI Book front page   |    TI Resources Page |   PC99 Programs   |   TI*MES 13    |   TI*MES 15 ]
contact - please use subject="pc99 page" to avoid spam trap! 

Jump to:
Learning to use c99

TI*MES Issue 14, Autumn 1986

This web page contains text from the UK Magazine for TI99/4a owners, TI*MES, issue 14 from Autumn 1986. Published by Clive Scally. It is of use to users of the TI-99/4a emulators and of historic interest regarding home computer use in the UK in 1986.
This issue has caused me problems with OCR and much of the text is retyped.

Not included here:- This issue of TI*MES had 13 pages of a DIY hardware project, three pages of index to issues 1-13, ten pages from other user groups newsletters, and four pages of reviews of the Atarisoft modules.

Rambles by Stephen Shaw

A little graphics program

If you have a program which can plot in bit map mode or simulate it, here is a listing (here for Myarc Ex Bas) which you can use:
100 CALL GRAPHICS(3)
110 FDR A=1 TO 9
120 FDR C=5 TO 8
130 FOR B=1 TO 6
140 FOR ANG=0.05 TO 6.285 STEP 0.005
150 R=SIN(C*ANG)
160 Y=R*SIN(B*ANG)
170 ROW=91+85*Y
180 X=R*COS(A*ANG)
190 COL=130+85*X
200 CALL POINT(1,ROW,COL)
210 NEXT ANG
220 FOR DELAY=1 TO 300
230 NEXT DELAY
240 CALL GRAPHICS(3)
250 NEXT B :: NEXT C :: NEXT A
260 GOTO 100
This routine will draw 216 images one at a time- but using the above, Myarc Ex Bas took 7 minutes 23 secs for each image - by reducing the step in line 140 to .02 and using CALL DRAWTO to connect the points, for minimal loss of definition, the time was brought down to 1 min 57 secs.(for ONE pattern)

Myarc 512k ram card

A review of Myarc 512k ram and Myarc XB II Level 4 version 2.0. The XB II was not complete nor compatible and readers were warned to await the upcoming version 2.1. XB II Version 2.0 was in the form of a module, a disk and an EPROM to fit into the Myarc 512k card. A problem with the Myarc 512k card using Funlweb vn 3.3 was quickly dealt with by Tony McGovern amending Funlweb.

Here is the original review of the 512k ram card:
The Myarc ram card fits into the TI PEB in the normal manner and if you wish you can then operate it just as though it was a TI 32k card... but if you have a 512k card you can do a little more...

There are new commands, available to you in TI BASIC: CALL RDTEST; CALL EMDK; CALL VOL; CALL PART; CALL RDDIR; CALL ABPS

The first is CALL RDTEST which goes through the card testing the chips - a useful command. If one chip blows, this command will reveal it and it can be replaced.
TI Ex Bas can only use the normal 32k, which leaves the remaining memory for a solid state disk drive, and a printer buffer.
The TI Disk operating system has been so designed that the maximum disk size you can use is 1600 sectors, including disk header, and that is the maximum size you can use with the ram card. If you wish, you can use a disk initialiser to provide an exact duplicate of a standard disk, but you do not need to: just partition the memory to emulate a disk of the size you want, and it is then fully compatible with all disk functions.

The remaining memory is available as a printer buffer: the cursor reappears VERY quickly even when you PRINT a thousand line file! 'Course the printer keeps printing for a while ....

CALL PART is the command to set the partition parameters.
At this stage, the ram disk is a device called 'RD', but you can also set parameters so that your programs recognise it as DSK1 to DSK5 or for instance DSK.TIHP The commands for this are CALL EMDK and CALL VOL, and these titles can be changed (in Ti Basic) at any time without affecting ram contents.

It you set it to DSK1, it disables your normal drive no.1 - and similarly for other drive numbers, DSK2 will disable your second drive and so on.

CALL RDDIR will list the ram disk contents to screen.

The print spooler has its own device names: RS232 becomes SP and PIO becomes SPPIO - and if you wish to abort a spooling operation, you can CALL ABPS.
If you program in machine code, you can also select banks of the raw card by setting CRU bits (the instructions I received were for the 128k ram).
VERY happy with this purchase,

Return to top of page

c99 for total beginners

c99 is available on my download page C FOR TOTAL BEGINNERS

c-99 is a newish language for the TI99/4a which is proving remarkably popular with some of the 'boffin' owners.

The reason is this: it is a compiled language: that is, you write a program in c, and when you run it, you are really running machine code- there is no delay for interpretation, as with Basic.

The c package is on two disks, and requires a console, at least 32k ram, at least one disk drive and disk controller. A printer is useful. c-99 can be operated with the Editor Assembler module, or with Extended Basic if you also have Funlwriter v.3.3 or later.

The c-99 package has documentation relating to the use of c with the TI99/4a, but minimal information on the language itself, and rather skimpy instructions (for the novice?) on how to actually USE c-99.

This article is intended to help you to create a short piece of c source code and produce a running machine code program.

First- let's take a BASIC program:
100 CALL CLEAR
110 FOR ROW=1 TO 24
120 FOR COLUMN=3 TD 30
130 CALL HCHAR(ROW,COLUMN,42)
140 NEXT COLUMN
150 NEXT ROW
160 CALL KEY(4,K,S)
170 IF S<1 THEN 160
180 IF K<>26 THEN 100
190 END
Not too hard to follow that is it? This program-ette clears the screen, and then rather slowly fills it with asterisks.

I have used Key Unit 4 to keep this program comparable with the C listing which follows, in which CTRL Z is used to drop out of the program.

Pressing any other key re-runs the program.

Now here is the same program in C Source code.
This is written with a text editor such as TI Writer or Editor Assembler. If you use TI Writer, you must save the text WITHOUT the final tabs, either by using PF instead of SF, or by using the special c editor in the FUNLWRITER package.

Remember, c-99 uses the 40 column screen by default, so the column numbers are a little different to our basic program:
/* ::::::::::::::::::::: */
/* Malcolm's test program */
#include dsk1.conio
int row,col;
main()
{ while(1)
   { row=0;
     putchar(FF);
     while(++row<25)
     { col=6;
      while(++col<35)
       { locate(row,co1);
        putchar(42);
       }
      }
     if(getchar()<1) break;
   }
}
/* ::::::::::::::::::::: */

The /* ... */ lines are REM lines and have no effect.

#include dskl.conio: -The lower case dsk1. is CORRECT!
This line will make the compiler insert here the text which is in the file CONIO, which contains certain common definitions - eg that FF is to be read as 12 (which is a FormFeed for screen OR printer).
CONIO is included in the c-99 package. It will be used with most c programs that you write.

int row,col; In C, variables MUST be defined before you use them.
We here define the two variables row and col to be integers, and by so doing we reserve two bytes of memory for each.
Almost all lines of code in c are terminated with a semi colon.
From reading the C text books you will appreciate that as used here, row and col are GLOBAL VARIABLES. Don't worry about that now.

main() is the main part of the program. As with ExBas. you can have named sub programs such as color() or sound(), and you have the option of having local variables in these- just as you do with ExBas.

{ while(1) sets up the basic program loop- remember we don't have GOTO in c-99.
The opening { marks the beginning of the command.
Provided the stack has a 1 in it when the program loops back to while(1=TRUE) then the loop is reentered, else you drop out ot it.

The rest of it you should be able to follow by reference to the BASIC program- perhaps the ++row may throw you a little: this adds one to row and then makes the comparison. row is permanently incremented by this space saving instruction.
eg= row=row+1
if row<25 then...

We now have on disk the above file, lets call it TEST, and it is in DISPLAY VARIABLE 80 format.
It now has to be compiled.
We therefore load the memory image machine code program C99C (using Editor Assembler Option 5 or Funlwriter Users List).
The C99C program will auto start and ask you to input various options.
You may include the c source text as comments in the 9900 source code if you wish. You may use an 'in line push' (referring to stack usage) if you wish.

Let's keep it simple: answer n (or N) to the first two questions.
The compiler will now ask for input and output filenames.
Our C source was saved as TEST- remember! So that is our input filename.
Output filename can be anything you want...lets call it TEST/SO.
You will recall that TEST is going to make the compiler load CONIO from Disk 1. so make sure that the file CONIO is on a disk in drive one! and that the input file TEST is on the disk in the drive specified, and that the disk in the output drive specified has room on it for our output file!

Off you go. As the compiler is in action it will tell you what program it is compiling- so (main) will appear on screen.

When it has finished - quite quickly - you will have a 9900 Machine Code SOURCE file called TEST/SO, which must now be assembled using the TI Editor Assembler module.

Select ASSEMBLE and indicate on the screen which appears:
Source file: DSKx.TEST/SO
Object file: DSKx.TEST/OB
List device: [press enter]
Options: [none- press enter with a blank here]
and off the assembler goes, producing a machine code object file which you can then run... or can you?

No. c-99 produces code which is incomplete. You need to 'add the end‘.

To run our test program, you must:
Select Editor Assembler Option 3 (or FUNLWRITER Utility Option 4).
Enter the first filename: TEST/OB
then a second filename... from the c-99 package: CSUP.
NOW you are ready to roll... press ENTER to move to the next item on the menu [PROGRAM NAME] and ask the computer to start running: START and off you should go.

If you wish to produce a memory image file to load with Editor Assembler Option 5, it is not that simple.

Return to top of page

Select Option 3 as before. Now you must load ALL the following tiles, in this order:
C99PFI TEST/OB CSUP C99PFF SAVE (or FWSAVE)

Now press ENTER to go on to the PROGRAM NAME section and ask the computer to RUN the program called SAVE.

For the output file name indicate something like TEST/OP5 and off it goes...

C Files C99PFI, CSUP, C99PFF are part ot the c-99 package.
SAVE is part ot the TI Ed/As package.
FWSAVE is part of FUNLWRITER package

To load and run this new file (TEST/OP5) you must select either Option 5 of Editor Assembler or Funlwriter Utility option 3.

If you have carefully followed these instructions. and made certain that all the right disks were in the right drives! you should now have a working machine code program, compiled by c-99.

Hint: It helps to keep a few blank initialised disks handy, and copy onto them whatever C libraries and functions your program will need, such as CONIO and CSUP!

You MUST always load CSUP after loading the object files produced by C.

You SHOULD always linclude either CONIO or STDIO in your C source code. STDIO is REQUIRED for file output. If you are using a C source file from someone else, make sure you know what 'include files' you need- you may need more than STDIO.
Include files are used to define labels and also to insert the REFs uhich the Assembler requires where the C source has included some machine code (denoted with #asm ... endasm).
Check to see if you need to load any other function files before CSUP.
The strength of c is the ability to write programs in small neat packages and then put them together as and when required.

NB: Some c function files exist in DF8O form ready to load, which have been compiled by C99REL1. These will not work with C99Rel2.
It is preferable for C functions to be supplied (and kept) in C Source form - then you can compile and assemble for your version.
Memory image files compiled by C99Rel1 will not load with Funlwriter.


Return to top of page



[ TI Articles   |    TI Book front page   |    TI Resources Page    |    PC99 and MESS Programs ]