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

========================

This web page contains the text of articles for owners of the TI-99/4a from Issue 41 TI*MES (Summer 1993). It is of use to users of the TI-99/4a emulators.
After difficulties with issue 40, once again this issue was edited by someone other than where I had sent my copy for publication, so two issues work had gone missing! At this time terminal family illness meant that I also missed the AGM in May, which I really needed to get to. The long painful illness of my mother and her passing around the time copy was required for this issue resulted in my contribution being minimal. The issue ran to 84 pages with a six page report on the AGM, lots of pages from other newsgroups and some full page graphics (printed from a SUN computer connected to a VAX via a PC running DOS...)
Sometime in 1993 I received a LATE surprise visit from "Jeri" from America who brought along a Geneve (but no monitor, which took some sorting out), so briefly, and I had forgotten about it completely, there was a WORKING Geneve computer in the Shaw household.

Lots of programming ideas in Basic and some advanced c99 programming.

Items from TI*MES Issue 41 Summer 1993

AGM Notes

2016 rewrite of selected items - easier than cutting and pasting snippets and trying to get them to make sense...

May 1st 1993- AGM held in Derby.
Hardware Officer position removed from Committee. Publicity position vacant.
Chairman: Trevor Stephens. Vice Chairman: Mark Wills. Gen Sec: Richard Twyning.
Membership: Alasdair Bryce. Treasurer: Alan Rutherford Editor: Gary Smith.
Libraries: Disk: Stephen Shaw. Cassette:Mark Wills Modules:Francesco Lama

Retiring officers: Nicky Goddard (cassette),Phil Trotter (Modules and Publicity), Alan Bailey (Editor)

The meeting decided the group would ONLY support the TI99/4a (and a bit of Geneve). An offer would be made to East Anglia and West Midlands groups for a combination of groups, with West Midlands continuing to organise its workshop meetings. It was noted the East Anglia group was suffering following the departure from our shores of Scott and JoAnn.

[On p37 of this issue it was noted by Alasdair Bryce regarding members comments that "a couple made known their displeasure at Stephen Shaw's 'Rambles' being muzzled." ]

Return to page top

The Chairman

From the Chairmans Chair - T Stevens 1993

I have again been busy arranging things. You will see that I have again produced this issue as our Editor, Alan BAILEY has now had to give up the job through ill health. I on behalf of all the committee and members thank you for what you have done for the club in the past years. It is very much appreciated. We now have a new Editor for the next issue. He is Gary SMITH. So if you look at the committee list you will see his details. Can you now send all your submissions to him.

There has also been other changes in the committee, so if you see the report on the AGM you will see who's who. and what's what.

Now onto the continued saga of Sprites. Up till now we have discussed quite a few new programming tricks. Here are a few more for you to get your computer round.

You have all heard of multi tasking. This is where the computer is able to carry on with two programs at once. lf you remember last issue we looked at how once a sprite is set into motion it goes off on its own without further program control. This means with sprites you can infact Multi Task by getting the computer to do more than one thing without loss of any speed.

The following program shows how you can put a moving pattern on the screen with sprites and also display print statements. You can if you like use 'display at', instead of 'print'. Try and experiment with the routine and see what else you can do with it. Try putting music to the sprites, change the sprite colours or what ever. If you make up something really spectacular send it into me.

