PROGRAMMING THE TI
We are happy to welcome C. Regena and her new, monthly TI-99/4A column to the pages of COMPUTE!. She has extensive experience in personal and educational computing and has written numerous articles on TI computers. To start things off, here is an overview of hardware, software, and miscellaneous resources for the TI.
Welcome to the world of the TI-99/4A computer! (This column is also addressed to TI-99/4 owners and users, but since the "A" is the newer and more plentiful model, I'll refer to both computers when I write "TI-99/4A.") For home, personal, and educational applications, the TI-99/4A computer is a very powerful machine. In this column I'd like to illustrate some of the features unique to this microcomputer.
Extraordinary Graphics And Sound
Graphics. You may easily define your own high-resolution (detailed) graphics characters. There are 16 colors, and you may use all 16 on the screen at the same time in high-resolution graphics (unlike other computers). You may also use text anywhere on the screen at the same time you use high resolution graphics. Most other microcomputers are limited when combining text with graphics.
Music. You may play up to three notes and one noise for a specified time using one statement. The music is specified by a number which represents a frequency of 110 Hz to 44733 Hz, tones from low A on the bass clef up to out of human hearing range. The tone may be between regular musical notes. An example which plays a three-note, C-major chord for three seconds is:
CALL SOUND (3000, 262, 6, 330, 4, 440, 2)
The first number is the duration in milliseconds, in this case 3000. The next numbers are frequency and loudness for each note. You may also add a "frequency" of -1 through -8 and a loudness for the noise generator. You may combine tones and noises for all kinds of sounds — everything from classical music to sound effects from outer space.
Combining music and graphics. "Computer" choreography" is possible because other statements (including graphics) may be executed while music is played. You may illustrate a song, for example. Or if you have a game program, you may make calculations while you are making a noise. The computer will play music and execute statements until the duration runs out or until the program comes to another CALL SOUND statement with a positive duration. A negative number for the duration will start that CALL SOUND statement even if the first duration has not finished. Try using a FOR/NEXT loop to vary any of the parameters for special effects. Here is a sample using just one tone:
100 FOR N = 500 TO 880 STEP 20 110 CALL SOUND (-99, N, 2) 120 NEXT N 130 FOR N = 880 TO 500 STEP -20 140 CALL SOUND (-99, N, 2) 150 NEXT N 160 GOTO 100
Noises. Using negative durations and combinations of music and noise numbers for frequency, you can make all sorts of synthesized noises. Quite often with noises you will want to use a FOR/NEXT loop and vary the loudness parameter.
Built-in BASIC. The programming language of TI BASIC is built into the main console — nothing extra to buy. The TI BASIC language is an excellent language for learning how to program, yet it is powerful enough for an experienced mathematician because of the built-in functions.
String manipulations. String (non-number) manipulations are also very powerful. Here is a sample program to print a phrase A$ on the screen starting at row R and column C:
100 FOR I = 1 TO LEN( A$) 110 CALL HCHAR (R, C + I-1, ASC(SEG$(A$, I, 1))) 120 NEXT I
The loop will go from 1 to the LENgth of the phrase A$. String variable names must always end with a dollar sign. SEG$ takes a SEGment of the phrase. In this case we are starting at the left side and taking one letter at a time. ASC gets the ASCII character code value of the character in the phrase. CALL HCHAR uses a graphic method to place the character on the screen at a certain row and column.
No Variable Name Worries
Variable naming. In your own programming on the TI-99/4A you may use meaningful variable names, although in many microcomputers the BASIC language recognizes only two letters – or a letter and a number – for a variable name. For example, if you have a program with the variable name BLUE and another variable name BLACK, other computers may recognize only one variable, BL, but the TI-99/4A knows you are using two variables. You also do not have to worry about embedded reserved words in variable names.
Documentation. Two excellent manuals are included with the computer. One teaches you programming in TI BASIC. The manual is very easy to understand, and a person with no previous computer experience can learn to program with this book. Also included is the User's Reference Manual, which may cost over $15 for other computers. The reference manual, which is in loose-leaf form, includes all the commands along with explanations and sample programs.
Plug-in modules. The easiest way to use the TI-99/4A is to insert a command module which contains a program. Modules are available for a variety of applications. The variation in price is largely dependent on the amount of memory built into the module. The modules actually add memory to the computer while they are being used.
Speech. Even though this feature is not built in, I am going to include speech in this list of unique features of the TI-99/4A because it is very easy to use and because, if you purchase six command modules before January 31, you can get the TI Speech Synthesizer free. The speech synthesizer is a small box that attaches to the side of your console. Command modules are available for you to program your own speech.
16-bit microprocessor. The TI-99/4A uses a 9900, 16-bit microprocessor, which offers more computing power and greater expansion and configuration flexibility than an eight-bit microprocessor. You can get higher numeric precision and simplified memory addressing.
Programmer's aids. Programmers will enjoy the easy line editing features. Various function keys allow you to insert or delete characters or to erase or clear a line. There is also a TRACE command to help in debugging.
Another feature programmers like is the built-in automatic numbering. Just type in NUM, press ENTER, and you can start programming. The line numbers start with 100 and automatically increment by 10. You may specify any starting number and increment. NUM 5,2 will start with line 5 then increment by 2.
After you have programmed and added or deleted statements here and there, you'll enjoy the automatic resequencing command, RES, which will automatically renumber your statements, including all statement numbers referenced by other statements.
There is a lot built into the TI-99/4A, and I have only touched on some features this month. Future columns will go into more detail, and I hope to be able to answer your questions and present programs and ideas to help you really enjoy your computer.
Since many readers may be new TI-99/4A owners and users, let's also describe some peripherals – hardware you can add on to your basic console. You may have noticed that buying a computer is much like buying a house – you can buy the basic house (computer), but then you need to add furniture (programs or software) to make it livable (usable), and soon you want to make major improvements (add peripherals).
Using The Cassette Recorder
Cassette. Probably one of the first items you'll need is a cassette cable to connect a cassette recorder to the computer to save your own programs or to use cassette programs available on a variety of subjects and applications. Nearly any cassette recorder is acceptable; however, the TI-99/4A is more critical on how you set the volume control than is the TI-99/4. In general, a battery-operated recorder does not work well enough for accurate data retrieval. Also, your recorder should have a tone control and a volume control. I have had the greatest success using the Panasonic RQ2309A cassette recorder.
Page I-9 in the User's Reference Guide tells how to connect the cassette cable, and the pages following describe how to save and load data from modules. Page II-42 shows an example of how to load a program that you have saved or purchased. Some other hints for using the cassette recorder are:
Turn the tone control to the highest setting.
Start with the volume about mid-range.
Follow the instructions after you type in OLD CS1.
If you get the message NO DATA FOUND, increase the volume.
If you get the message ERROR IN DATA, decrease the volume.
Sometimes a fraction of a change in volume can make all the difference in your success in reading a program. Once in a while, if I alternate between the two error messages at a volume setting near 2 or 3, I turn the volume to about 8 or 9 and the program will load.
The smallest jack of the cassette cable goes into the remote switch of the cassette recorder so the computer can turn the recorder on and off automatically. If the recorder does not turn on and off properly, simply remove the remote jack from the plug. You can operate the cassette recorder manually to save and load programs. For programs using the cassette recorder for data entry, you will need the remote capability. An adapter is available for the remote switch.
Disk drives. You can save and retrieve data or programs on a diskette much more quickly than by using a cassette system. The TI-99/4A uses 5¼-inch, single-sided, soft-sectored diskettes. To connect a disk drive, you also need a disk controller. One disk controller can handle up to three disk drives. Many business applications require two disk drives.
Memory Expansion. The TI Memory Expansion is for 32K RAM, and you need a module that will access it. You cannot use it with console BASIC. Extended BASIC does not require the memory expansion but can use it. Pascal, TI Logo, and Editor/Assembler require the memory expansion.
Peripheral Box. The "old" method had each peripheral in a separate "box" connected to the computer or the previous peripheral; each had its own power cord. The "new" system is the peripheral box, which has its own power supply and slots for cards for the RS-232 interface, memory expansion, disk controller, P-code, one disk drive, and possible future cards.
Monitor. Although the TI-99/4A may be connected to your regular television set, Texas Instruments has a very attractive, ten-inch, color monitor. The monitor gives a very clear, sharp picture and may be connected to other microcomputers as well as the TI-99/4A.
Making The Computer Speak
Speech. The TI Speech Synthesizer allows you to hear the computer speak to you. You will need a command module with built-in speech to hear the computer speak.
To program your own speech or to use any cassette or disk programs that use speech, you will need a module. Speech Editor and Extended BASIC have speech capabilities with a given list of words. Terminal Emulator II allows unlimited speech; the accompanying documentation gives you ideas for programming speech using this module. You may vary the pitch and slope and inflections. You may use allophones to create words, or you may have the computer speak words which you spell phonetically.
Telecommunications And Languages
Terminal. The Terminal Emulator II command module (or Terminal Emulator I, which does not have speech) allows you to use your TI-99/4A to act as a terminal either to another computer or to a large telecommunications service. You will also need the TI RS-232 Interface and a telephone modem.
The SOURCE is an on-line information service from Source Telecomputing Corporation. TEXNET is a special edition of The SOURCE especially for the Texas Instruments home computer.
Printer. You may use a number of different brands of printers with your microcomputer. To connect your TI-99/4A to a printer, you'll need the TI RS-232 Interface and a cable to go from the interface to the printer (the cable is usually sold with the printer).
RS-232. The RS-232 Interface has two ports so you may be connected to a modem and a printer at the same time. An instruction book comes with the RS-232 so you'll know how to operate the computer under different conditions.
Extended BASIC. TI Extended BASIC (XBASIC) is a programming language contained on a module. A manual (over 200 pages) and a programmer's reference card come with the module. No other peripherals are necessary to use XBASIC. If a program has been written in XBASIC, the XBASIC module must be inserted for the program to run. Some of the advantages of XBASIC are multi-statement lines, complex IF-THEN-ELSE logic, subroutine and MERGE capabilities, DISPLAY AT and PRINT USING, program security (SAVE protection), speech (with speech synthesizer), and moving sprites with greater graphics capabilities.
Logo. TI Logo is a fascinating programming language designed especially for young children. TI Logo is contained in a module, and the 32K memory expansion is required. Logo I can print using the TI thermal printer only. Logo II has music and also RS-232 capability so you can print listings on a regular printer.
Editor/Assembler. For machine language programmers, it requires the memory expansion, disk controller, and one disk drive.
USCD PASCAL. This language requires the memory expansion, P-code peripheral card, disk controller, and at least one disk drive.
Software. I've mentioned software (programs) last, although it's probably the first extra purchase you will make for your computer. Software is what you need to use your computer. Software is available on command modules, cassettes, and diskettes, and in a variety of subjects. Scott, Foresman educational courseware is available for grade levels kindergarten through eighth grade, Texas Instruments has several educational modules, and other educational and publishing companies are also developing modules for all grade levels.
In addition, there are modules for all types of home use (budget, finances, decision making, record keeping) and, of course, games from chess to soccer, from Hunt the Wumpus to TI Invaders.
Cassette and diskette programs are available for many applications, including programs for two-year-olds learning colors to sophisticated business programs. When you purchase, a software's documentation should tell you what hardware is required. For example, much of the business software requires a printer and two disk drives (and thus the peripheral box, RS-232 Interface, and disk controller) plus perhaps the Extended BASIC module and/or the 32K memory expansion.
Current literature. Texas Instruments sends an informative newsletter to all owners (be sure to send in your registration card). Many user groups have formed which have their own newsletters and catalogs. Other magazines are available that support the TI-99/4A. Now COMPUTE! will offer you a monthly column dedicated to the TI-99/4A, and other articles and programs to help you enjoy your TI-99/4A home computer to the fullest.