Jump to:
Report on Romiley meeting
Programming: Rounding in Basic Functions || Leaving Loops
Graphics Programs: More Martin Mapping ||
Attractors || Three routines in G || Small Logo routine
Reviews: PagePro ||
Book Reviews: Armchair Universe || Lisp ||
Fractals Everywhere || Science of Fractal Images || TI Base
This web page contains the text of articles for owners of the TI-99/4a from Issue 26 of TI*MES. It is of use to users of the TI-99/4a emulators.
Welcome to another issue of RAMBLES
Good to see so many articles flooding in for our magazine... together with a lot more activity by me, this means that while I have a great deal to tell you I have less and less room to do it! In the last two issues of TI*MES for instance, only half the text I have sent in has been printed. Obviously I can't take up the whole magazine! but you will see the problems!
Jim Peterson sent over a box of disks for us to sell- duly opened by Customs, who rather oddly, took one disk out of its envelope, tore it, and put it back into its envelope? I can't see how Jim could have recorded on such a badly damaged disk, nor how a disk can be damaged and leave no mark on its tyvek envelope...
Texaments sent along over US$400 worth of software for us to sell, but made the error of declaring a value of US$100 on the Customs label. The package was opened for inspection and promptly seized (under-declaration is a criminal offence).
MICROpendium intended to send us some sample copies, but forgot. Laura mentions that they have a mere 14 subscribers in the UK (the majority recruited by me!), which is a very low figure even considering OUR membership number. This is a good regularly published and well established magazine covering all interests including basic only, and with timely news of new products. I have been recommending this magazine for four years now with apparently little effect.
Dolores of Harrison Software actually came along to be with us, all the way from Maryland (near Washington DC) and sold a few Music disks and a couple of word processor software packages. Perhaps the members who purchased those would review them? Dolores has also submitted an article for TI*MES on her music programs- watch out for it.
Bringing over a couple of boxes of disks for sale, she had to pay VAT at the airport on the retail value, and was promised a refund on any unsold, on exit. On leaving the UK, she got a non-English speaking Indian customs officer, who took her receipt and was never seen again. When you have a Jumbo waiting for you you are not in a position to hang around!
This is a program which allows you to mix text and pictures on a page AND SEE THEM BOTH ON YOUR TV SCREEN together! There are a few limitations- the fonts and pics have their own format, but can be converted from TI Artist Fonts and pics. The most significant limitation for me is that fonts MUST either 8x12 or 16x24 pixels.
Why is this a limitation? The standard 40 column screen used by TI Writer is based on characters 6x8 pixels. The standard 8O column printer also uses a standard character definition of 6 pixels width, so using PagePro you become limited to a maximum of 60 characters from page edge to page edge- not too had for a flyer or advert or if you have little to say, but a bit of a loss when you wish to cram a lot of information into a small space!
Apart from that the program is remarkably easy to use. One other limitation- for best effect all characters should be centred in the 8x12 block, otherwise the printed effect can look- perfectly illustrated in the manual- like this:
LOADI NG I NSTRUCTI ONS
No, there are no spaces after the I's, it's just that in TI Artist format they are firmly placed at the extreme left of the 8x12 block, leaving rather a lot of nothing after them! It's up to you to reposition the characters before you translate them to PagePro format!
PagePro has line wrap but not word wrap, perhaps making hyphenation a little easier! Import of DV80 text is possible WITH CARE.
Not an expensive program at around US$25 or so, and certainly the fastest in its field if you wish to mix text and graphics.
The first program is a variation on a program I submitted in several formats for the last issue. This one uses two very slightly ditferent forms of the basic function, and sets the variables at random. Scaling to the screen is automated and is based on the first two hundred points plotted.
The second program produces some interesting images, far more complex than the code may imply- a tree, a fern, a Serpinski triangle. and a black square.
The square is of interest as depending on how many iterations you allow, that sets the density of the square (try it). Kicking in the random probability subroutine will demonstrate how to turn the black solid square into a set of patterns- one particular set of probabilities will give you a straight Serpinski Triangle! The routines For Q=5 and Q=6 are also squares, but the images are derived with (5) different base data and (6) preset different probabilities.
Instead of allowing random operation you can of course input data as you see Fit. The CALL LINK("DUMP") is a machine code routine for Myarc XB which is available from the disk library which allows you to dump a Myarc XB bit map screen to an Epson printer via PIO.
1 ! for MYARC XB FRACTAL PROG 1
2 ! EXPLORING THE MARTIN SET
3 ! from Dr Barry Martin, Aston University
4 ! with alternate sub set from J de Riva
5 ! Stephen Shaw UK 1989
20 ON ERROR 10000
40 RANDOMIZE
60 CALL GRAPHICS (3)
80 Q= INT(RND*2)+1
100 CALL WRITE(1,24,28,STR$(Q))
120 ON Q GOTO 1000,2000
1000 REM
1020 A=(RND*5000-RND*5000)*RND*RND :: B=15*RND*RND*RND :: C=(RND*5500-RND*5500)*RND*RND
1040 CALL WRITE(1,2,3,STR$(A),2,9," "&STR$(B),2,18," "&STR$(C))
1060 X,Y=0
1070 GOSUB 5000
1080 FOR L= 1 TO 8000+INT(RND*5000)-(FLAG=1)*5000
1100 CALL POINT(1,INT(X*XS+XO),INT(Y*YS+YO))
1120 XX=Y+SGN(X)*SQR(ABS(B*X-C)):: Y=A-X :: X=XX :: NEXT L :: GOSUB 12000 :: RUN
2000 REM
2020 A= (RND*4000-RND*4000)*RND*RND :: B=15*RND*RND*RND :: C=(RND*3000-RND*3000)*RND*RND
2040 X,Y=0
2050 GOSUB 6000
2060 FOR L= 1 TO 8000+RND*6000-(FLAG=1)*5000
2080 CALL POINT(1,INT(X*XS+XO),INT(Y*YS+YO))
2100 XX=Y-SGN(X)*SQR(ABS(B*X-C)) :: Y=A-X :: X=XX :: NEXT L :: GOSUB 12000 :: RUN
5000 CALL WRITE(1,12,2,"one moment..."):: FOR L=1 TO 200
5010 GOSUB 9000
5020 XX=Y+SGN (X) *SQR (ABS (B*X -C)):: Y=A-X :: X=XX :: NEXT L :: GOSUB 9500
5030 CALL WRITE(1,12,2, " ") :: RETURN
6000 FOR L=1 TO 200
6010 GOSUB 9000
6020 XX=Y-SGN (X) *SQR(ABS(B*X-C)) :: Y=A-X :: X=XX :: NEXT L :: GOSUB 9500 :: RETURN
9000 REM SUB SCALE
9001 CALL WRITE(1,14,4, "WORKING. . . ")
9002 MINX=MIN(MINX,X) :: MAXX=MAX(MAXX,X) :: MINY=MIN(MINY,Y) :: MAXY=MAX(MAXY,Y)
9004 SUMX=SUMX+X :: SUMY=SUMY+Y :: RETURN
9500 AVX=SUMX/200 :: AVY=SUMY/200
9505 SX=MAXX-MINX :: SY=MAXY-MINY
9510 CALL WRITE(1,14,4," ")
9520 XS=(192/SX)*0.5 :: YS=(256/SY)*0.5
9521 IF XS+YS<0.6 AND XS+YS>0.35 THEN XS=XS*1.4 :: YS=YS*1.4
9525 XO=96-AVX*XS :: YO=128-AVY*YS
9526 IF XS+YS<0.44 THEN XS=XS*3 :: YS=YS*3 :: FLAG=1
9600 RETURN
10000 ON ERROR 10000
10001 RETURN NEXT
10002 END
12000 ! ONLY IF JD/OBJ UTILITY IS LOADED
12001 ! CALL LINK("DUMP",0,16)
12002 OPEN #1:"PIO" :: PRINT
#1:"A=";A:"B=";B:"C=";C:"XS
=";XS:"YS=";YS:"XO=";XO:"YO=
";YO: : : : CLOSE #1
12003 RETURN
20000 END
1 ! MYARC XB FRACTAL PROG 2
2 ! SQUARE TRIANGLE TREE AND
3 ! FERN using Random Iter-
4 ! ation AlGorithm
5 ! From FRACTALS EVERYWHERE
6 ! by Michael Barnsley
7 ! SPIRAL from FRACTAL
8 ! REPORT 2, Keith Wood
9 ! Q=8 by S Shaw
10 ! Stephen Shaw UK 1989
100 RANDOMIZE
110 ON ERROR 780
120 CALL GRAPHICS(3)
130 Q=INT(RND*8)+1
140 IF Q>4 AND Q<7 AND RND>0.5 THEN 130
150 ON Q GOTO 160,170,180,19
0,200,210,220,230
160 RESTORE 240 :: GOTO 320
! TRIANGLE
170 RESTORE 250 :: GOTO 320
180 RESTORE 260 :: GOTO 320
190 RESTORE 270 :: GOTO 320
200 RESTORE 280 :: GOTO 320
210 RESTORE 290 :: GOTO 320
220 RESTORE 300 :: GOTO 320
230 RESTORE 310 :: GOTO 320
240 DATA 0.5,0,0,0.5,1,1,0.3
3,0.5,0,0,0.5,1,50,0.33,0.5,
0,0,0.5,50,50,0.34,,,
250 DATA 0.5,0,0,0.5,1,1,0.2
5,0.5,0,0,0.5,50,1,0.25,0.5,
0,0,0.5,1,50,0.25,0.5,0,0,0.
5,50,50,0.25
260 DATA 0,0,0,0.16,0,0,0.01
,0.85,0.04,-0.04,0.85,0,1.6,
0.85,0.2,-0.26,0.23,0.22,0,1
.6,0.07,-0.15,0.28,0.26,0.24
,0,0.44,0.07,,
270 DATA 0,0,0,0.5,0,0,0.05,
0.42,-0.42,0.42,0.42,0,0.2,0
.4,0.42,0.42,-0.42,0.42,0,0.
2,0.4,0.1,0,0,0.1,0,0.2,0.15,,
280 DATA 0,0.5,0.5,0,0,0,0.2
5,0.5,0,0,0.5,0.0.5,0.25,0.5
,0,0,0.5,0.5,0.5,0.25,0,-0.5
,-0.5,0,1,0.5,0.25,,,
290 DATA 0.5,0,0,0.5,1,1,0.1
,0.5,0,0,0.5,50,1,0.2,0.5,0,
0,0.5,1,50,0.3,0.5,0,0,0.5,5
0,50,0.4,,,
300 DATA 0.846,-0.308,0.308,
0.846,0,0,0.9,-0.163,-0.163,
0.163,-0.163,1,-1,0.1,0,0,0
,0,0,0,0,0,0,0,0,0,0,0,,,
310 DATA 0.45,0,0,0.45,0.55,
0,0.25,0.45,0,0,0.45,0,0.55,
0.25,0.45,0,0,0.45,0.55,0.55
,0.25,0.45,0,0,0.45,0,0,0.25,,,,
320 FOR Z=1 TO 4+(Q=1)
330 READ A(Z),B(Z),C(Z),D(Z)
,E(Z),F(Z),POSS
340 P(Z)=P(Z-1)+POSS :: NEXT Z
350 IF RND<0.15 THEN GOSUB 590
360 REM
370 CALL WRITE(1,1,12,STR$(Q))
380 IF Q=6 THEN Q=2
390 X,Y=0 :: NUMITS=10000
400 FOR N=1 TO NUMITS
410 REM
420 REM
430 K=RND+0.00000001
440 IF K<P(1) THEN K=1 :: GOTO 480
450 IF K<P(2) THEN K=2 :: GOTO 480
460 IF IF K<P(3) THEN K=3 :: GOTO 480
470 K=4
490 REM
490 REM
500 NEWX=A(K)*X+B(K)*Y+E(K)
510 NEWY=C(K)*X+D(K)*Y+F(K)
520 X=NEWX :: Y=NEWY
530 IF DX>390 OR DY>390 THEN RUN
540 IF N<11 THEN 570
550 ON Q GOSUB 710 ,720,730,740,750,750,760,770
560 CALL POINT (1,DY,DX)
570 NEXT N
580 CALL SOUND (200,200,1) :: CALL LINK("DUMP",0,16) :: RUN
590 REM DIFFERENT PROBABILITIES- RANDOM
600 P(4)=1
610 IF Q=1 THEN P(3)=1 :: GOTO 640
620 P(3)=P(4)-RND*RND
630 IF P(3)<0.2 THEN 600
640 P(2)=P(3)-RND
650 IF P(2)<0.15 THEN 600
660 P(1)=P(2)-RND
670 IF P(1)<0 THEN 640
680 CALL WRITE(1,24,8,"RANDOM PROBABILITY")
690 RETURN
700 STOP
710 DX=X*2+40 :: DY=Y*1.92 :: RETURN
720 DX=X*1.3+40 :: DY=Y*1.3+50 :: RETURN
730 DX=X*40+120 :: DY=193-Y*19+5 :: RETURN
740 DX=120-X*250 :: DY=200-Y*380 :: RETURN
750 DX=X*150+60 :: DY=Y*150+30 :: RETURN
760 DX=190-X*98 :: DY=80-75*Y :: RETURN
770 DX=X*160+30 :: DY=Y*160+25 :: RETURN
780 ON ERROR 780 :: RETURN NEXT
790 END
A good read for the computer literate, it also gives some ideas for programs to play with- with the emphasis on recreational programs rather than games or utilities. Very interesting reading.
This is the book recommended for LISP99, and is based on MacLisp, as is LISP99 (available from your user group library!). An excellent introduction both to Lisp and to Lisp 99, easy to follow, apart from an awkward Chapter 0, and maybe a different approach to Chapters l and 2.
Start with Chapter 3 with Lisp 99 loaded and ready! Only a chapter towards the end- Chapter 11 on Property Lists- is of no value with Lisp99.
Lots of exercises, WITH ANSWERS!
All inputs to LISP99 are in ROUND BRACKETS, as shown in the book eg:
(DEFUN DOUBLE (Y) (MULT 2)) defines function DOUBLE
(DOUBLE 5) gives the output then of 10.
Lots of exercises but NO answers! My printer won't go anywhere near duplicating some of the math symbols used, whose names I do not know, but understanding the math can be left until after you have thoroughly explored the listings, there is so much to consider that even if only a little of the theory sinks in, you have greatly advanced your logical or mathematic thinking!
Don't worry about things like "The random iteration algorithm is founded in ergodic theory"- it paints a pretty picture!
This one has a foreword and a chapter by Mandelbrot himself, but also chapters by others extending well beyond the famous Mandelbrot set. This book is rather based upon the idea of looking at something and then determining a fractal approach to imaging it - not such light reading! but some very interesting colour plates. There are lots of algorithms presented as well, which appear to be in Pascal or a similar language.
The math is much heavier than in Barnsley's book, with section headings such as "The spectral representation of random functions". Some interesting information in here though- watch out for fractal images in STAR TREK 2 next time you see it- watch for TINY triangles forming the image!
Escher, the graphics artist, made use of fractals for some of his designs .... there is also a chapter on having an eye for fractals when taking photographs. This is a book for the more dedicated fractalist.
TI Base is a CLOSE approximation of the old database language called dBase II, and although most books are now on dBase IV plus, there remain a couple of books on dBase II around still. At present TI Base lags behind dBase II in not having a report-form capability and only limited screen set up commands- no form creating commands such as PICTURE.
The CHEAPEST book is:
WORKING WITH dBASE II. M de Pace. BSP Professional Books. Paperback. 175 pages incl index. ISBN 0-632-02305-8. About Pds 10
Despite the differences between dBase II and TI Base, this book gives a useful introduction to creating and using databases in this type of environment. It is interesting to see that TI Base has more math operators, but fewer functions.Go to top of page
Well worth your consideration:
UNDERSTANDING dBase II. Alan Simpson. Sybex. 260 pages incl index Paperback. ISBN 0-89588-147-0. About Pds 22.
Quite a bit costlier, but I think its rather a better read, with clearer lay out and progression. This is my preferred book.
Incidentally- the TI 99/4A uses DSK1 where the rest of the world uses B:, so if you see USE B:MAIL, on the TI you would type USE DSK1.MAIL
The disk library has a four disk set of TI Base tutorials by Smoley, with sample databases and command files, which is more relevant than any book, and a lot cheaper!
ARTISTiek: Bron: KIJK Nr 10 okt 1987. Auteur:Gi1bert Stokman
Orgineel:MSX
FOR X=0 T0 250 STEP 5
A=X/1 B=X+A SET X X TO B 180-X
SET 256-X X TO 256-B 180-X
C=X/2 SET 125 X TO 125-C 192
SET 125 X TO 125+C 192
NEXT X
STOP
---------
ATARI grafisch Bron KIJK No 8 aug 1996 Auteur: Arvid Riem Lelystad
Orgineel Atari 8OOXL (Kleuren veruijdert).
B=0
FOR L=1 TO 79
SET L+90 B TO 160-L B
SET L+90 B TO 160-L 190-B
SET L+90 190-B TO 160-L 190-B SET L+90 190-B TO 160-L B
B=B+6 IF B>190 THEN B=0
NEXT L
STOP
----------
ESCHER Driehoek van H C Escher Bron KIJK Nr 10 Oct 1968
Auteur Roy van Ginkel uit Zutphen
SCREEN 5 COLOR 1
SET 75 139 TO 92 150 TO 185 97 TO 185 72 TO 92 21 TO 75 30 TO 75 139
SET 92 150 TO 92 62 TO 132 87 TO 110 100 TO 110 119 TO 185 72
SET 132 87 TO 151 76 TO 151 76 TO 75 30
SET 110 100 TO 110 74
STOP
LOGO ROUTINES : with apologies to the original author whose name has become detached (sorry):
TO DRAWIT
TELL TURTLE HT CS CB 10 SC 13
SXY -42 -42 PD
LT 30 REPEAT 3 [LLL RT 60]
END
TO LLL
FD 5 RT 60 FD 100 RT 120 FD 85
RT 120 FD 15 RT 60 FD 55 LT 120 FD 85 RT 120 FD 15
RT 60 FD 100
END
I had a variable (A) that could only be either 9 or 7. I needed to separate the beginning of a string. If A was 9, I needed the first 5 characters in the string, otherwise I needed the first 4 characters.
My first approach was:
IF A=9 THEN N$=SEG$(A$,1,5)
ELSE N$=SEGS(A$,1, 4)
That seemed bulky so I tried this:
N$=SEG$(A$,1,5+(A=7))
This works because if A is 7 the expression (A=7) returns -1. Otherwise it returns 0. If this is not clear, try this loop:
FOR A=6 TO 8 :: PRINT A;A=7;5+(A=7) :: NEXT A
Note that the parenthesis are only needed for 5+(A=7). Without them, your TI would compare 5+A to 7.
Back to my tip. That was better, but I did a bit of fiddling and realised that 0.6 times 9 is 5.4 and 0.6 times 7 is 4.2. I tried this:
N$=SEG$(A$,1,INT(A*0.6))
Then I wondered if the INT was needed. It turns out that SEG$ (like many TI functions) automatically rounds off.
How can you tell if a function rounds? Try using it in a loop:
FOR J=1 TO 2 STEP 0.1
My final expression was N$=SEG$(A$, 1 ,A*0.6)
PRINT I;SEG$("ABC",1,J)
NEXT J
(We started out with IF A=9 THEN N$=SEG$(A$,1,5) ELSE N$=SEGS(A$,1, 4))
His code was along the lines of
WHILE RESPONSE="Y"
Repeated processing of this type of code was resulting in an error message:
INPUT PROCESS
WRITE X,Y "ANOTHER?"
READSTRING RESPONSE
IF RESPONSE="N"
CLOSE DATA
RETURN
ENDIF
ENDWHILE
'too many if while or case levels'
How too many levels- only one surely? One WHILE/ENDWHILE and one IF/ENDIF no? NO! Actually too many whiles under certain circumstances!
Basic is unique in computer languages in that it allows you to get away with code like this:
100 FOR T=1 TO 1000
in any other language- including the TI Base command language, this would spell disaster. The general rule of programming is that you do not jump out of a conditional loop until the condition is met.
110 CALL KEY(1,A,B)
120 IF B=1 THEN 140
130 NEXT T
140 PRINT "DONE";T
In the Basic code above we can do this by adding:
120 IF B<>1 THEN 130
TI Basic requires rather more jumping about as the IF...THEN construct will only permit jumps and not commands.
125 PRINT "DONE";T
126 T=1000
Extended Basic is a little better - professional programmers don't like too much jumping about, and would prefer:
100 T2=1000 :: FOR T=1 TO 1000 :: CALL KEY(1,A,B)
This is why so many professional programmers now rather look down their noses at Basic.
110 IF B=1 THEN T2=T :: T=1000
120 NEXT T
130 IF T2<1000 THEN T=T2
140 PRINT "DONE";T
Even Extended Basic can shun the early loop escape in some circumstances-
GOSUB can provide us with a Basic example:
100 GOSUB 1000
if you run this, you will after a little while of not pressing any keys, receive the Basic equivalent message to the one you are getting with TI Base - each GOSUB is remembering where you jumped from, and unless you exit with a RETURN, you just keep remembering more and more return addresses until...
110 END
1000 FOR T=1 TO 1000
1010 CALL KEY(1,A,B)
1020 IF B=0 THEN 100
1030 NEXT T
1040 RETURN
I really have seen quite a lot of programs coded like that last bit of code!
TI Basic actually clears the T flag when you jump out- other languages won't, they will keep waiting for the condition to be met, and if the code is processed frequently, memory will quickly go!
That Basic allows the first form, and teaches a method inapplicable to any other form of programming, has resulted in Basic receiving a lot of criticism from professional programmers. TI went a long way to meeting criticisms by offering in ExBas sub-programs with local variables- long before Acorn thought of it!
The first bit of code should be configured as below- we do not jump out of conditional WHILE loop until the condition is met..
WHILE RESP="Y"
If you compare this to the first form. you will see it does the same thing. but actually uses the test in the WHILE. And as we only leave the WHILE loop when the condition is met. you don't eat up memory by nestinq WHILE loops when you don't need to! (The code is also shorter).
INPUT PROCESS
WRITE X ,Y "ANOTHER? "
READSTRING RESP
ENDWHILE
CLOSE DATA
RETURN
This is one case where early experience with TI Logo would have helped, as that would rapidly have taught the perils of iteration ( that's the technical name for going around in circles!). TI LOGO actually counts the levels as you go down...