50 RANDOMIZE :: CALL CLEAR
100 FOR N=1 TO 28 :: CALL SPR1TE(#N,42,2,N*6,N*2,0,N*4) :: NEXT N
110 PRINT "HELLO"
120 CALL DELAY(1000)
130 CALL CLEAR
140 PRINT "HELLO THERE!"
150 CALL DELAY(1000)
160 CALL CLEAR :: GOTO 110
170 SUB DELAY (D)
180 FOR A=l TO D
190 NEXT A
200 SUBEND

You will see from the example above how good your computer really is. It is in fact running, or multitasking 28 sprites and a display program all at once, with no loss of sprite positions which is important in this program for the effect.

We now move onto the problem of the Pacman syndrome Have you ever tried to program a sprite to pick up something and put it down? What we are going to do is bring together some of the programing tips that we have discussed into practice to show you what can be done. We will look at two bits of code. The first hot is issue is a simple version, the second which will be in next issue is a bit more complicated. So lets walk before we run.

In the first example your sprite will be set into motion according to an input from joystick 1. The program will check its position and place a block underneath it. You can if you wish put call key statements into the routine to replace that of the joysticks.

100 CALL CLEAR :: CALL SCREE
N(5) :: CALL CHAR(35, "F0F0F0F
0"') :: CALL SPRITE(#1,35,2,89
,121) :: CALL COLOR(1,1,11,2
7,7)
110 CALL JOYST(1,X,Y):: CALL
MOTION(#1,-Y*2,X*2) :: CALL
POSITION(#1,R,X):: IF R>188
THEN R=1-(Y>0)*187 :: CALL L
OCATE(#1,R,X)
120 CALL GCHAR(INT((R+7)/8),
INT((X+7)/8),Y):: IF Y=32 TH
EN CALL SOUND(-90,660,9) :: C
ALL HCHAR( INT( (R+7)/8),INT((
X+7)/8),40)
130 CALL KEY(1,X,Y):: IF Y T
HEN CALL CLEAR :: GOTO 110 E
LSE 110

NB If you have a Version 100 Extended Basic Cartridge change line 110 to CALL MOTION(#1,-Y,X)
To find your version of cartridge Type NEW then CALL VERSION(V) :: PRINT V

If we go through the program.
Line 100 clears the screen and then sets it to screen colour dark blue (5). The character 35 is then defined as a small block. Then the sprite #1 is defined as character 35 with the colour black. lt will be placed on the screen at dot row 89, dot column 121.

The color command then turns sets 1 and 2 so that set 1 is transparent on dark yellow and set 2 dark red foreground and the same on the background.

You will note that the space character is ascii 32. So when the set 1 is changed the space color turns dark yellow. So we have a yellow screen with a dark blue boarder.

After the set up in 100 we now go to 110. This commences a loop through 110 120 and 130. The line 110 sets the joystick routine in motion. (See previous artical for joysticks). Then the call position is called. This places in the variable R(Row) and X(col).

We can reuse the variable X but we must retain Y.

Return to page top

The if statement works like this:
IF R IS GREATER THAN 188 THEN IF Y IS GREATER THAN 0 (or stick pushed up), THEN R=188.

(The call locate relocates your sprite at the variables R and X, which now will be at the bottom of the screen.)
ELSE IF Y IS NOT GREATER THAN 0 (or stick pushed down), THEN R=1.
(The Relocate puts the sprite at the top of the screen).
ELSE IF R IS NOT GREATER THAN 188 THEN LEAVE R ALONE. Then do not relocate the sprite.

From Stephen Shaw

Hi everyone. Not much written by me this issue due to family illness, but a brief bit for you...

We will start with another graphics program, this time a RECURSIVE one. Our versions of Basic do not support recursion, but as long as there is enough memory we can stack up our subroutines, which is how this program operates.
Every time you GOSUB, the computer remembers where you left from UNTIL it returns, so lots of GOSUBS without any returns can end up with a MEMORY FULL error, but with a small program like this, we can stack up the GOSUBS far enough to produce a perfectly adequate recursive program:

1 ! KOCH CURVE
2 ! recursive pattern
3 ! written for TI ExBas plu
s The Missing Link
4 ! by stephen shaw march 19
93
5 ! from "fractals for the c
lassroom" by peitgen,jurgens
, and saupe - Springer-Verla
g
6 !
7 ! after Helga von Koch, Ar
kiv for Matematik, 1904 (yep
, 1904)
8 !
100 CALL LINK("CLEAR") :: RA
NDOMIZE
110 ! CALL LINK("PRINT",41,1
2,"Input peak offset (sugges
t 0.29)") :: CALL LINK("INP
UT",71,81,R)
120 R=RND*.52 ! 0<R<1
rem this line out if
using line 110
130 CALL LINK("CLEAR"):: R$=
"R="&STR$(R):: CALL LINK("PR
INT", 140,100,R$)
140 L=5 :: XL(L)=10 ::XR(L)=
220+10 :: YL(L),YR(L)=120
150 GUSUB 190
160 CALL LINK("PRINT",170,20
,"DONE-press a key")
170 CALL KEY(5,A,B):: IF B<1
THEN 170
180 END
190 IF L>1 THEN 220
200 CALL LINK("LINE",YL(1),X
L(1),YR(1),XR(1))
210 GOTO 390
220 L=L-1
230 XL(L)=XL(L+1) :: YL(L)=Y
L(L+1)
240 XR(L)=.333*XR(L+1) +.667
*XL(L+1)
250 YR(L)=.333*YR(L+1) +.667
*YL(L+1)
260 GOSUB 190
270 XL(L)=XR(L):: YL(L)=YR(L
)
280 XR(L)=.5*XR(L+1)+.5*XL(L
+1)-R*(YL(L+1)-YR(L+1))
290 YR(L)=.5*YR(L+1)+.5*YL(L
+1)+R*(XL(L+1)-XR(L+1))
300 GOSUB 190
310 XL(L)=XR(L) :: YL(L)=YR(
L) ::XR(L)=.667*XR(L+1)+.333
*XL(L+1)
320 YR(L)=.667*YR(L+1)+.333*
YL(L+1)
330 GOSUB 190
340 REM RIGHT BRANCH
350 XL(L)=XR(L) :: YL(L)=YR(
L) :: XR(L)=XR(L+1):: YR(L)=
YR(L+1)
360 GOSUB 190
370 L=L+ 1
380 RETURN
390 RETURN
400 RETURN ! do we need all
these? check and delete if
required!
--------> ------->
======

Return to page top

PROGRAMMING BASIC
Way back in TI*MES Issue 34, Autumn 1991, I gave a program that would add fractions, but not reduce the result (Listing One, below), and I asked 1f you could better it.
I also, in the same issue, gave a more complex program that would reduce the result (Listing Number Two, below).

These entries created the usual lack of response from the UK, but have stirred up quite a response from our overseas friends.
In MICROpendium March 1993 issue, Dean S Mah of Red Deer, Alberta gave some modifications to listing one- see listing three below, to be read in conjunction with list one.

Meanwhile one of our leading programmers has been attacking the problem from several angles- see listings four onwards.

Consider the problem. eg to add 11/13 to 17/32 etc and display the result as a fraction (some fractions cannot be displayed too well as a decimal!

Try to solve the problem.

Look at the various attempts below. Which program is the easiest to follow? Which program uses the least memory? And which program gives the fastest result? which of these three options would you prefer?

Now for the listings

LISTING ONE- THE ORIGINAL

1 ! ADDING FRACTIONS
2 ! result is not reduced eg
12/16 would usually be show
n as 3/4
100 CALL CLEAR
110 DISPLAY AT(10,5):"--- +
--- = ---"
120 ACCEPT AT(9,5)SIZE(3)VAL
IDATE(DIGIT):A
130 ACCEPT AT(11,5)VALIDATE(
DIGIT)SIZE(3):B
140 ACCEPT AT(9,11)SIZE(3)VA
LIDATE(DIGIT):C
150 ACCEPT AT(11,11)SIZE(3)V
ALIDATE(DIGIT):D
160 GOSUB 230
161 ! WHEN YOU SEE #### USE
SHIFT 3 on the TI
170 DISPLAY AT(9,16):USING "
####":N
180 DISPLAY AT(11,16):USING
"####":L
190 DISPLAY AT(14,1):"ENTER
KEY FOR ANOTHER"
200 DISPLAY AT(1,1):" NORMAL
  RESULT=";A/B+C/D
210 ACCEPT AT(24,12):A$ :: G
OTO 100
220 STOP
230 FOR X=2 TO B*D
240 IF INT(X/B)<X/B THEN 260
250 IF INT(X/D)=X/D THEN 270
260 NEXT X
270 L=X
280 N=INT(L/B)*A+INT(L/D)*C
290 RETURN

end of listing one
==== ---->

LISTING TWO- reduces answer
100 ! FRACTIONAL + AND -
110 ! R CALDWELL JAN 91
120 ! FOR T199/4A BY
130 ! S SHAW APR 91
140 DIM Q(102)
150 DISPLAY AT(1,1)ERASE ALL
:"FRACTIONAL + AND -"
160 DISPLAY AT(7, 1):"---+--
-"
170 DE,X=1
180 ACCEPT AT(6,2)VALIDATE(D
IGIT, "+-")SIZE(4):N(X)
190 IF N(X)=0 THEN 310
200 ACCEPT AT(8,2)VALIDATE(D
IGIT)SIZE(4):D(X)
210 IF D(X)=0 THEN 310
220 DP(X)=N(X) :: DE=DE*D(X)
230 CALL HCHAR(6,1,32,12)
240 CALL HCHAR(8,1,32,12)
250 DISPLAY AT(S,1) :"PLUS:"
260 DISPLAY AT(3,1):”ENTER 0
TO TOTAL"
270 X=X+1 :: DISPLAY AT(7,15
): "ITEM";X :: DISPLAY AT(8,
15):"-MAX 10-"
280 IF X=11 THEN 310
290 GOTO 180
300 REM
310 F,X=X-1
320 FOR S=1 TO F :: FOR J=1
TO F
330 Z=P+1 :: K=S+J-1
340 P(S,J)=K-F*lNT(K/F):: IF
P(S,J)=0 THEN P(S,J)=F
350 Q(Z)=P(S,J) :: NEXT J ::
  NEXT S
360 FOR X=1 TO F :: Y=F*X-F+
1 :: FOR C=1 TO F-1
370 Y=Y+1 :: DP(X)=DP(X)*D(Q
(Y)):: NEXT C
380 NU=NU+DP(X):: NEXT X ::
DD=2
390 DISPLAY AT(10,1):”SUM I
S:" :: DISPLAY AT(11,5):NU
;"/";"DE
400 IF NU/DD= INT(NU/DD)AND
  DE/DD=INT(DE/DD)THEN NU=NU
/DD :: DE=DE/DD :: GOTO 400
410 DD=DD+2+ (DD=2)
420 IF ABS(NU)>DE THEN A=ABS
(NU)ELSE A=DE
430 IF DD<SQR(A) THEN 400
440 IF NU/DE=INT(NU/DE)THEN 540
450 IF NU>0 THEN WN=INT(NU/
DE) ::NU=NU-WN*DE :: PN=1
460 IF NU<0 THEN WN=INT(NU/
DE)+1 ::NU=ABS(NU-WN*DE) ::
PN=2 ::IF WN=0 THEN NU=-NU
470 REM CHAR ##### IS SHIFT
3 ON TI99/4A
480 DISPLAY AT(13,5) :USING
"#######":NU
490 IF PN=1 THEN DISPLAY AT(
14,1):WN ::NU=NU+WN*DE
500 IF PN=2 THEN DISPLAY AT(
14,1):WN ::IF WN<0 THEN NU=W
N*DE-NU
510 PN=0
520 DISPLAY AT(14,5):"-------"
530 DISPLAY AT(15,5):USING"#
######":DE
540 DISPLAY AT(18,4) :NU/DE
550 DISPLAY AT(24,4):"ANY KE
Y FOR ANOTHER"
560 CALL KEY(1,G,H) ::IF H<1
 THEN 560
570 RUN
580 END

========= -------> ------>


Return to page top

LISTING THREE- modifications
 to LIST ONE,
from Micropendium March 1993
Dean Mah, Alberta

165 CALL REDUCE(N,L)
300 SUB REDUCE(A,B)
310 X=A :: Y=B :: IF X<Y THE
N TEMP =X ::Y=TEMP
320 CALL MOD(X,Y,REMAIN)
330 IF REMAIN>0 THEN X=Y ::
Y=REMAIN :: GOTO 320
340 A=A/Y :: B=B/Y :: SUBEND
350 SUB MOD(A,B,REMAIN)
360 REMAlN=A-INT(A/B)*B ::
SUBEND
370 END



-----> ----->



LIST FOUR
From Bruce Harrison- subsequent lists that follow are modifications of this listing:
100 CALL CLEAR
110 DISPLAY AT(10,5) :"--- +
 --- = ---"
120 ACCEPT AT(9,5)SlZE(3)VAL
IDATE(DIGlT) :A
130 ACCEPT AT(11,5)SIZE(3)VA
LIDATE(DIGIT) :B
140 ACCEPT AT(9,11)SIZE(3)VA
LIDATE(DIGlT):C
150 ACCEPT AT(11,11)SIZE(3)V
ALIDATE(DIGIT):D
160 GOSUB 230
170 DISPLAY AT(9,16):USING "
####":N ! # IS SHIFT 3
180 DISPLAY AT(11,16):USING
"####":L
190 DISPLAY AT(14,1):"ENTER
KEY FOR ANOTHER"
200 DISPLAY AT(1,1):"NORMAL
 RESULT=";A/B+C/D
210 ACCEPT AT(24,12):A$ ::
GOTO 100
220 STOP
230 FOR X=2 TO B*D
240 IF lNT(X/B)<X/B THEN 260
250 IF INT(X/D)=X/D THEN 270
260 NEXT X
270 L=X
280 N=INT(L/B)*A+INT(L/D)*C
290 RETURN
---->


LIST FIVE
amend listing 4 above, as below
1 ! ADD FRACTIONS WITH REDUC
TION
2 ! LINE 290 REMOVED & NEW L
INES 300-360
3 ! ADDED BY B. HARRISON
4 ! ORIGINAL PROGRAM BY S. S
HAW
90 REM
290 REM
300 LIM=MIN(N,L) :: TN=N ::
TL=L
310 FOR Y=2 T0 LIM
320 IF N/Y <>INT(N/Y)THEN 350
330 IF L/Y <>INT(L/Y)THEN 350
340 TN=N/Y :: TL=L/Y
350 NEXT Y
360 N=TN :: L=TL :: RETURN
-----> ------->
========

LISTING SIX- modifications to listing 4 above
90 ON WARNING NEXT
290 REM 300 TN=N :: TL=L
310 FOR Y=2 T0 MIN(N,L)
320 IF N/Y>INT(N/Y)THEN 350
330 IF L/Y=INT(L/Y)THEN TN=N
/Y :: TL=L/Y
350 NEXT Y :: RETURN

=====

LISTING SEVEN
modifications to listing 4 above
90 ON WARNING NEXT
290 REM 300 FOR Y=2 TO MIN(N,L)
320 IF N/Y>INT(N/Y)THEN 350
330 IF L/Y=INT(L/Y) THEN N=N
/Y :: L=L/Y :: GOTO 300
350 NEXT Y :: RETURN

========
LISTING EIGHT:
complete listing

2 ! MODIFIED FOR REDUCTION A
ND SPEED ENHANCEMENT BY BRUC
E HARRISON
4 ! VERSION ADFR6 OF 1 APRIL
 93
90 ON WARNING NEXT
100 DISPLAY AT(10,5)ERASE AL
L:"--- + --- = ---"
110 ACCEPT AT(9,5)SIZE(3)VAL
IDATE(DIGIT):A
120 ACCEPT AT(11,5)SIZE(3)VA
LIDATE(DIGIT):B :: IF B=0 T
HEN 120
130 ACCEPT AT(9,11)SIZE(3)VA
LIDATE(DIGIT):C
140 ACCEPT AT(11,11)SIZE(3)V
ALIDATE(DIGIT):D :: IF D=0 T
HEN 140
150 FOR L=MAX(B,D)TO B*D STE
P MAX(B,D)
160 IF INT(L/B)<L/B THEN 180
170 IF INT(L/D)=L/D THEN 190
180 NEXT L
190 N=L/B*A+L/D*C
200 FOR Y=2 T0 MIN(N,L)
210 IF N/Y>INT(N/Y)THEN 230
220 IF L/Y=INT(L/Y)THEN N=N/
Y :: L=L/Y :: GOTO 200
230 NEXT Y
240 DISPLAY AT(9,16):USING "
####":N
250 DISPLAY AT(11,16):USING "
####":L
260 DISPLAY AT(14,3):"PRESS ENTER
FOR ANOTHER"
270 DISPLAY AT(1,1):"NORMAL
RESULT=";A/B+C/D
280 CALL KEY(0,K;S):: IF S<>
1 THEN 260 ELSE IF K=13 THEN
 100

------->

There you have it. There are almost always MANY ways to tackle ANY programming problem. Some will be better than others because they are easier to follow OR use up less memory OR work faster. The programmer must decide his priorities and program accordingly.

So called programmers using macroassemblers with vast routine libraries already written tend to end up with programs which are hard to follow, hard to modify, are slow, and use up lots of memory, which is why PC users now tend to go for machines with 4MB of memory running at 32Mhz or more!

You don’t need all that if you know how to program.
And you can avoid using up 29k just to do a PRINT "HI"!
2016 update: A PC with 4MB of ram running at 32MHz - unimaginable today!

---Return to page top

-------

TIPS

Trevor Stevens:
TI WRITER
Have you ever tried to print out a multi document through the PF (print file) command, and suddenly realised that on page two of four there is a mistake. Or you want to print out only a paragraph, or perhaps save a line to disk without CR marks in them. Well you can. I have looked at the TI WRITER manual and can find no reference to the following command in it. I found it out by mistake when tried to save a file to disk.

What you do is take note of the line numbers (inclusive) that you want to print or save and then return to the E(dit) Mode, which is on the top line. Then type PF (Print file). You will then be presented with PI0 or RS232.300 or similar. In my Case I use PIO. You then back space over the PI0 to the begining of the entry field. Say you want to print line 20 through to 40, you will then type 20 40 PIO. Press return and the lines 20 to 40 are only transmitted to your printer and printed. For a single line type the single line number only. eg 20 PIO. Remember however to put the spaces between as given in the above examples. If you want it to disk, replace PIO with DSKN.FILE.

T I EXTENDED BASIC
Did you know that you can chain link cassette programs? What is chain link you may ask, well it is where you can write a basic program from which can load and run another program from your cassette recorder. When this happens the original is over written and the new one then replaces the old and then runs. You must however be at the begining of the program on the tape for this to happen. You do this with the RUN command. If you branch in your program to RUN "CS1" you will pe able to chain for as long as you like. This can increase memory storage. The only down side is that tape takes a long time to load.
DEMO to the above TIP
100 CALL CLEAR
110 PRINT "THIS IS PROGRAM 1"
120 FOR A=1 T0 1000 :: NEXT A
130 RUN "CS1"
Save this to tape first, then type NEW and enter the next program. Save this but DO NOT rewind the tape before you save. The second program should follow the first program on the tape.

100 CALL CLEAR
110 PRINT "THIS IS PROGRAM 2"
120 FOR A=1 TO 1000 :: NEXT A
130 PRINT "FINISHED"

Now rewind the tape to the start, OLD the first program, stop the tape and RUN the first program. When prompted DO NOT rewind the tape, pass on to the PLAY stage which should load the second program and run it.

c99 by Mark Wills

c99 for the slightly more initiated!

The IF command
Users of BASIC will be aware of the IF command which allows the computer to make a decision and execute a series of instructions according to the result of the decision. (Always either true or false).

In basic, the IF command takes the form :
IF expression THEN instruction(s)
ie IF A=4 THEN P=0
As you can see, P will equal zero when the expression evaluates to true. ie when A=4

c is very similar but its syntax is different:
if (expression) instruction;
or
if (expression) {
multiple instructions;
multiple instructions;
}

So taking the first c example above and replacing it with some actual c code:
if (a=4) p=0;
is the equivalent c way of saying the same as the BASIC statement above.

The second c example is as follows
if (a==4) {
p=0;
t=44;
z=(p+2)*t;
etc...;
}

The above example is called a "block if" because there is a "block" of code (the code between the curly brackets - or braces to give them their proper name) which is executed every time the condition inside the brackets evaluates to true.

There are a few rules and regulations we need to make clear when using if's relating to their syntax, just to clear up any confusion:

A single if
The expression to test must be enclosed inside brackets
The statement to execute in the event of the expression evaluating to true must terminate with a semicolon. (;)

Block if’s
Again, the expression to test must be enclosed within brackets.
The beginning of the code block must be indicated with an open brace ( { ). The end of the code block must be indicated with a closed brace ( } ). All statements inside the code block must be terminated with a semicolon (;) - as indeed all c statements must do.

Relational operators
This is probably a good time to discuss the difference between c's relational operators and BASIC’s, as they are different. A simple list will clarify the differences better than I can so.
Description:.......... c99 form: BASIC version
Is equal to ?............= = ...........=
Is not equal to ?........!= ...........<>
Is greater than ?.........> ............>
Is less than ? ...........< .........<
Is greater than or equal...>= ..........>=
Is less than or equal to...<= .........<=
Is not greater than ?......!> ...........note
Is not less than ? ........!< ........note
Comparative AND ............&& ..........none
Comparative OR..............|| ..........none

NOTE* Is not greater than, and is not less than is not really directly supported in TI-BASIC, so in order to express an equivalent expression in TI-BASIC you would say "is LESS than x" or "is GREATER than x" where x is the value you are testing, respectively.

Comparative AND and OR, which again is not DIRECTLY supported, allows you to mix multiple expressions in the same test. Example:
if(a= =4 && b= =2) p=41;
p will be set to 41 when a= =4 AND h= =2

if(a= =21 || z= =1) x=2;
x will be set to 2 when a= =21 OR z= =1
NOTE: For clarity above == is shown as = = but there should be no space between the two equals signs.
I guess thats if's more or less covered, except to say that you can call another part of your program (a function) with an if like this:
if(a= =4) game_over();

will call the game_over routine when a= =4. This of course can be done with code blocks:
if (a==4) {
score=score+1000;
game_over();
}

If's and if code blocks can also be nested:
if(a=2) {
if (b=2) game_over();
}

Also, you can use the ELSE clause, like in basic
IF A=1 THEN Z=2 ELSE Z=3
is
if (a=1) z=2; else z=3;


Return to page top

Note also c is case SENSITIVE. So a in this program:
main()
{
int a;
int A;
a=a+1;
A=A+1;
}
a and A are treated, unlike BASIC, as completely seperate variables in thier own right.

A quick aside here, the lines a=a+1 and A=A+1 can be re-written as
a++
A++
This in c says increment by one, and generates smaller code (and faster) than doing it the long way. You can also decrement by one:
a--;
A--;
Will decrement the two SEPERATE varaibles a and A by one each. Those of you who know machine code will spot that the compiler can use the INC and DEC instructions rather than A and S instructions which require operands and thus is larger and slower. Whenever you need to add or subtract one, you should use this method.

The while Loop
Another powerful and easy to use method of controlling program flow is the while loop. It looks like this:
while(expression) do something;
while(expression) {
do loads of things....;
}
In the while loop, a command or block of code can be executed for as long as a particular condition is true. Or, put another way, code can be made to execute WHILE the test condition is true, let's look at an example:
#include dsk1.conio
#asm
REF PRINTF
#endasm
main()
{
int a;
a=0;
while(a<100) printf("a is %d",a++);
}

Lets go through this program line by line and work out what the program does.
#include dsk1.conio
This line, tells the compiler to include the file conio when compiling. It contains certain defined variables that you may refer to in your programs - we’re not using any here but its good practice to get into the habit of including it all the file.

#asm
This line tells the compiler that all lines up until #endasm are "raw machine code" and not to alter them in any way, just to pass them straight on to the source file for assembling. In this case all we are passing is a REF to the assembler because we will be loading the PRINTF file at runtime because we are using the PRINTF command to display the contents of our variable a.

  REF PRINTF
As just mentioned, this line is passed un-modified through to the assembler source file in. Note that there is a space before the REF It is IMPORTANT!

#endasm
Tells the compiler that we have finished passing machine code through to the assembler source file.

main()
This indicates the beginning of the function called Main. Remember that all c programs start and end in main()

{
The open brace means that all code is intended for the function called main.

int a;
This line tells the compiler to reserve space for an integer variable called a.

a=0;
Sets the variable a to zero

while(a<100) printf("a is %d",a++);
This line looks at the value of a. If a is less than 100 (ie the expression is true) then the value of a is printed on the screen, and then increased by one for the next time round (the ++). The %d in the printf command means that the operand following the comma is to be treated as an integer, which we defined before (int a;)

Eventually, a will become 100 and the expression in the brackets (a<100) will evaluate to false. At this point control is passed to the next line of the code, which, in our case, is the end of the main() function, so the program simply stops.

}
Tells the compiler that we have finished our code for the main function, and, in this case, finished altogether!

The other technique worth a mention, and the final one for this issue is the do/while loop:
The do/while Loop:
Another very powerful way of controlling program flow/iteration, it looks like this:

do{
various things;
} while(expression);

You may wonder what the difference is, well, the difference is that the code inside the curly braces will ALWAYS be executed at least once. because the expression is tested at the END of the code block

This is a very handy method for implementing things like menus, where you put a number of options to select from, one of them being quit. If the user presses quit, the program flow will fall out of the bottom of the do/while loop because the test expression is testing for the quit key being pressed. Handy and efficient.

=================================================================
And there we are. TI*MES continued past issue 100 (and is still produced in 2022). But issue 40 and 41 had very little from me due to the severe illness of the editor to whom I had sent my copy. A new editor took over Issue 42 onwards due to the sad death of the prior editor. Unfortunately the new "editor" had almost no prior experience with TI Writer or disk files, and little interest in editing. My output was diminished mid-1993 by the death of my mother, and there was after this little trace of anything from me. Instead there were pages and pages of Geneve and other hard to get new hardware articles.

Issue 43 was almost entirely written by one person, wildly off topic and little related to the TI world, with a lot of ideas for new hardware for the TI. Issue 43 DID contain a couple of pages that I had sent in to be published in Issue 40 (eg 12 months delay).

It may be worth noting that at no time has the group purchased for me or lent to me any TI item nor paid any expenses to me - this does not apply to some officers who were given (/lent??) full expanded systems for purposes that in the event did not flourish or last.

Issue 47, at the end of 1994, contained a note that the editor (the post was vacant...) had received material from me ON DISK and did not have the time to sort it out, explaining the lack of material from me in recent issues.

For almost two years there was no effective (or in many cases identified) editor. The named editor was spending a lot of time developing hardware, and wanted only ready to use formatted paper copy.

Sadly members noted the lack of material from me and complained to the membership secretary and the editor, neither of whom contacted me (the sad thing is NO-ONE contacted me and what I was submitting and the little that was actually printed was not being read by anyone) (as I recall anyway) and they both resigned in 1995.

The following text, from me, was printed in TI*MES 48, Spring 1995:
"February 24th and I have received a copy of TIMES which says the copy for the next issue is to be received by March 1st. My father is in hospital requiring many toings and froings.
My absence has been due to sheer lack of time for ME to print things out. My mother died after a long illness, leaving me with my father to care for, a blind insulin dependent diabetic. I have LOTS of text for TI*MES but time is profoundly short. At work redundancies beckon and I have to WORK hard to reapply for my job.

[My first job re-application failed but I did manage the second time round, after spending weeks going to the office to do nothing except peruse job vacancies. VERY tiring. In the end, redundancy did come - after a sad Christmas when we thought of opening presents on December 28th! It was to be another nine months before I found a new employer.].

In issue 49, Summer 1995, with a new editor, a very short piece by me referred to the last issue from the resigned editor "over the last 18 months or so I have completely lost track of the gap between material submitted and material printed. This continued with the last issue, I was assured everything I submitted was printed: but it wasn't."

The following text from me was published in Issue 51 at the end of 1995:
"The Good Old Days: Back in the good old days of the early 80's, there was a lot to learn about the TI99/4A. There were LOTS of new programs to review and explore, and hundreds of newsletters, magazines and books to delve into for nuggets of information to pass on, or to point to new avenues of exploration. '
Rambles was always driven by information I received, questions I was asked, and software I was experimenting with! In those heady days I also had no family - no son, and my mother took care of my father who could then see. Work was secure and jogged along at a rather boring pace. That is the situation that produced the Rambles of old!
I have never been interested in hardware, my purchases have always been driven by what I could do with it! My principal programming interest is Basic, so the Myarc Extended Basic was of use to me. I could program it myself.
Now into the late 90's we were down to a mere handful of users, with no deluge of magazines and newsletters; almost no new software; and almost no questions arriving from our members. I have fairly thoroughly explored Basic programming already, so what can I write about?
I also now have a family to care for; a blind insulin dependant diabetic father to care for; an insecure job which has recently changed considerably and requires much additional training and adjustment - in other words, a lot less time and energy (especially less energy!) "

All things must pass and the new editor last edited Issue 54, and issue 55 had nothing from me- nor was there anything from me in issues 56,57,59,61,62...

In 1997 the officers who produced TI*MES all had PCs and Windows, and ALL material for publication had to be submitted on an IBM Disk or sent to the Group Bulletin Board. These avenues were then not available to me. Text I sent in for June 1998 - Issue 61 was not published, was not published again in an interim issue, and again was not published in the September 1998 issue. My words were -once more- not being published! The editor who had been publishing my material had been replaced by another editor, just as my domestic duties lightened and I had time to write again...

The odd paragraph with my name appeared until 1999 when I seem to have given up. Bad timing as in 2000 I was awarded the Edgar Mauk Award- which I discovered by accident in 2013 and finally received in 2015.

As my printed or TI disk submissions were no longer acceptable, this also meant NO news from the disk library in the magazine for a long time! People thought the disk library had ceased. Usage of the disk library fell. The General Secretary was someone who had opined some years earlier that I should copy the whole disk library for him at very reduced charge- he also felt the user group should join with other groups eg BBC Micro group. Meanwhile group funds were spent in obtaining not only TI Expansion systems for some officers but even PCs.

In late 1998 a European TI meeting took place in the UK and the group Committee decided to show the world that the UK existed by having the entire disk library present at the three day event- I could only afford to go for one day, so A N Other collected the boxes of disks from me. Nearly 40 people were able to see boxes of TI disks.

Then the issue was raised of the disks not being returned to me immediately but kept to be placed onto a CD rom. I did not resign as disk librarian, nor was my appointment cancelled at an AGM. When the next issue of the Group Magazine arrived I found that I was no longer listed as a Commitee Member, simply removed. The Chairman indicated that I had "donated the disk library to the group" - not knowingly, those boxes of disks inevitably included private disks not in the library- I had no time to prepare the consignment. And then- I find that within a matter of weeks the disk contents had been moved to a hard disk and the actual perfect disks had been repurposed.

Sadly the software used to transfer images to hard disk was imperfect and disk software was permanently destroyed.

The damage (to fractured files, full disks, disks with lots of files...)- was made far worse by the disk images being edited with unneeded new LOAD programs and additions made by the hardware. As the proposed CD never appeared it seems nobody noticed so many disks were damaged. In so many cases, the sole representative of software had been digitally shredded. The possibility of transferring rare and unique programs to the TI emulators has gone for many of them.

In 2015 the surviving old disk content was offered in emulator format for three pounds per disk (not very clear but possibly per TI disk) but found no interest. In 2017 there was talk of collecting them onto two or three CDs.. (2022- decision made to sell them for GBP 15 per CD - still WITH the many corrupted disk sector errors.).

Towards the end of 2022 I decided to recreate the 1995 User Group Disk Library- some of the disks had been lost without trace, and a third of the disks had corrupt files- which made this hard work and inevitably some rare items of software were utterly lost. An ongoing task... keep an eye on wht- added to wht in 2023.

I didn't fall out with the group, they just moved on. Some of my material from 1993 was published in Micropendium and the Sydney group's newsletter. In 1996 Micropendium had several items written by me, but without crediting me!
Finally- after some decades, I started to have articles printed in TI*MES again. A little bit in 2015 and 2018 and then from 2019 on... but not every issue as my words were "fillers" for when nothing else was to hand...


Go to top of page

[ TI Book front page    |    TI Resources Page    |   PC99 Review    |   PC99 Programs ]

Return to page top