[ To Main Shaw Family Home page | Go to Stephen's Entry Page ]
[ TI Book front page | TI Resources Page | PC99 Review | PC99 Programs ]
Last updated 7th May 2005

Contact - please use subject="pc99 page" to avoid spam trap!

This page contains TI99/4A Programming hints, tips for TI99/4A Module care, and using TI Writer.

Web article Five-


For - was it fifteen years? - MICROpendium was a commercial magazine supporting the TI99/4A computer.

One of the longest running professional supporters, writing in many magazines, was Cheryl Whitelaw, writing as Regena.

For this article some selected text from the January 1988 issue of Micropendium, retaining the original column widths and hyphenations, starting with an article by- Regena-

PROGRAMMING REMINDER HINTS
By REGENA
Are you still having FUN with your computer? Life has been
so hectic for me the last little while that I haven't had as much time
to program. Once in a while, however, I do like to sit at the com-
puter and program. (In fact, I'd rather program than write the arti-
cles, but of course most programmers are like that.) This month
I am going to offer you a few "reminder" programming hints. These
may be things you've known about for a long time but haven't used
for a while or they may be things you use in every program you
write. I hope you find these hints helpful.
When you start a program, number your lines by 10s (100, 110,
120, etc.). If you need to add lines later, you'll be able to insert
them with numbers within existing lines. You may want to start
major sections with 1000, 2000, 3000, and so forth, so you can
keep track of them. When the program is working in final form,
you can use RESequence to renumber your lines. If you really need
to conserve memory, you can RES 1,1 to number your lines by ones,
starting with Line l.

I usually clear the screen with CALL CLEAR, but you can use
other methods. For example, if you have all black printing on the
screen, you can turn the screen black with CALL SCREEN(2).
If you have graphics on the screen, you can change the color of
those characters to "invisible" with CALL COLOR(S,1,1), where
S is the set number for the characters involved. Or you may change
the characters to be a blank. For example, if you have Character
99 defined as a tree, and there are trees randomly placed on the
screen, you can make all the trees disappear with
CALL CHAR(99,"")
You may fill the screens with blanks with statements such as
CALL HCHAR(1,1,32,768)
or
CALL VCHAR(1,1,32,768)
The computer starts in the upper left corner, Row 1 and Column
1, and places the blank character or space in each position for 24
rows and 32 columns.
You may also use CALL HCHAR or CALL VCHAR to clear
parts of the screen. As in the above examples, you do not need to
restrict the number of characters in the fourth parameter to one
row or. one column. Let's say you have graphics on the top half
of the screen and some printing on the bottom half. If you want
to erase the bottom part of the screen only, you can use
CALL HCHAR(13,1,32,32*12)
Another hint is to remember that the colon in the PRINT state-
ment means to go to the next line. If you are translating from other
computer versions of BASIC, you may have noticed that the colon
is a statement separator. If you want to print several blank lines,
you need to use PRINT or? for each line you want in other ver-
sions of BASIC. In TI BASIC, you may use the colon, such as
PRINT:::::. You may use colons along with other numbers or
strings, such as

	PRINT::"HELLO":::::"HERE IS THE TITLE"::::
Remember to use the ON-GOTO procedure rather than a series
of IF-THEN statements. An example of this situation is when you
ask the user to choose among several choices. Let's say you have
a menu screen of choices A, B, C and D. You may use IF-THEN
statements to branch, such as if the answer is A, go to Line 1000;
if the answer is B, go to Line 2000; if the answer is C, go to Line
3000; if the answer is D, go to Line 4000. A more efficient way
to direct the computer is to use the ON-GOIO. If you have used
CALL KEY to get the answer, you will get the ASCII code of the
ASCII key pressed. First make sure the key pressed is A, B, C
or D, then branch:
	400 CALL KEY(O,K,S)
	410 IF (K(65)+(K >68) THEN 400
	420 ON K-64 GOIO 1000,2000,3000.4000
	
        To create a pause or delay in a program, you may use either a
	FOR-NEXT loop or a CALL SOUND delay:
	
        300 PRINT "ONE"
	310 FOR DELAY =1 H) 400
	320 NEXT DELAY
	330 PRINT "TWO"
	340 PRINT "THREE"
	350 CALL SOUND (500,9999,30)
	360 CALL SOUND (1,9999,30)
	370 PRINT "FOUR"
	 
         Sometimes when you read and process data in a FOR-NEXT loop
	you will notice a slight delay before the last data item. You can
	avoid the delay if you use one more loop than you need and add
	a dummy variable. For example, if you are printing lots of graphic
	characters on the screen you might notice a delay before the last
	 character is put on. Increase the loop and use the last data item
	twice (print the last character in the same place two times).
	
        300 FOR N=1 to 25
	310 READ ROW,COL,C
	320 CALL HCHAR(ROW,COL,C)
	330 NEXT N
	340 DATA 3,5,42,... (your data items here)
	350 DATA... 10,12,65,10,12,65
	
If you really have to "squeeze" your program to fit in the availa-
ble memory, remove all the REMark statements. Use short varia-
ble names. For example, instead of NUMERATOR and DENOM-
INATOR as variable names in a fractions program, use N and D.
Also look through your program for any repetitious programming
that could be more efficient using subroutines or FOR-NEXT loops
or DATA statements.
If you have a lot of graphic characters, redefine the lowercase
letters and symbols in ASCII codes 91 through 126. Use PRINT
rather than CALL HCHAR or CALL VCHAR to place the char-
acters on the screens faster. For example, redefine the characters,
then use a statement such as PRINT "abcd" rather than four CALL
HCHAR statements. Many of the other character numbers are the
same as CONTROL characters and may also be printed, although
your listing will contain funny looking characters and will be harder
to understand. You may also use a method such as
PRINT CHR$(130);CHR$(131);" ";CHR$(132)

In speech programming with the Terminal Emulator II command
module, I like to use the caret symbol before the word or phrase
and the period after it to get a more natural voice. For example,
PRINT #1: " TRY AGAIN."

When you use IF-THEN statements, don't forget that we also have
the ELSE option. You may specify a line number for branching
if the condition is true and another line number if the condition
is not true:
IF SCORE =10 THEN 500 ELSE 250
Also, you may check more than one condition in an IF-THEN
statement by using parentheses and the + and * signs.
IF (A=B)*(C>D) THEN 300

You may combine strings to save data that otherwise might be
in several parts and use lots of memory. For example, if you have
a series of numbers 5,7,1,3,8,9, you may read them in as 571389
then use the SEG$ function to separate them for calculations or
other use:
        200 READ N$,A$
	210 FOR M=1 TO 6
	220 X$=SEG$(A$,M,1)
	230 NEXT M
	400 DATA RICK,571389
	
        My final reminder is that if you have the disk system and do not
	need a lot of open files, gain valuable bytes by using this procedure:
	1. From the title screen, press any key to begin.
	2. Press 1 for TI BASIC.
	3. Enter CALL FILES(1)
	4. Enter NEW
	5. Proceed as usual.
	I use this as a standard procedure every time I sit down to pro-
	gram. Some of my longer programs will not run (you'll get an OUT
	OF MEMORY error) if you do not do this before loading and run-
	ning the program.
END OF ARTICLE

CLEANING MODULE CONTACTS

Having trouble with computer lockups or just getting your com-
puter started (such as screen garbage when you go into Extended
BASIC)? If so the following ... may help you solve
your problem.
...taken from the Central Iowa Users
Group newsletter. The article is by Ron Rutledge.
Readers who use the sug-
gestions for cleaning the 4A and its cartridges do so at their own
risk. Ed.

By RON RUTLEDGE

Dirty contacts can screw-up any electrical device and the 4A is not an exception. The only place you are likely to run into this problem is in using command modules. Both the module contacts and the port itself can become dirty, but cleaning the port itself is a big job as you have to disassemble the console. The good news is that cleaning the cartridge will almost always suffice and can be done quickly without special tools or cleaners. All you need is a screwdriver, a rag, a standard pencil eraser, and in some cases a medium Phillips screwdriver.

Remove the screw from the center of the cartridge if there is
one. Then pry the clips in the outside slots to the bottom left and
right of the center screw. If there is a clip in the center instead
of a screw, pry it back after the bottom left and right slots are pried
off. If it should bend off don't worry, it won't effect the perfor-
mance of your module.
The module board can now be removed. Do this carefully and note how the spring-loaded "door" is assembled, if there is one, so that you can put it back together if it pops out.

Once the board has been removed take the rag (a facial tissue will work but cloth is better) and rub off any residue from the edge connector contacts. Do the contacts on both sides if the module has them. Once the worst is removed take any soft rubber eraser and "erase" the contacts until they become dry, clean and shiny. You need to do only the outer half of the contacts as that is much as ever gets worn (you can see the scratch marks on the contacts).

After the cleaning, put the cartridge back together and go. Symptoms of dirty contacts include the console locking-up and unusual errors where none occurred before. (For example, my dirty Extended BASIC cartridge gives me syntax errors in programs where there were no errors when it was clean.)

Don't jump to clean a cartridge on the first appearance of an error. Such problems may be caused by static and not having the module firmly seated in the cartridge port, among other things. But if you have a continuing problem, cleaning the contacts is quick and cheap and may get you running again.

END OF ARTICLE

TI WRITER

Get to the bottom
of TI-Writer
Know how to get to the end of a docu-
ment while using the TI-Writer editor? Just
enter S (for Show Line) from the command
line and then enter E. The next thing you
know the cursor will be on the last line of
the document. To get back to the top, enter
S and then l.
The letter E for "end" can also be used when deleting, copying or moving lines.

For example, after entering D for delete in the command line, enter 10 E to delete everything from line number 10 to the end of the document.

end of article

Time-saver
for XBASIC users

The following tip appeared in Ozark 99'er News, the newsletter of the Ozark 99'er User Group. Harold Hoyt gets the credit for it.

Lots of programmers put their program identification in line 100 as a REMark. Six months later, listing the program, it answers you questions. What the heck is this? When did I write it'? Why did I write it?

I've been pulling a little trick in XBASIC that the more I do it, the handier it seems. I add another program line, so that the beginning of my program looks like this:

	
        1 !SAVE DSK1.PROGRAMNAM
	100 ! Prog 'PROGRAMNAM' H. Hoyt
	7/28/87 Demonstration Prog
	
        Note all of the 10 characters in the pro-
	gram name can be used to describe the pro-
	gram. One of my friends was using single
	letter program names because he hated the
	extra typing.
	
        If you type line 100 program description
	data once, and then hit Enter followed by
	FCTN 8 (REDO), you can edit out 00 in
	100 to create line I and further edit it to
	create SAVE DSK1. PROGRAMNAM
	and delete the rest of the stuff. By itself,
	this wouldn't be worth the trouble, but just
	see what happens next.
	
        After line 1 has been properly entered;
	hit FCTN 8 again and then FCTN 3
	(DELETE) to eat the line number. space
	and exclamation mark. What results is
	SAVE DSK1.PROGRAMNAM in the
	screen buffer. Just hit Enter and the pro-
	gram is automatically saved. This saves so
	much typing that it encourages you to save
	program pieces more frequently, reducing
	the loss in case of a program crash.
            
end of article
[ TI Book front page | TI Resources Page | PC99 Review | PC99 Programs ]