Programming the TI
A Beginning Reading Program
When my youngest son was learning to read, I wrote lists of words for him to practice with. The word lists used a certain word ending coupled with various beginning letters--such as AT, BAT, CAT, EAT, HAT, MAT, PAT, RAT, SAT, TAT, VAT, and THAT. After I wrote the same list several times, I realized this was another idea for a computer application.
Not only can the TI-99/4A print the words nicely on the screen, but with the TI Speech Synthesizer it can also speak the words aloud. This month's example program, "Reading Practice," takes advantage of this feature. Therefore, it requires both the TI Speech Synthesizer and the Terminal Emulator 2 command module. Insert the module and select 1 for TI BASIC to gain access to speech.
Notice line 154 in the program listing below. This OPENs the channel for speech, so any subsequent PRINT #1 statement will speak the word. The words I selected for examples are all pronounced correctly by the speech synthesizer as they are spelled. If you add words, check their pronunciation; you may need to add a routine so the word is pronounced correctly.
If you want to run this program without speech, omit all statements that refer to file 1 or insert a REM in front of each of these commands. Another alternative is to make speech an option; insert IF-THEN statements before the speech commands.
Due to space limitations, I had to keep Reading Practice rather short. Feel free to add graphics, sound, and additional word lists. I included just a few for examples. You could also modify the program to offer the student various groupings of words.
When you run Reading Practice, you'll see a word ending in lowercase letters. To hear the word pronounced aloud, press the space bar. To go to the next word, press ENTER. The screen clears and you'll see a word with a beginning letter and that word ending.
The words are in the DATA statements starting at line 198. First there is a word ending, then all the beginning letters that go with the word ending and create real words. ZZZ indicates no more beginning letters for that ending. At the end of all the lists, @@@ indicates the end of data.
Lines 126--146 redefine characters to draw larger lowercase letters. Be careful typing the DATA statements; they contain the character definitions. If you have my program for lowercase letters (COMPUTE!, August 1983), you can take a shortcut. First, load that program and delete all the PRINT statements. Type RES 126,2 to renumber the lines. Then add the rest of the Reading Practice program.
Lines 20--110 contain subroutines to draw the 26 letters of the alphabet. The variable R is the main row number and C is the column number. If a lowercase letter has an ascender or descender, more than one character is required to draw the letter. Line 174 goes to the proper subroutine for each letter in the word. Since there are 26 possible letters, I needed low line numbers to use a single ON-GOSUB statement (otherwise more complex logic and several ON-GOSUB statements would be required). Therefore, the subroutines are near the beginning of the program, and the program starts with line 2 and increments by 2. To type in this program using the automatic numbering feature, use NUM 2,2.
TI BASIC String-Handling
Reading Practice uses several stnng functions. It reads the letters from the DATA statements into X$ for the word ending and B$ for the beginning letters. W$ holds the word to be printed and read. LEN(W$) returns the length of the word (or word ending). Lines 170--178 contain a FOR-NEXT loop that executes for each letter of the word. SEG$ gets one character at a time from the word, and ASC returns the ASCII value of that letter. In TI BASIC, the ampersand symbol (&) is used to combine strings. (See "The Beginner's Page," June 1986.)
Line 194 combines the beginning letter B$ with the word ending X$ to form the word W$. Line 186 adds a period to the word to change its inflection for the speech synthesizer. You may prefer to simply use W$.
Versions of BASIC on other computers generally use the string functions RIGHT$, LEFT$, and MID$ for extracting sections of strings. The equivalent in TI BASIC is SEG$. SEG$(W$,A,B) looks at the string W$, starts with character number A, and returns B number of characters. For example, let's assume that W$ = "RICHARD". The Microsoft BASIC statement LEFT$(W$,4) is translated into TI BASIC as SEG$(W$,1,4), which yields RICH. The statement RIGHT$(W$,4) is translated as SEG$(W$,LEN(W$) --4 + 1,4), which yields HARD. And the statement MID$(W$,3,2) is translated as SEG$(W$,3,2), which yields CH. (See "The Beginner's Page," April 1986.)
In the Reading Practice program, SEG$(W$,P,1) is in a loop where P starts at 1 and goes to L, which is the number of characters in the word. This function, then, gets one letter at a time, in order, from the word. The variable A is the ASCII value of that character minus 64 to yield numbers from 1 to 26 for the relative letter. Line 174 then uses ON-GOSUB to go to the proper subroutine to draw the corresponding lowercase letter.
If you want to save typing effort, you may get a copy of this program by sending a blank cassette or disk, a stamped, self-addressed mailer, and $3 to:
P.O. Box 1502
Cedar City, UT 84720
Be sure to specify the title "Reading Practice." This program is available for the TI computer only.