TIHOME Tidings August 1982 - Volume 2 Number 4, whole series number 10.
Jump to: Rambles article start || A program that rewrites itself || Graphics Mode 3 || Range and accuracy of Call Sound
Using a Personal Record Keeping database with TI Basic || Using a PRK datafile to hold array values || Faster Banthorpe Plot
The reaction of the visitors to the Texas Instruments stand was very good and we had to get one of our London dealers to sell from the stand due to the demand. We had many compliments about the TI stand and at many times during the Exhibition they were queueing four deep to get at the computers. Consequently we will be at the show next year, but with a much bigger stand.
For us, one of the biggest bonuses from the Exhibition was the many contacts we made with third-party software companies who were eager to write and market software for the TI-99/4A. All these contacts will be followed up and you can look forward to many additional sources to purchase software of all types. It was surprising how many of these companies had not contacted us because they felt awkward in talking to a very large multinational corporation. Well we really are friendly people and want to talk to anyone who has really good ideas and even better software packages.
I have had some compliments recently about availability of TI Software. Its the old story about the local stockist not having the particular package you require. We are currently working on a Nationwide mail order set-up to allow people to order any currently marketed TI Software Package from a source which stocks the whole range.
I am aware of one problem, however, concerning Terminal
Emulator II and Text-to-Speech. We have been asked if the computer will "speak" a program listing, it will
and the input to achieve this is
Remember a space is need between LIST and the open quote marks. This particular command is an example of how subtle we at Texas Instruments can be - we did not put it in the manual.
Mini Memory, Logo. Editor/Assembler and the Peripheral Expansion System will all be available this
month, the TI-99/4A and software are all now freely available and next month comes some new games like
Alpiner, Othello, and Chisholm, as well as UCSD Pascal.
Sales of the TI-99/4A are going very well and extra distribution is being added all the time.
Owners of the Personal Record Keeping (PRK) module will have discovered the many advantages of this useful pre-programmed file handling system. Some may have even heard about an interaction with TI Basic to INPUT or PRINT anywhere on the screen with CALL A and CALL D respectively
Aptly christened Enhanced Basic
Few will have heard of the further features of Enhanced Basic enabling the user:
a. To change any characteristic of once chosen pages without losing all the entered data.
b. To perform mutations upon PRK data which are not possible with the PRK options.
c. To use two independent memory systems side by side and in conjunction.
d. To perform string operations on PRK data.
e. To save long arrays quickly without problems.
I am driving at the use of the statements:
CALL P .... CALL L .... CALL S .... CALL G .... CALL H
CALL P(N) - Partition
In order to prepare or partition the RAM memory space in two sections the statement CALL P(N) has to be entered in the immediate mode as a first action after the TI BASIC READY prompt from the computer and must be followed by NEW.
In this article we will refer to MEM1 (normal RAM) and MEM2 (PRK file memory).
In the position of N in CALL P(N) a number (constant) must be used (an integer between -4 and 13821) which points to the spot in the RAM stack where OLD will start loading instead of what otherwise would have been the starting address reserved for OLD.
The memory space below this point is the thus created MEM2 and consists of N bytes to be used for PRK data.
Usual memory: +------------+ | | | usual | | RAM | | | | 16000 | | bytes | | | +------------+ PARTITIONED MEMORY: +----------------+ | | | MEM1 (basic) | | 16000-N | | bytes | |----------------| | MEM2 (prk data)| | N bytes | +----------------+If you need a large MEM2 (e.g. because a large PRK file has to be loaded) then N must he in the higher range. This obviously at the same time restricts the size of MEM1 for your Basic program.
If on the other hand you have a large TI Basic program or need to load a lot of "normal" data, but still you want to interact with a PRK file as well, then you are best off with a large MEM1 and a small MEM2 when in the CALL P(N) statement you assign a low value to N.
If you are still with us then it will dawn upon you that this beautiful mechanism enables you to freely
choose the ratio of MEM1 against MEM2 to suit any particular application. MEM1 is cleared and loaded
with programs and data in the usual way with NEW, OLD, SAVE, INPUT and PRINT without affecting
MEM2 in any way. PRK data are loaded in MEM2 with the statement:
resulting in the usual cassette prompts which will now read data previously generated by the PRK module in its normal mode.
An error message: ERROR DETECTED IN DATA may mean that MEM2 is not large enough to contain the PRK data and a new CALL P(N) with a higher N must be entered (and followed by NEW). The quickest and surest way to remove the previous CALL P is to switch the console off and on again.
MEM1 can be used:
a. Normally as if MEM2 had not been prepared
b. In the direct node interacting with the loaded PRK data
c. To load a program in TI Basic that interacts with PRK data or even loads or saves PRK data when this program is RUN, as program lines with CALL L and CALL S (you guessed it, S for save) are permitted.
The syntax and parameters of CALL L and CALL S are:
CALL L("CS1",C) and CALL S("CS1",C)
C is a control variable that gets a value 0 if loading or saving has been successful. When an error has been detected the value of C in not equal to 0.
Instead of "CS1" also "DSK1" or "RS232" may be used for similar interaction with these devices.
There are only 2 statements that can be used in the TI Basic (or rather Enhanced Basic, a term coined
by Peter Brooks of TIHOME, the British user group) dominating MEM1 TI Basic area)
that cross the borderline between MEM1 and MEM2.
These two statements are:
CALL G and CALL H
The CALL G ( G for getput) statement has a write mode and a read mode.
In the write mode it enables the user to change PRK data, which might also have been changed using the normal procedures of the PRK module (change a page and mathematical transformations).
But the values can also be taken from variables which in turn get their values from the whole bag of tricks of TI Basic including string handling (which otherwise lacks in the module). Needless to say, this dramatically enhances the versatile use of the PRK data, since the saved data (CALL S) can be reloaded in the module mode, permitting their further use "module fashion".
The syntax and parameters of CALL G are:
Read mode: CALL G(1,PAGE,ITEM,MIS,VALUE)
Write mode: CALL G (0,PAGE,ITEM,VALUE)
MIS in read mode is a control variable: if data found then MIS=0. When no data found MIS=1.
Note 1: If a string variable is used for VALUE (e.g. VALUE$) and the ITEM type was chosen as "characters", then strings can be handled.
Note 2: CALL G(2,PAGE,ITEM,VALUE) writes "nothing" (=missing data) in the assigned place. The value or VALUE has no meaning.
Note 3: Although not mentioned each time, these techniques also work with the Statistics module.
CALL H affects the header, i.e. those choices that the PRK does not permit you to alter, once you have okayed the file structure.
Changing the names of FILES and ITEMS is a cinch.
Changing the type or width if ITEMS is also easy, but the results are usually not the ones aimed for, because all data are written sequentially (as beads glued on their string). Nevertheless it is possible to change any entry for the file structure maintaining the right data in their correct place, but this requires routing through a special TI Basic program.
This will be discussed in a future article. For those of you too impatient for this feature we recommend you buy the command module "Personal Report Generator". You then overcome the frustration of having spent days and days entering data in a PRK program and then coming to the conclusion that a small change in file structure is necessary forcing you to start from scratch.
The syntax and parameters of CALL H are:
Setting up the header (i.e. file structure) is easiest in the module mode (Let's begin- create a file), but if
you insist on doing this from TI Basic start with INFO 9 to 12 before going on to INFO 1-4.
Read mode: CALL H(1,INFO,ITEM,VALUE)
Write mode: CALL H(0,INFO,ITEM,VALUE)
INFO Stands for
1 File name (maximum of 9 characters)
2 Day of the month
5 * Number of items per page
6 * Number of pages
7 * Length of header in bytes
8 * Length of each page in bytes
9 Item name (maximum of 9 characters)
10 Type of item (1 = char; 2 = integers; 3 = decimals; 4 = scientific)
11 Width of item
12 Number of decimal places
13 * Amount of memory required for this item in bytes
14 * Position of item in page
* = this value is automatically calculated and placed by PRK mode
The ITEM value is of no importance for those INFO values between 0 and 9
We intend to give examples of the practical use of all this knowledge in future articles covering such subjects as an easier way to save arrays and word processing in PRK files.
Although Texas Instruments are obviously aware of these possibilities they have not considered them
perfect enough to document them and "sell" them officially. The authors declare that although inside
information from TI made this article possible, that in no way can Texas Instruments be held responsible
for its contents, nor are the authors who present these data in good faith but without any warranty
Still we consider knowledge of Enhanced Basic important for a complete enjoyment of your TI-99/4(A). And that is what counts!
Go to top of page
Enhanced Basic for efficient loading/saving of arrays
by Franc Grootjen and Paul Karis Blxxxgras 2. 39NN AA Veenendaal, The Netherlands
This article will only make sense to those who have familiarised themselves with Enhanced Basic - the term Peter Brooks of TIHOME, the British user group, invented for the extras provided by CALL A, CALL D, CALL P, CALL L, CALL S, CALL G, and CALL H in combination with a Personal Record Keeping or Statistics Module.
Imagine having completed 150 observations with values between 0-100 and that you want to save these
values on tape. You don't want to use the PRK or STAT mode as the standard possibilities of these
modules are too restricted for your intentions. TI Basic allows us to OPEN and PRINT #N and so writing
data on tape, but this method has several drawbacks:
Saving and loading consume a lot of time and tape. Frequently the pilot tone alone, marking the start of each record, takes longer than the actual time required for data transmission. Waiting time is wasted time.
The compacting of data that sometimes partly solves the first problem in itself is complicated. (e.g. the string "2/2.3/5/6.7/3.4/1.3/3/34/123/4.5" can be written as one variable but used to transmit 10 numerical values).
There is no built-in data check possibility like we have for program saving.
When an error occurs the program BREAKs and cannot be CONtinued, and the data loaded cannot be used and must he loaded again. The same holds true if a small alteration needs to be made in the program after the data are loaded.
Enhanced Basic does away with all these problems.
Back to our example: Let us presume that the 150 observations are held in the array ARRAY(ITEM), At this point we would like to remind you that the use of Enhanced Basic requires you to prepare your computer with CALL P before typing in or loading the following subroutines or programs containing these subroutines.
10000 REM SAVE SUBR 10010 CALL H(0,5,1,1) 10020 CALL H(0,10,1,2) 10030 CALL H(0,11,1,2) 10040 FOR ITEM=1 TO 150 10050 CALL G(0,1,1,ARRAY(ITE M)) 10060 NEXT ITEM 10070 CALL S("CS1",Y) 10080 REM END Of SUBR 10090 RETURN --- 10100 REM LOAD SUBR 10110 CALL L("CS1",Y) 10120 FOR ITEM=1 TO 150 10130 CALL G(1,1,1,MIS,ARRAY (ITEM)) 10140 NEXT ITEM 10150 REM END OF SUBR 10160 RETURN ---When your main program is at a point that you want to save the values of the array ARRAY() it only takes a line
10010 Tells the computer that one item will be used per page.
10020 Determines this item to be of type 2 (= integer)
10030 Reveals that you do not intend to have values beyond 99. Width is 2.
10040-10060 Stores all 150 values of the elements of array ARRAY() in MEM2.
In PRK language item 1 on page ITEM gets a value of ARRAY(ITEM)
. 10070 Saves the array as a PRK file from MEM2. CHECK TAPE (Y/N) is asked.
10100 Loads PRK file from tape in MEM2
10120-10140 A loop that fills array ARRAY() with the values in MEM2.
We recommend you study this example and you will discover other possibilities that are meaningful to you. Change lines 10020 and 10030 to suit your data. Use nested loops for multi-dimensional arrays. Use your head as in computing: The sky is the limit.
c. Another unpublished difference - my benchmark timings for XB in June issue were for v100. You
should find v110 behaving as "speeded-up" v100.
This is because v110 automatically sets memory location -31878 to the number of sprites you are using, without the need for Expansion Memory! So you lucky v110 owners have a faster version: your programs will on average run 30% faster in XB than in TI Basic. If you have v110 - don't bother putting in the "speed-up" line - you don't need it. If you have v100 you need the Expansion RAM and need to use:
CALL INIT :: CALL LOAD(-31878,0)
Acknowledgment - the April article on disks came from Australia. That's all from the Antipodes.
Taking a week off work recently I was impressed by the number of times the phone rang. If you need to ring me, please do so after 7:00PM and not on Wednesdays. I prefer letters, they give me time to think!
99'er Magazine Issue 5 - for those of you not yet subscribers - Contained some VERY good action games in Extended Basic, and a rather easy version of Reversi (Othello).
Contained a detailed review of the mis-named Mini Memory module - not just 4K of RAM but a whole
lot more. With this module you may write and run programs in Assembly code with only the console and
a tape recorder - no need for a disk system or Expansion RAM.
You can address every byte in the machine, including switching to a 40-character screen width, and can define 768 different characters at once (that does however take up to 12K of memory). This magic module SOUNDS very exciting - I have one on order from the States, and will report in due course.
Note: Owners of the old 99/4: You have a different VDP chip and can't define 768 characters - sorry. The demo program supplied will not therefore work on a 99/4 - it's a hi-res graphics demo using 768 characters.
Go to top of page
67MB pdf file from whtech.com of 99er Magazine Volume 1 issue 5, which was not dated.
I am informed that the 99/4A will be included in the issues dated Oct, Nov and Dec 1982. These are available in the middle of Sept, Oct and Nov 82!
The magazine pays GBP 10 for first publication and sends you a free issue too. You may specifically reserve all other rights. If you want to see programs for the 99/4A published you know what to do now. SEND THEM to C&VG mag. At the very least write to the Good Editor and thank him for his interest. Unless he receives a good response to the Oct-Dec issues he will probably not give the 99/4A another glance. It's up to YOU (stop snoring at the back!).
* * *
Four branches of Micro-C are experimentally stocking some of my cassette software for the 99/4A in TI Basic. (Manchester, Birmingham, Leicester, Southampton)
* * *
TI-99/4 vs. 99/4A differences
There are several variations on the TI system which you must know about if you wish your programs to run on every combination.
Firstly, the different consoles:
The most important difference is in using the split keyboard. In particular, you must not use keys returning values of 13, 16, or 17. The two consoles use different keys for these codes.
If you use keys X and M, supposedly returning value 0, when testing for this value you should not directly equate with zero, as the 99/4A will return False. You should use, for instance:
IF B+1=1 THEN ...
The A model has a different VDP chip. If you are developing an Assembly Language routine or program which addresses this chip you should test-run on a 99/4 if available, or indicate that your program/routine may not work with a 99/4. As an example - with the A you may define 768 characters. This is not possible on the 99/4.
The old 99/4 only has available CALL KEY 0, 1, and 2. The other CALLS will not cause a crash, but they will have NO effect.
The old 99/4 does not have a lower case character set - the characters are blanks. If you use a 99/4 do not assume any blank characters - if you use an A, do not assume lower case will be printed.
For use on either console, you may wish to add the following, if your A program uses lower case (and if it is not vital to the programs)
100 PRINT "PRESS ENTER" 110 CALL KEY(2,A,B) 120 CALL KEY(0,C,D) 130 IF (D=0)*(B=0) THEN 110 140 CALL KEY(2,A,B) 150 IF A <> 13 THEN 1000 160 FOR A=65 TO 90 170 CALL CHAR(A+32,CHR$(A)) 180 NEXT ACALL KEY(2 …) is repeated in case ENTER is pressed when the computer is between 110 and 120!
In Extended Basic you may use: 170 CALL CHARPAT(A,A$) 172 B$="0000"&SEG$(A$,1,4)&SE G$(A$,7,4)&SEG$(A$,13,4) 174 CALL CHAR(A+32,B$)This will give the 99/4 the small letters. Only one major problem - the area the program is stored in in memory is very slightly different - 24 bytes adrift.
Note: If you have v110 Extended Basic,
for listing A, in line 150, use
FOR B=-32 TO -48 STEP -1
or listing B, line 150, use
CALL LOAD(-47,156,199,etc ... )
Version A, suggested from an article in 99'er Magazine
100 GOTO 140 110 PRINT "!!!!!!!!!!!!!" 120 END 130 STOP 140 CALL INIT ! POKE TEST 150 FOR B=-8 TO -24 STEP -1 160 READ Z 170 CALL LOAD(B,Z) 180 NEXT B 190 DATA 69,84,69,76,80,77,7 9,67,32,84,83,69,84,13,199,1 56,17 200 GOTO 110 1000 FOR Z=0 TO -28 STEP -1 :: CALL PEEK(Z,A):: PRINT Z ;A;CHR$(A),:: NEXT Z 1001 ENDVersion B, suggest by comparison to CALL PEEK
100 GOTO 140 110 PRINT "!!!!!!!!!!!!!" 120 END 130 STOP 140 CALL INIT ! POKE TEST 150 CALL LOAD(-23,156,199,13 ,84,69,83,84,32,67,79,77,80, 76,69,84,69) 160 REM NOTE IN REVERSE ORDER TO PROG A 170 GOTO 110 180 ENDThis version an original SJS creation.
Program B is neater as it allows you to LOAD a line in normal order.
Note: The last data item in Program A is the number of characters in the line (including command characters and including the number 17 itself. It is not necessary but is included to remind you that writing lines this way you may not alter the length of the line! If it starts 17 long it should remain 17 long!
With this type of procedure you can no place a "HISCORE" for your games into your programs - and save
with the program instead of using a separate data file.
Don't forget to also put in your program a "reset" feature.
Go to top of page
In Mode 3, you have each character position divided into 4 small squares. Every small square can be any one of the 16 colors available.
As the final list illustrates, the Mode 3 Color Table is in the same area of memory as Mode 1 Character Definition Table which permits us to use those small squares in Extended Basic.
If you place a vertical column of 4 characters on the screen, giving a 2 by 8 grid of small squares, you can manipulate the small squares by redefining the character forming the column
------------ | 16 | 15 | | 14 | 13 | ------------ | 12 | 11 | | 10 | 9 | ------------ | 8 | 7 | | 6 | 5 | ------------ | 4 | 3 | | 2 | 1 | -----------where:
The VALUE defines the color (1 to F), the position in the definition string defines which of the 16 small squares is to be that color.
Note what happens when you scroll. Note: It is wise NOT to use CALL SOUND.
Keep pressing keys to return to normal afterwards. If the screen appears to lock out in a funny pattern, enter a letter and press ENTER - that should clear it. If all else fails, switch off.
Have fun with these:
100 PRINT "ONE MOMENT:REDEFI NING A FEW CHARACTERS...." 110 B$="1234567890ABCDEF1234 000123123" 120 FOR CH=32 TO 136 130 FOR C=1 TO 16 140 CH$=CH$&SEG$(B$,32*RND+1 ,1) 150 NEXT C 160 CALL CHAR(CH,CH$):: CH$= "" 170 NEXT CH 180 CALL SOUND(500,440,0) !b efore LOAD 190 CALL INIT 200 CALL LOAD(-31788,204) 210 CALL CLEAR 220 CALL KEY(0,A,B) 230 IF B<1 THEN 220 240 CALL HCHAR(1,1,32+FLAG,7 80) 250 FOR CH=32 TO 95 260 CALL CHARPAT(CH,B$) 270 CALL CHAR(32+FLAG,B$) 280 FOR DL=1 TO 200:: NEXT D L 290 NEXT CH 300 FLAG=FLAG+1 310 IF FLAG<100 THEN 240 100 CALL INIT 110 CALL LOAD(-31788,204) 120 CALL KEY(0,A,B) 130 IF B<1 THEN 120 140 CALL HCHAR(1,1,45,200) 150 FOR Z=1 TO 57 160 FOR X=1 TO 14 170 PRINT CHR$(Z+30); 180 NEXT X 190 FOR DL=1 TO 500:: NEXT D L 200 NEXT Z 210 CALL LOAD(-31788,224) !n ormal value 220 CALL KEY(0,A,B) 230 IF B<1 THEN 220 240 END 100 CALL CLEAR 110 CALL INIT 120 CALL LOAD(-31788,204) 130 CALL KEY(0,A,B):: IF B<1 THEN 130 140 B$="1234567890000ABCDEEE FF11114448888FF123" 150 FOR T=32 TO 100 160 CALL CHAR(T,SEG$(B$,RND* 20+1,16)) 170 NEXT T 180 FOR Z=1 TO 30 190 CALL HCHAR(23*RND+1,31*R ND+1,70*RND+30,4*RND+1) 200 NEXT Z 210 IF FLAG=2 THEN 150 220 FOR Z=1 TO 700 230 CALL HCHAR(22*RND+2,30*R ND+2,65*RND+32) 240 NEXT Z 250 FLAG=2:: GOTO 150 260 END =========================== 40 CALL CLEAR 100 A$="00000000000000110000 0000000000000000000000000" 110 FOR A=32 TO 60 STEP 3:: CALL CHAR(A,A$):: NEXT A 120 CALL INIT 130 CALL LOAD(-31788,204) 140 CALL KEY(0,A,B) 150 IF B<1 THEN 140 155 CALL HCHAR(1,1,32,770) 160 FOR I=1 TO 16 170 CALL CHAR(32,SEG$(A$,I,1 6)) 180 FOR DL=1 TO 3E3:: NEXT D L 190 NEXT I 200 END
Using the notes D and D sharp, and starting from the D above the A above high C:
Intended Theoretical Output Frequency Frequency 1175 1177 1245 1243Pretty close. Now, the same notes, going up an octave at a time:
2350 2330 2490 2486 4700 4661 4980 5085 9400 9322 9960 10169 18800 18643 19920 18643! no error in my typing here
If you don't have TIHOME April 82, here is a little list for you to enter and try:
100 INPUT FREQ 110 CALL SOUND(400,FREQ,5) 120 CALL SOUND(400,30000,30, 30000,30,FREQ*13.58,30,-4,2) 130 CALL KEY(0,A,B) 140 IF B=0 THEN 110 150 GOTO 100Note: The computer plays a note for a duration of N sixtieths of a second - not in milliseconds.
The variables R and C are used to pass the plot co-ordinates to the subroutine.
The subroutine variable list is: B, C, H, I, P, R, S, X, Y, B$, H$, I$, Z$, C$(), and of those, S, B$, H$, Z$, and C$() should not be modified by the main routine(s), although C$() may be under certain circumstances.
Observant plotting addicts may notice that HR$ is similar to the mirror-image reversal string used in Designs For Fun.
Here is the revised listing based on suggestions from Bill van Kerkoerle:
100 DIM C$(128)
110 GOTO 330
140 CALL GCHAR(Y,X,H)
150 IF H>31 THEN 220
160 IF S=95 THEN 320
190 CALL CHAR(S,Z$)
200 CALL HCHAR(Y,X,S)
250 IF B<5 THEN 270
310 CALL CHAR(H+31,SEG$(C$(H
330 CALL SCREEN(8)
350 CALL HCHAR(1,1,S,768)
460 FOR X5=0 TO X1 STEP 2
500 FOR I1=-A TO A STEP V/10
540 IF R<=M THEN 590
580 GOSUB 120
590 NEXT I1
600 NEXT X5
620 FOR K=1 TO H
660 FOR L=2 TO 16 STEP 2
720 NEXT L
730 CALL CHAR(K+S,C$(K+H))
740 CALL HCHAR(Y,X,K+S)
750 NEXT K
760 GOTO 760
Go to top of page
To encourage TIHOME members to submit articles and programs to the commercial micro press, Texas Instruments will give you a module of your choice up to a price of GBP 50 for each article or program published from now till December 31, 1982. Send proof of publication in the form of a photocopy of the magazine page containing your entry to R. Frowd, Texas Instruments, Manton Lane, Bedford, Beds.
After the finishing date Robin Frowd and Paul Dicks will decide which is the best of the articles and the winner will receive a language module of their choice, i.e. Editor/Assembler, Logo, Mini Memory, Extended Basic, Speech Synthesiser.
This offer does not apply to employees of TI or TIHOME. Nor does Tidings count as a commercial publication.
* * *
Membership continues to rise and now stands at abut 400. I won't say that the higher the membership the more notice TI takes of us, but I'm sure it has some effect. As the membership rises I am having to introduce strict office routines or else I will lose track of what I have done and what still needs to be done.
All members have a membership number already and pretty soon I shall let you into the secret. If you quoted it on your letters it would certainly help when I get letters with almost no address, signed "Yours Harry". While I appreciate Harry's letter, it would be useful to know who he is!
============== ============ ===========