Jump to:
Basic Programming: Solving apples and pears problems | |
Call Sound inaccuracy | |
Practical programming: playing with digits
Extended Basic very fast colour changing | |
Writing your own Extended Basic subprograms with samples
TI writer (and Funlwriter) tips
Graphics Demo programs:
Peter Maurer Rose Curves | |
Lisajou Curves and the G language | |
Barry Martin's Mapping, Hopalong
Chairmans Farewell
Reports on: Bloxwich Workshop April 1989 | |
Alternative Micro Show April 1989
Review: Triton Super Extended Basic | |
Triton SXB program to print TI Artist pictures
This web page contains the text of articles for owners of the TI-99/4a from Issues 24 and 25 of TI*MES. It is of use to users of the TI-99/4a emulators.
The editorial this time is taken up by a summary of the decisions of a meeting of the Committee on 14.2.89 to keep you in touch with developments in the operations of our Group.
Probably the most significant is the search for a new Chairman! Clive Scally is most definite in his resolve to give up this post, owing to new and pressing commitments, including periods in the USA. Other Officers of the Committee are already fully occupied with their special functions, and we must find ourselves a new Chairman at the AGM.
We will also of course be taking the opportunity of expressing the gratitude of all of us to Clive and Audrey for all the efforts that have gone into keeping the Group alive all these years. We hope that Clive will remain a member of the Committee.
by Peter Walker
A foray into the mathematics of integer arithmetic. This is designed to show how even console Basic can be used to solve what appears at first to be a difficult problem.
Consider the two following problems:
A man buys 7 bags of apples and 11 bags of pears, which gives him 140 items of fruit in all. How many apples in each bag, and how many pears?
A man sells theatre tickets at 5.50 for adults and 3.45 for children. He takes 160.25 in all. How many adult tickets and how many child tickets were sold?
The first problem can be algebraically represented by the formula:
7x + 11y = 140
Similarly the second can be represented as:
550x + 345y = 16025
Now in each case we have 2 variables but only one equation. Classical simultaneous equation theory says that these cannot be solved, since an infinite number of (x,y) pairs will satisfy the equation. However, we have the additional proviso that x and y must be integers. There will in fact be a finite number of solutions where x and y are positive integers. This sort of puzzle is quite common in magazine and newspaper quizzes since the method of solution is not taught in schools and is rather obscure. Below is a console Basic program to solve the integer equation of the form:-
Ax + By = c
For many of you, the program will be enough to satisfy you. I haven't got room to give a full mathematical treatise here but the following may assist the more mathematically minded or those who wish to follow the program logic.
These integer equations are known as Diophantine equations. The solution is found by first creating the continued fraction of the ratio A/B. (Array CF holds this). The two residue numbers D and E are found from the continued fraction less the last element. The residues have the important property that they satisfy the equation:
A * D - B * E = G
where B is either + or - 1, if A and B share no common factors (Co-Prime) or is equal to the Highest Common Factor of A and B if they do.
We can then write
A*D/G -B*E/G = 1
and
A*D*C/G -B*E*C/G = C
All we now need to do is to convert this into the form of Ax + By = C by changing the multiples of A and B. We thus find an integer or integers L which allow:
A*(D*C/G-L*B/G) + B*(L*A/G -E*C/G) = C
Valid solutions are those where the value of L makes both multipliers of A and B positive. The other requirement for a solution is that if A and B do have a common factor (ie G<>1) then this must also be shared by C.
I hope you enjoy this
PJW
100 CALL CLEAR
110 DIM CF(5O)
120 PRINT "TO SOLVE AX + BY = C"
130 INPUT "A? ":A
140 IF (INT (A)=A) *(A>1) THEN 170
150 PRINT "POSITIVE INTEGERS ONLY (A>1)"
160 GOTO 130
170 INPUT "B? ":B
180 IF (INT(B)=B)*(B>1)THEN 210
190 PRINT "POSITIVE INTEGERS ONLY (B>1)"
200 GOTO 170
210 INPUT "C? ":C
220 IF (INT(C)=C)*(C>1 ) THEN 250
230 PRINT "POSITIVE INTEGERS ONLY (C>1)"
240 GOTO 210
250 D=A
260 E=B
270 FOR X=1 TO 50
280 CF(X)=INT(D/E)
290 F=E
300 E=D-CF(X)*E
310 IF E=0 THEN 360
320 D=F
330 NEXT X
340 PRINT "NOT ENOUGH SPACE"
350 STOP
360 D=1
370 IF X=1 THEN 450
380 E=CF(X-1)
390 F0R X=X-2 TO 1 STEP -1
400 F=D
410 D=E
420 E=D*CF(X)+F
430 NEXT X
440 GOTO 460
450 E=A/B-1
460 G=A*D-B*E
470 IF G*INT(C/G)<>C THEN 680
480 H=D*C/B
490 I=E*C/A
500 IF H>I THEN 520
510 GOTO 550
520 K=H
530 H=I
540 I=K
550 IF INT(H)+1>=I THEN 660
560 PRINT :"SOLUTIONS ARE "
570 FOR L=INT(H)+1 TO I
580 IF L=I THEN 620
590 M=D*C/G-L*B/G
600 N=L*A/G-E*C/G
610 PRINT A;"*";M;"+";B;"*";
N;"=";A*M+B*N
620 NEXT L
630 PRINT
640 GOTO 120
650 PRINT
660 PRINT "THERE ARE NO SOLUTIONS"
670 GOTO 630
680 PRINT
690 PRINT A;"AND";B;"SHARE "
;SQR(G*G);"AS A COMMON FACTOR. ";C; "DOES
NOT, SO THERE IS NO SOLUTION".
700 GOTO 630
Letter- from the reTIring Chairman:
When the TI99 Home Computer was readily available in most major shops during the start of the Eighties, for some reason or other, the TI99 never really was a popular machine. I had my suspicions, that the main reason was the unique TI Basic and the strange policies Texas Instruments adopted in preventing software companies producing software. This led to its downfall as the Home computer Market at that time started to hot up. Texas Instruments was forced into a price war with massive reductions being sliced off the 1000 pounds price tag (Which Babbling Brooks keeps reminding us when he bought the TI99 for around the same price).
By 1983 the price of a T199/4a dropped to under two hundred pounds, well below its original price, thats when Audrey and myself became a TI99er. ARGOS the discount retail chain were giving 50 pounds off its stocks. The Home computer war had started and by the end of 1983 the TI99/4a reached the top five best selling home computers.
Despite its short popularity, software was very difficult to obtain cheaply and computer magazines shunned the TI99 because of the TI Basic language, it was thanks to the efforts of people like Stephen Shaw, Peter Brooks and others (including a neighbour of ours called Vince Apps) who wrote to the popular magazines and had written books that we saw any programmes published.
Sheer frustration of the high cost of Modules (TI call solid state software cartridges) that Audrey and myself set up a small service in providing a facility of exchanging modules for members of a National newsletter Club known at the time as "TI HOME".
The service was called T199/4a EXCHANGE. We were amazed of its popularity, a number of TI Users liked the idea of exchanging and soon we had nearly two dozen people regulary swapping modules.
Because of the simple idea, we were put under some pressure to produce a newsletter, the idea was to offer fairly basic BASIC editorial with simple hints, Tips and programs to type in was mainly because TIHOME really only catered for those with expansion. With an old typewriter which I purchased from a neighbour for GBP 30, and some weeks of head scratching, Britain's other TI99/4a newsletter was born. It was given a name TI*MES.
As an A5 publication with 24 pages the name TI*MNES was created from what the club did:-
T exas I nstruments 99/4a * (used as times/multiply in computing) M odule E xchange S ervice.
Everyone knew of a newspaper in the country with the same name. Rather clever we thought and its still with us today as is that newspaper.
TI*MES was a creation of its users and these who made a living from the sale of hardware accessories and software (home made in the UK). Even Books, we wanted to help and promote British goods for a Yankie computer. Thanks to all its supporters, TI*MES quickly grew to a thick 60 page magazine.
With the decline and fall of TI99/4a not being produced, oddly just when plenty of cheap software was emerging from the UK and overseas, times were quickly achanging. Those of this group who joined at the start can pick up the early copies of TI*MES and follow a whole line of events as the years passed. On May 16th in the year of 1987, a full committee was elected to serve the UK T199/4a Users far better than ever before.
Christina Mehew took on the task of Editor of TI*MES, in her words; and I quote "A Future Flowering". At long last the TI Users have come together. Now, TI*MES has a new Editor, Alan Bailey, because he has not expanded he is sincerely equally anxious to ensure not just those with expansion are served, but catering for all TI Users both in the U.K. and overseas.
Suported by working Group, TI*MES has become the only survivor of the Eighties that has been consistant in producing the goods its members expect. With a truly fantastic membership and strong dedicated committee, (Oh how can I thank them enough), TI*MES is well and truly united as the TI 99/4a Users G roup in the U K.
New ideas and a new incoming Chairman leading a super committee will see TIUGUK well into the Nineties.
Please continue with your support as I leave with no regrets the running and control its very capable working committee led by the new Chairman of your choice.
Rest assured I will still be a 99er in the 90s and a keen supporter of TIUGUK and TI*MES.
Happy TI ing! Clive Scally.
In issue 25: Summer 1989: Welcome to new member Mark Wills.
CALL SOUND does NOT produce a frequency with the tone you input! and SOME 'musical' tones are impossible, leading to music which even the tone deaf can recognise as being UGH!
Example:
CALL SOUND(100,1657,0) will produce a note with EXACTLY the same frequency as CALL SOUND(100,1681,0). Any frequency between these also produces the same note.
Example 2
CALL SOUND(99,1661,0) should he note G sharp. It is 10% more sharp than it should be, while the next note:
CALL SOUND(99,1760,0) which should be A. is 15% flat- the period between the two notes is 25% out!!!
The rate of error grows as the frequency rises, due to the way in which the sound chip works. However even a few low frequencies are fairly way out, as D sharp (156 Hz), F (175 Hz) and A (220 Hz) are all 5% sharp.
SO, if you hear a 'bum' note in a music program, it might not be the programmer at fault, but rather the sound chip.
Now titled: The National TI Users Workshop VI, organised by the West Midlands TI User Group and supported by ITUG.
Your reporter made his second Bloxwich visit on April 15th, after attending the first show some time ago, the intermediate absence being more due to lack of transport than anything else, and thanks Bill for the lift down.
This sixth Bloxwich meetinq of TI Users was attended by about 25 users, and several rigs were in use, including two Geneves (the only two in the U.K.??), which were showing off their paces, including the coloured tiger and a super super (jet propelled) lines program runninq in native mode.
Also on display and demonstration were Myarc XBII, Mechatronic 80 column peripheral with 80 column Funlweb and Multiplan, Horizon Ram Disks, and a demo of a new TI only bulletin board (The After Hours National TI Users Bulletin Board. 2.5 Meg of downloads- more information has been requested and will be passed on when received).
As usual, the Bloxwich meetinq was also attended by a small handful of Cortex users- the Cortex if you can remember, beinq a home-built computer using the 9900 chip and TI 'Power Basic'.
Of some interest were the scrapyard refugees- two disk drives wrenched from a discarded computer thrown into a dustbin- one drive requiring just a dab or two of superglue and some jumper wires, the other perfect. Also a 10 Meg hard drive dug up from some Irish bog where it had suffered the fate of disposal in a landfill (as, we understand. a number of TI modules suffered- Rhode Island way). With two plattens, one was unusable but the other perfect, making a workable 5 meg hard disk running on the Myarc HDC.
Your reporter enjoyed seeing for the first time a full and complete version of Wing War, and in a module at that. I gather that as with so many unreleased modules it is available to Gramkracker owners on disk, but I don't have one of those devices!
Showing on the Geneve was a specially adapted version of Ray Kazmer's Xmas Demo with little Woodstock receiving his present- modified for the different speed at the Geneve, and looking absolutely brilliant on the colour monitor.
There was a Miller Gramcracker present, and also a similar device produced by the Cologne User Group in Germany.
Some readers may have heard of the Sinclair Z88 portable computer, which is just A4 sized, runs on alkaline batteries, has an LCD display, and comes with terminal emulator and word processing software on board. It was shown connected to a TI99/4A, swapping text back and forth, using TELCO on the TI99/4A. It was also demonstrated in use as a 'dumb' terminal, which I gather makes it very handy for Geneve owners, who need one for debugging purposes, as the Geneve can be debugged without interfering with its own screen display, by using a 'remote' dumb terminal!
An unusual and eye catching display, generated on a TI99/4A using Myarc XBII and the clock in the Myarc HDC, was a high resolution picture of an analogue watch, with the hands drawn (and redrawn) by Myarc XB after reference to the clock device in the HDC... extremely impressive.
Thanks to Gordon Pitt for arranging the event
Stephen Shaw April 1989
The show was held on Saturday April 1st. in the New Horticultural Hall in London.
The Hall is in a part of London which managed to be both very quiet and yet handy for public transport- your author, arriving at Euston at 9.30 am managed to get a Tube to Victoria and walk to the Hall in time to arrive by 10 am!
Given the Capital location, and the larger number of orphaned machines covered at this show, I was expecting a horrendous crush, which did not turn out - possibly connected with the almost total lack of publicity which the first show also suffered from. The aisles were wide and the stalls large (12 feet) so ample room for all.
Machines supported this time included almost everything apart from PC's, Amstrads and Amigas- the list included : TI99/4a, Coleco Adam, Atari 8 bit, Sinclair QL, Electron, Tatung Einstein, Jupiter Ace, MSX, Commodore 8 bit, Dragon, and possibly a few others... the TI99/4a managed a remarkable representation with FOUR stands, taken by TI Users Group (U.K.)., the East Anglia Region 99ers, Dorset TI Group, and a 'commercial' stall taken by the Parrish family, well known for former trading as Parco Electric.
There were cheap computers on sale (a second hand TI99/4a was snapped up on the bring and buy stall with speech synth and three modules for a mere twenty pounds), cheap printers from sixty pounds a piece, and plenty of cheap disks. The Konix Navigator joystick- superb joystick- was selling for a mere eight pounds, about half usual retail price.
The TI community representation was hit a little by motor troubles- one rig for the TIUGUK was stranded followinq a car break down, while the second rig for the East Anglia group was also well delayed by a car breakdown, finally arriving in tine for an early lunch!
Dortig had almost 100% of their members present and had brought along a Mechatronic 80 column card, so I was able to see the 80 column version of Funlweb at last! -the monitor used was a Tatung Einstein monitor, which usefully plugs directly into a UK model TI99/4A, as the Einstein used the same unusual colour-difference video output. Amongst much software Dortig were showing was Computer War and Slymoids.
East Anglia were playing TI Tennis, as well as Leather Goddesses of Phobos and the superb machine code game of Mancala, while TIUGUK were demoing TI Base and PR Base, as well as playing TI-TRIS and Micro Pinball.
TIUGUK also had both Mechatronic AND Triton versions of Extended Basic, able to show the graphics capabilities of each, and also showing off the graphics utilities EDP, DEP and XDB! A Horizon RAM disk was installed in the TIUGUK system.
TIUGUK tried to demo The Nutcracker Suite and the German Pop music program plus Bert and Ern speech demo - demo's using sound were badly affected by one stall holder who was selling keyboards, and using amplification more suitable to a major pop concert, giving all the other stall holders a bit of a pain in the... perhaps it was fortunate the organisers had changed their name and were thus attending in an entirely anonymous capacity... Ken Gilliland having sent a demo of his dinosaurs disks over, visitors were also duly impressed by Thug learning to fly.
Copies of Micropendium magazine sold out very quickly, as did the laminated keyboard function strips from SW99ers (good idea there, clearly a vast unsatisfied unexpressed need!)
Francis Parrish had a good range of the older modules and even some of the newer ones (eg Micro Pinball), and managed to shift some of the more unusual limited quantity items that just aren't worth advertising.
The only computer related clothing seen was worn by your scribe, a colourful Tex-Comp tee-shirt. and in the morning a 1989 TI-Fest cap, in the afternoon a "I Love my TI99/4a" cap.
Overall- the Show formed a good get-together for the TI user groups - anyone who heard of the Show will have been made aware that there was still life for the TI99/4A.
Your reporter offers apologies to under-reporting of the other TI Groups, as he was attending on behalf of TIUGUK.
From TopIcs, LA99ers:
For a heading on each page:
.HE Ctrl-U, shift "N", Ctrl-U (Enter title here) Ctrl-U, shift "T",Ctr1 U
For a numbered foooter
.FO^^^^^^^^^^^^^^^^^^^page%
And this reminder from Jack Sughrue, of IMPACT-99:
How many of you know you can use an "I" with the TAB instructions to automatically Indent each new paragraph? (I have used "L" and "R" for left and right margins, but was unaware of the Indent option).
I now use:
L on 1, I on 5, and R on 38
This sets the margins at the width of the screen, and indents each new para graph. You'l1 be able to read everything ON your screen - no more windowing.
AT&T have a graphic routine to demo their DMD5620 terminal. and Peter Maurer (a mathematician of AT&T) published the algorithm in The American Mathematical Monthly, Vol 94. pages 631 to 645. This was in turn picked up by Keith Devlin and published in The Guardian on June 2nd 1988.
Group member Mike Cavanagh passed the general algorithm to me. I have written versions in Myarc XB and Triton SXB. and these appear below. (Web note: There is a wikipedia article on the Maurer Rose).
Good values to input are: N=4, D=43 or N=5, D=97.
The code to 'draw' or 'line' etc is in the Form : X * SCALE + ORIGIN.
The listings use the same scale for X and Y axes, and may result in a squashed effect due to the way the UK TI99/4A display works- to unsquash just try reducing SLIGHTLY one of the scaling multipliers, until you get what you want! Can also be adjusted for odd effects for some plots!
Adjust the origin constant to move the whole image around the screen but watch you don't fall off the edges!
Some plots are utterly simplistic -possibly just a point!- while others can be remarkably complex, and all done with nothing but STRAIGHT LINES!
(These graphics programs answer a subtle request from a member for some graphics plotting related material!!! More? Do say...).
First code is for TI +Extended Basic + 32k ram + French graphics utility JBM103:
100 REM REQUIRES JBM103 LIBRARY DISK AND TI XB AND 32K RAM
110 CALL LOAD(-31890,56,0):: CALL LOAD(-31964,56,0)
120 CALL CLEAR
130 DISPLAY AT(5,1)" N=":" D="
140 ACCEPT AT(5,4)SIZE(3)VALIDATE(DIGIT):N :: IF N>359 OR N<1 THEN 140
150 ACCEPT AT(6,4)5IZE(3)VALIDATE(DIGIT):D :: IF D>359 OR D<1 THEN 150
160 A=0
170 NEWX=122 :: NEWY=92
180 CALL LlNK("CLEAR"):: CALL LINK("SCR2")
190 REM LOOP
200 A=A+D
210 A=(A/360-INT(A/360))*360 :: A=INT(A+0.0001)
220 X=N*A :: X=(X/360-INT(X/360))*6.283185307
230 REM STEP 3
240 R=SIN (X)
250 T=A*0. 0174532925
260 REM STEP 5
270 OLDX=NEWX :: OLDY=NEWY
280 NEWX=R*SIN(T)*86+122 :: NEWY=R*COS(T)*86+92
290 CALL LINK("LIGNE",l6,OLD
Y,OLDX,NEWY,NEWX)
300 IF A<0.01 THEN 320
310 GOTO 200
320 CALL KEY(0,K,S):: IF S=0 THEN 320 ELSE CALL LINK("SCRl"):: RUN
330 END
- - - - - - - - - - - - - -
This is the same program written for Myarc Extended Basic:
100 CALL GRAPHICS ( 1)
110 DEFINT N,D,A
120 DISPLAY AT(7,11)ERASE ALL : "N=" :: DISPLAY AT(9,11) : "D="
130 ACCEPT AT(7,13)5IZE(3)VALIDATE (DIGIT) : N :: IF N<1 OR N>359 THEN 130
140 ACCEPT AT(9,13)SIZE(3)VALIDATE (DIGIT) : D :: IF D<1 OR D>359 THEN 140
150 A=0
160 CALL GRAPHICS (3)
170 CALL POINT (0,122,92)
180 REM LOOP
190 A=A+D
200 A=(A/360-INT(A/360))*360
210 X=N*INT(A) :: X=(X/360-I
NT(X/360))*6.283185307
220 R=SIN(X)
230 T=A*0.0174532925
240 NEWX=R*SIN(T)*86+122 :: NEWY=R*COS(T)*86+92
250 CALL DRAWTO(1,NEWY,NEWX)
260 IF A<0.0001 THEN 280
270 GOTO 180
280 CALL WRITE(2,1,29,"ANY K
EY T0 CONTINUE")
290 CELL KEY (0,S,D) :: IF D<>1 THEN 290
300 RUN
- - - - - - - - - - - - - - - - - - -
The same program yet again but this time written for Triton Extended Basic:
100 CALL CLEAR
110 CALL LINK("GCLEAR")
120 DISPLAY AT(5,1):"N=":"D="
130 ACCEPT AT(5,3)VALIDATE(DIGIT)SIZE(3):N :: IF N>359 OR N<1 THEN 130
140 ACCEPT AT(5,3)VALIDATE(DIGIT)SIZE(3):D :: IF D>359 OR D<1 THEN 140
150 A=0 :: CALL LINK("MOVE",122,92)
160 REM LOOP
170 A=A+D
180 A=(A/360-INT(A/360))*360 :: A=INT(A+0.00001)
190 X=N*A :: X=(X/360-INT(X/360))*6.283185307
200 REM STEP 3
210 R=SIN(X)
220 T=A*0.0174532925
230 REM STEP 5
240 NEWX=R*SIN(T) :: NEWY=R*COS(T)
250 CALL LINK("DRAW",NEWX*86
+122,NEWY*86+92)
260 IF A<0.0001 THEN 2000
270 DISPLAY AT(12,2):A
280 GOTO 160
2000 CALL LINK("SHOW")
2001 RUN
5000 END
I took a look at this language, which does not seem to have made much of a splash outside Adelaide...
G is designed for fast bit-map graphics, in as simple a manner as speed allows. It comes complete with several sample programs.
To give you a feel for G, I am listing below a sample program, by Richard Earl of Adelaide, based on a lisajou program by Bob Warren. This program will plot on screen SIX plots simultaneously, and not too slow either.
For comparison, I have added a MYARC XB equivalent program, which does the same thing but very very much more slowly.
Comparing the two listings you will see that we have to do some things the hard way with Myarc, which like TI Basic uses something called radians for its trig instead of degrees, all I learned at school was degrees!!!
G=3
:START
WRAPON
A=64 B=48
C=192 D=144
J=3O E=128
SCREEN 1
F=F+1
RND 360 W
RND 7 I COLOR
FOR T=0 TO 360
LET M=J LET N=J
LET O=J LET P=J
COS F*T M
SIN G*T N
IF W>360 THEN W=0
COS G*W O
SIN F*W P
COLOR I+3
SET A+P D+O
COLOR I+4
SET A+M B+N
COLOR I+5
SET C+M B+O
COLOR I+6
SET C+P D+N
COLOR I+7
SET E+O B+N
COLOR I+8
SET E+M D+P
W=W+1
NEXT T
FDR L=1 T0 2500
NEXT L
CLS
CLS
GOTO : START
100 DEFINT A,B,C,D,E,T,G,F,W,I,R
110 Z=PI/180 :: R=30
120 CALL CLEAR :: CALL GRAPHICS(3) :: G=3
130 REM START - row(BD) and column (ACE) positions:
140 A=64 :: B=48 :: C=l92 :: D=l44 :: E=l28
150 CALL SCREEN(2)
160 F=F+l :: W=RND*360 :: I=RND*7
170 FOR T=0 T0 360
180 M=COS(F*T*Z)*R :: N=SIN(G*T*Z)*R
190 IF W>360 THEN W=0
200 O=COS(G*W*Z)*R :: P=SIN(F*W*Z)*R
210 CALL DCOLOR(I+3,1)
220 CALL POINT (1,D+0,A+P)
230 CALL DCOLOR (I+4,1)
240 CALL POINT(1,B+N,A+M)
250 CALL DCOLOR (I+5,1)
260 CALL POINT(1,B+O,C+M)
270 CALL DCOLOR (I+6,1)
280 CALL POINT(1,D+N,C+P)
290 CALL DCOLOR(I+7,1)
300 CALL POINT(1,B+N,E+O)
310 CALL DCOLOR(I+8,1)
320 CALL POINT(1,D+P.E+M)
330 W=W+1
340 NEXT T
350 FOR L=l TO 1600
360 NEXT L
370 CALL CLEAR
380 GOTO 140
390 END
We have in our disk library a program FRACTAL EXPLORER which allows you to plot and optionally print sections of the MANDELBROT SET, a specific form of Fractal Graphic. Fractal Explorer V3 disk image for emulators)
Readers of old may know that I have a habit of purchasing the first issue of just about every magazine going. This time I have really triumphed by obtaining Issue -1 (Release 7) of Fractal Report, a magazine which is intended to look at the various forms of fractals. Issue -1 gave a short program, slightly modified in Issue 0 pdf (article by Simon Goodwin), which produces interesting graphics, and I have given these listings below.
Note how relatively simple the repeated formula is- and then see how detailed the graphics are! The listings are in Myarc XB but can be modified for other languages which allow bit map graphics. The original formula from Dr Barry Martin was:
newx=y-sgn(x)*(abs(b*x*c))^.5
This is one robust formula. I have obtained interesting results using different initial values for x and y, using +sgn(x) instead of -sgn(x), using different values for b, using differing powers (eg ^0.4 instead of ^0.5) and even adding a divisor eg
newy=a-x
xx=y-sgn(x)*((abs(b*x*c))^.5)/2
You can really have fun with this one.
Update: Now I have a computer 900 times faster I can really explore this- to see a modern listing and lots of images take a look at one of my sdlbasic web pages.
Variables x and y are initially set at the plot starting point- see how small variations of these can modify the plot.
Variable a modifies the y axis and variable c modifies the x axis- variable b is a constant used in the formula, which modifies only x. The y plot is modified by the x value also.
The multiplier in the POINT command can be modified to produce a quick pattern which does not show later larger detail (high value) or to produce a pattern only after a long time (low value). A value of 10 seems about right for most plots.
Allow at least 30 minutes for a pattern to begin to stabilise. Few patterns will show much change after an hour (in Myarc XB). A pattern which appears to have stabilised may suddenly explode in a plague of measles....
The ON ERROR allows off screen plotting without crashing!
100 ! ALGORITHM BY DR BARRY MARTIN ASTON UNIVERSITY
Also see listing in next issue
110 ! Published in The Armchair Universe A K Dewdney 1988
120 ! Extracted from Fractal Report Issue -1 April 1989
130 ! For T199/4A by Stephen Shaw May 89
140 ! Written in Myarc Extended Basic
150 !
160 ON ERROR 280
170 CALL GRAPHICS(3)
180 a=1.01 :: b=1 :: c=0
190 REM
200 x,y=1
210 REM
220 CALL POINT(1,INT(x*10+95 ),INT(y*10+125))
230 REM
240 xx=y-SGN(x)*(ABS(b*x-c))^0.5
250 yy=a-x :: x=xx :: y=yy
260 GOTO 220
270 STOP
280 ON ERROR 280 :: RETURN NEXT
290 END
Long before Acorn put sub-program capability into the BBC-Micro, and told anyone who would listen that it was the first Basic with that capability, TI gave us this in EXTENDED BASIC. Not many users take advantage but here are some ideas for you to consider.
We are talking about the ability to write a program in such a way that you CALL up your own sub-programs, such as:
get the idea? You are well used to using CALL's as you use them all the time even in TI Basic, such as CALL CLEAR, CALL HCHAR, and so on! In Extended Basic you can write your own.
CALL SETUP
CALL INSTRUCT
CALL PLAY
CALL HIGHSCORES
For a very large selection you can do no worse than buy copies of Jim Petersons NUTS AND BOLTS disks, but in the meantime here is an excellent selection of routines for you from our member Peter Hutchison- many thanks Peter. (Jim Peterson's heirs released his collection into the public domain and you can download his Nuts and Bolts disks in PC99 format).
If you have a disk system, save each of these on disk in MERGE format and then just merge them into any program you wish to use then in.
CALL PUTAT
This command uses the whole screen (32 x 24) rather than the limited 28x24 used by DISPLAY AT.
CALL SAVECHAR / CALL LOADCHAR
Form: CALL PUTAT(row, column, string)
Sample use: CALL PUTAT(5,1,"HELLO TI USERS EVERYWHERE")
Code
27000 SUB PUTAT (R,C,T$)
27010 IF R<1 OR C<1 OR T$="" THEN SUBEXIT
27020 R=MIN(R,24) :: P=1
27030 IF R>=24 AND C>32 THEN PRINT :: R=24 :: C=1
27040 IF C>32 THEN R=R+1 :: C=1
27050 CALL HCHAR(R,C,ASC(SEG$(T$,P,1)))
27060 IF P>=LEN(T$) THEN SUBEXIT
27070 C=C+1 :: P=P+l :: GOTO 27030
27080 SUBEND
These commands will save the definitions of the characters 96 to 127 into an array PAT$ and then use the array to restore the definitions.
Examples: CALL SAVECHAR(PAT$()) and CALL LOADCHAR(PAT$())
Code:
27220 SUB SAVECHAR(PAT$())
30 FOR C=96 TO 124 STEP 4 :: EL=C/4-23 :: CALL CHARPAT(C,P$(EL)) :: NEXT C
27240 SUBEND
27250 SUB LOADCHAR(PAT$())
27260 FOR C=96 TO 124 STEP 4 :: EL=C/4-23 :: CALL CHAR(C,P$(EL)) :: NEXT C
27270 SUBEND
CALL HSCROLL
This command can he used to scroll text along a line on the screen
Form: CALL HSCROLL(row, column, length_disp1ayed, text$)
Sample: CALL HSCROLL(5,9,10,TEXT$)
Note: Text is limited by the system and the code below to a length of 240 chars!
Code
27300 SUB HSCROLL(R,C,L,H$)
27310 M$="-------"&H$&"-------"
27320 IF LEN(M$)<L THEN 27310
27350 FOR A=1 TO LEN(M$)-L+1
27340 DISPLAY AT(R,C)SIZE(L):SEG$(M$,A,L)
27350 FOR B=1 TO 15 :: NEXT B :: NEXT A
27360 SUBEND
CALL GET
This command will return the CHARACTER of the key pressed, or a nul if no Key is pressed.
Form: CALL SET (KEY$)
Code
27380 SUB GET (K$)
27390 CALL KEY(O,K,S)
27400 IF S=0 THEN K$="" ELSE K$=CHR$(K)
27410 SUBEND
This is not a particularly new product. carrying a copyright date of 1987, but I have only just bought one, and as no-one else seems to have reviewed it, here goes...
This is a standard beige module, and it replaces TI Extended Basic, with which it is compatible. New and altered features are listed below...
CALL VERSION returns 120.
CALL INIT is not required if you wish to CALL LOAD into the scratch pad ram addresses, and does not transfer unwanted data to 32k ram, as TI XB does!
LIST now enables printer output to be any width you wish, 28 to match screen. I found this useful for debugging a members program typed in from a magazine with a 41 column listing!
PERMANENT and RESEQUENCE have been deleted as no-one seems to use them, RES is still available and has been modified to enable you to resequence a PART of a program. You can also move, copy or delete blocks of lines. Resequencing or moving blocks will amend all line references throughout the program.
TRACE can now be sent to a printer.
The standard cursor is now an underline, and eight new cursor controls are available, using ESDX with FCTN and SHIFT, or with CTRL.
New CALLs:
CALL ALL quickly fills the screen with a designated character.
CALL ALOCK, CALL SHIFT, CALL FCTN and CALL CTRL all return a 0 or l depending on whether the relevant key is pressed- CAUTION there is a "bug" whereby pressing the FCTN key causes the other CALLS to SOMETIMES give false return values!
CALL CHIMES, CALL BEEP and CALL HONK may impress you
CALL CLOCK and CALL CLKOFF give you the usual interupt driven clock, in the top right hand corner, which assumes 60 interrupts per second and so runs slow outside the USA. The clock can be set/reset with a CALL LINK.
CALL CLSALL will close ALL open files (handy)
CALL COLORS will quickly change the colours of ALL character sets
CALL GOSPRT and CALL STSPRT will stop and start sprite motion, allowing you to set up a multiple-sprite image which does not tear apart as it starts moving.
CALL GOTO and CALL GOSUB allow you to use numeric variables for the line numbers- I really dont like this idea at all at all at all...
CALL RESTORE also allows numeric variables to be used for the line number
CALL KEYS is a really nice one. Let's look at an example:
CALL NEW and CALL BYE are fairly obvious! CALL RUNPROG allows the use of a string variable.
OLD TI XB:
100 CALL KEY(0,A,B)
110 IF B<>1 THEN 100
120 B=POS("ESDX",CHR$(A),1)
130 IF B<1 THEN 100
TRITON SXB:
100 CALL KEYS("ESDX",B)
Notice any difference?
CALL CAT to obtain a disk directory FROM COMMAND MODE ONLY is very useful
CALL PEEKV and POKEV read and write VDP ram, while CALL PEEKG reads GROM. There is also a POKEG should you have a module with GRAM (know of any???)
CALL QUITON and CALL QUITOFF fairly understandable
CALL SCROFF and CALL SCRON turn the screen display on and off
In addition, IF you have 32k ram, you can access a bit-map graphic utility, which is Quality Software's DRAW N PLO, actually built into the Module.
Set up is a little awkuard as you must use CALL FILES(2) rather than the default (3), but otherwise quite easy.
CALL DRAWNPLOT sets it up, and CALL LINK("SCLEAR") sets up memory for you.
You can then construct a picture in a pad area, using CALL LINK's to MOVE, DRAW, CIRCLE, SQUARE, LABEL. and then move the picture from pad to screen with SHOW
OR you can use your joystick to draw a picture by linking to EDIT, which gives a number of single-key press commands for clearing the screen, inputting text, drawing lines, squares and circles, filling shapes with black, toggle write/erase. From both SHOW and EDIT exit is by pressing key E
Pictures can be dumped to printer in two sizes.
Manual error here. Don't use PIO as suggested, but the more normal graphics "PIO.CR".
Pictures can also be saved and loaded to disk
EXTRA EXTRA EXTRA... READ ALL ABOUT IT
It is NOT mentioned in the manual. but the disk files are compatible with TI Artist, and you can scan a disk of TI Artist pictures (print then even) without loading any external programs. Here is the SXB program to do that:
a. Set up in command mode
CALL FILES(2)
NEW
CALL INIT
CALL DRAWNPLOT
CALL LINK("GCLEAR")
b. Now run this program
100 DISPLAY AT(4,2)ERASE ALL:"TI ARTIST FILE NAME?"
110 DISPLAY AT(6,6):"DSK1. _P"
120 ACCEPT AT(6,9)SIZE(-10) :A$
130 A$="DSK"&A$&"_P"
140 CALL LINK("GLOAD",A$)
150 REM PRESS E TO EXIT
160 CALL LINK("SHOW")
170 CALL COLORS(2,15)
180 PRINT "PRESS S TO PRINT SMALL PIC"
190 PRINT "PRESS L TO PRINT LARGE PIC"
200 PRINT 'PRESS C TO CONTINUE"
210 CALL KEYS("SLC",A)
220 ON A GOTO 300,400,500
300 CALL LINK("GDUMP","PIO.CR"):: GOTO 500
400 CALL LINK("LDUMP","PIO.CR")
500 CALL LINK ( "GCLEAR")
510 GOTO 100
520 END
NOTE: The DRAWNPLOT machine code is transferred from the module to low mem - the 8k area of the 32k ram- so there is little room for other machine code routines to co-reside. The actual plotting takes place in hi-mem (the 24k area used by your XB program) so there is only some 17k available for your XB program.
In practice, I have found that when using a SMALL XB program to do some heavy plotting, there has been interference with VDP RAM, which is not supposed to be used until you transfer the image with SHOW. At the lowest level this interference took the form of odd recolouring or character redefinitions, but at the extreme, frame hold was lost and the console locked up.
I encountered no problem using EDIT or GLOAD, only in producing hi res graphics from a running XB program using the LINKS provided, and then only after heavy repetitive use.
Provided you are not using GSAVE, it appears to be an adequate solution to insert a CALL DRAWNPLOT (not documented but you CAN use it in a running program), in between each plot in order to clear this problem, but if you use GSAVE, I have not yet found a solution, and would welcome suggestions! As it stands, if you use an XB program to plot a picture then GSAVE it, you really need to restart the program for a further plot, otherwise the XB screen will corrupt and you may lock-out.
A little extra still... when you press "2 for SXB" and let go, auto-load is still operational, but if you hold 2 down, you bypass autoload, which can be a real timesaver!
What do I think of SXB? It is a powerful programming tool, with its amendments to TRACE and LIST and its MOVE. DELETE and COPY procedures. The ability to look at TI Artist pictures ( and print them) is also very handy.
The ability to get a quick ON SCREEN disk directory without loading any other program is also very useful.
ALL IN ALL- at less than ha1f what I paid for my TI XB- a very useful programming tool.
Authors: D.C.Warren. Danny Michael, Mike Dodd, and the graphics routines by H. Shillingburg (and of course TI).
Review by Stephen Shaw. March 1989
2013 update: When I launch an emulator of the TI99/4a on my PC, it is usually with Triton SXB. One version of the Mess Emulator failed to load SXB but that has been fixed.
First the Question
l.Take a four digit number (3025)
2.Separate it into two halves, of two 2-digit numbers (30 and 25)
3. Add these two numbers ( 30 + 25 = 55 )
4. Square the result ( 55 x 55 = 3025 )
5. And we have our first number!!
REQUIRED: A PROGRAM ( in any language ) which will print out (to screen) every four digit number for which this is true.
This is a programming test in which the problem is spelt out. Now you must put together the best problem solving algorithm you can and program it!!!
If you find BASIC easy, then try to do it in another language- you have several to try: XB, Forth, Pilot, Lisp, Logo, Assembly, c99, TP99, what have you?!
Note that under REQUIRED you were not required to follow the algorithm given, merely to obtain answers which conformed to it!
The BASIC language is often thought of as slow, and TI versions especially so. If you consider that switching from a 4Mhz computer to a 12Mhz computer will- all other things being equal- give you a speed increase of a mere 3x, it is interesting to note that between the fastest and slowest submission, there was a time difference exceeding 1300x.
Firstly, taking the algorithm as given, there is an obvious choice of putting the four digit number (I) into a string and splitting it with SEG$- eg:
For 1=1000 TO 9999
N1$=SEG$(STR$(I),1,2)
N2$=SEG$(STR$(I),3,2)
giving us the two separate two digit numbers as specified.
Nothing wrong with that- except that string handling is really too slow for math work. Better to do without it.
Instead of starting from the four digit number, we can work from the intermediate number of step 3 above- this number, by specification:
a. is an integer
b. has two digits
c. when multiplied by itself gives a four digit number
Looking at our number 55 as given in the example
The target number at the end is 55 x 55
To obtain the first two digits of the four digit result
30= INT (55*55/100) (work it out!)
The LAST two digits of the four digit result can be obtained
25 = 55*55 - (30*100) (try it!)
Try looking at this code
FOR I=11 TO 99
Z=I*I
X=INT(Z/100)
Y=Z-(X*100)
IF X+Y=Z THEN PRINT Z
NEXT I
It yields the result in a mere 3.87 seconds, when programmed in optimised form, which I have not given here for clarity.
The slowest submission took some 50 minutes, using strings
The fastest? Yes, there is one faster way Look at the specification for that intermediate number from step 3. That two digit number must be between 32 and 99, so we can cut down on the looping if we can limit ourselves to values between these, and work from the intermediate number!
Now it is a LONG time since I studied math, but I am assured that the math formula can be rearranged as follows, and certainly this code does yield the right results:
100 FOR N=32 TO 99 :: IF N*(N-1)=99*INT(N*N/100) THEN PRINT N
110 NEXT N
And this runs in a mere TWO SECONDS!! Due to the complex math involved I don't I think many members would fall into this solution' but the 3.8 second solution is not too difficult to follow, merely requiring a little strategy in your approach to the problem.
XB SCREEN COLORS - QUICK AND EASY COLORS
(Extended Basic plus 32k ram required)
Here's a super short, super FAST, assembly routine for X-BASIC that allows you to change screen and character colors instantaneously!
There's lots of possible uses for the thing including games, but the real feature of this program is that it changes the color of the EDIT Mode screen as well! Yep, no more black on cyan if you don't want to!
HOW DOES IT WORK?
The color change is inserted into the USER-DEFINED INTERRUPT and is constantly 're-performed' every 1/60 of a second. This makes it seem like the EDIT mode screen has been changed.
In order to return control of the color commands CALL SCREEN and CALL COLOR, you just load the User-Defined Interrupt with zeros. (e.g. CALL LOAD(-31804,0,0).
Any use of CALL COLOR or CALL SCREEN while the routine is operational will just cause the screen to flash briefly.
DEMO PROGRAMS
Along with the program that loads in the original routine. below is a demo routine to show off your new screen colors.
A SIMPLE CALL LOAD WILL DO IT
Of course, you don't need a program to change to screen colors once the original file is loaded. All you have to do is poke a single byte value into CPU address 9460. This value is found by doing the following:
Foreground color (0 to 15) x 16
plus
Background color (0 to 15)
For instance, to set the screen to black and the characters to white you'd do the following:
15 x 16 + l=81
CALL LOAD (9460,81)
NOTE: 0=transparent , 15=white
PROGRAM 01 - SCRNCOLOR/X
This program loads the machine code routines into memory where it stays until cleared.
Once you have loaded and run the above you have some machine code to play with- here is a sample listing.
100 ! SCREEN COLOR
110 ! 11/94
120 ! SUBFILE99
130 CALL CLEAR :: CALL INIT
140 MEM=9459
150 FOR I=1 TO 50
160 READ X
170 TOT=TOT+X
180 CALL LOAD (MEM+I,X)
190 NEXT I
200 IF TOT<>3951 THEN 280
210 CALL LOAD(8194,37,38,"",
-31804,36,246)
220 END
230 DATA 244,0,2,1,0,135,208
,96,36,244,216
240 DATA 1,140,2,6,193,216,1
,140,2,2,1,0,72
250 DATA 216,1,140,2,6,193,2
16,1,140,2,2
260 DATA 0,0,32,216,32,36,24
4,140,0,6,0
270 DATA 22,251,4,91
280 PRINT "DATA LINES ENTERED WRONG. CHECK AGAINST LISTING"
290 END
100 ! CLRDEMU1/X
110 ! 11/84
120 ! SUBFILE99
130 ! NOTE
140 ! YOU MUST HAVE
150 ! ALREADY LOADED 8:
160 ! RUN "SCRNCOLR/X"!
170 CALL CLEAR :: RANDOMIZE :: DIM C$(15)
180 M$="Screen Color Change Demo"
190 FOR C=0 T0 15 :: READ C$(C) :: NEXT C
200 DISPLAY AT(1,1):M$ :: DISPLAY AT(2,1):RPT$("-",LEN(M$))
210 DISPLAY AT(10,1):"FRGRND COLOR:"
220 DISPLAY AT(16,1):"BKGRND COLOR:"
230 FC=INT(RND*15)
240 BC=INT(RND*15)
250 DISPLAY AT(10,14):C$(FC)
260 DISPLAY AT(16,14):C$(BC)
270 CVAL=16*FC+BC
280 CALL LOAD(9460,CVAL)
290 GOTO 230
300 DATA Transparent,Black,Medium Green,Light Green
310 DATA Dark Blue,Light Blue,Dark Red,Cyan
320 DATA Medium Red,Light Red,Dark Yellow,Light Yellow
330 DATA Dark Green,Magenta,Gray,White
340 END
*end of file*