contact - please use subject="pc99 page" to avoid spam trap!
This page contains articles on the TI99/4a. There is a brief linked index to help you find something useful.
Web article two- published March 1999
Includes:
Tips on programming menu choices; Using the various TI99/4A
graphics programming packages with examples;
how to use Basic
PRINT USING; Jim Peterson's
Tips No 65
MENU CHOICES
TIPS was a commercial clip art program for the TI99/4A.
The TIPS program allows you to input the name of a graphic - but it goes a
little farther than that. You do not have to key in the full name of the
graphic, just enough to identify it. If there is more than one possible match,
the program selects the first possible.
For example, if the graphics on file are ANT, APE, APPLE, when you select A
you will have an ANT, if you type AP you will have an APE and for APP you get
an APPLE.
We can copy this into our Basic programs when a typed selection is required,
like this:
1 ! AS TIPS CHOICE 2 ! 3 ! INPUT AS LITTLE AS IS 4 ! REQUIRED TO IDENTIFY 5 ! CHOICE 6 ! 7 ! FIRST MATCH IS 8 ! SELECTED IF MORE THAN 9 ! ONE CHOICE 10 ! 92 ! 93 ! DATA IS SORTED 94 ! 100 DIM A$(25) 110 DATA BACK,BAG,BOA,BODY,BOND,BONE,CAB,CABIN,CABINET,CAKE,CAR,CARD, CARE,CAROL,CARP,CART,CASE,CASK,CAT,,, 120 FOR T=1 TO 19 :: READ A$(T):: NEXT T 130 REM 140 PRINT "SELECT FROM": 150 FOR T=1 TO 19 :: PRINT A$(T);" ";:: NEXT T 160 PRINT "":"":"":"" 170 REM 180 INPUT B$ 190 LA=LEN(B$) 200 FOR T=1 TO 19 210 IF B$=SEG$(A$(T),1,LA)THEN 240 220 NEXT T 230 PRINT "UNABLE TO MATCH":"":"" :: GOTO 140 240 PRINT "MATCHED ON ";A$(T):"":"":"":"" 250 GOTO 130 260 END
100 ! AS PC CHOICE 110 ! 120 ! INPUT AS LITTLE AS IS 130 ! REQUIRED TO IDENTIFY 140 ! CHOICE 150 ! 160 ! FIRST MATCH IS 170 ! DISPLAYED. TYPE MORE 180 ! IF REQUIRED OR USE 190 ! ARROW KEYS E&S (WITH 200 ! FCTN KEY! ) 210 ! 220 ! 230 ! DATA IS SORTED 240 ! 250 DIM A$(25) 260 ! 270 DATA BACK,BAG,BOA,BODY,BOND,BONE,CAB,CABIN,CABINET,CAKE,CAR,CARD, CARE,CAROL,CARP,CART,CASE,CASK,CAT,FORD,FORK,FORT,,, 280 FOR T=1 TO 22 :: READ A$(T):: NEXT T 290 REM 300 PRINT "SELECT FROM": 310 FOR T=1 TO 22 :: PRINT A$(T);" ";:: NEXT T 320 PRINT "":"":"":"" 330 PRINT "after first letter typed, use fctn e and fctn x to move up and down list or carry on typing":"":"": 340 ROW=24 :: COL=3 350 CALL HCHAR(ROW,COL,30):: CALL KEY(5,X,Y):: IF Y>0 THEN 370 ELSE CALL HCHAR(ROW,COL,32):: GOTO 350 360 ! 370 CALL HCHAR(ROW,COL,X):: COL=COL+1 :: B$=B$&CHR$(X):: LB=LEN(B$) 380 ! 390 FOR T=1 TO 22 400 IF B$=SEG$(A$(T),1,LB)THEN DISPLAY AT(24,1):A$(T):: GOTO 460 410 ! 420 IF B$1 THEN T=T-1 :: DISPLAY AT(24,1):A$(T):: B$=SE G$(A$(T),1,LB):: GOTO 460 540 IF X=11 AND T<2 THEN CALL SOUND(200,200,4):: GOTO 460 550 IF X=10 AND T<22 THEN T=T+1 :: DISPLAY AT(24,1):A$(T):: B$=SE G$(A$(T),1,LB):: GOTO 460 560 IF X=10 AND T=22 THEN CALL SOUND(200,200,4):: GOTO 460 570 IF X=8 AND LB>1 THEN B$=SEG$(B$,1,LB-1):: LB=LEN(B$):: GOTO 390 580 IF X=9 AND LB
Return to top of page
====================================
HIGH RESOLUTION GRAPHICS
In the Reader to Reader column of MICROpendium, March 1992, Chuck McConnell of Ohio wrote asking for a way to plot graphics at pixel level without using a disk drive (which rules out such fun programs as The Missing Link and JBM103).
My first TI computer was a TI99/4, which did not HAVE a high resolution mode of any sort, and given a long standing interest in graphics, I have since that time tried (almost) every graphics program available.TI Logo was designed for the TI99/4, and in the absence of pixel graphics, utilised a routine which continually redefined characters (or tiles) as you drew on the screen. Sooner or later you ran out of characters, and in the colourful terms of TI Logo, you ran out of ink!
Back in 1982, we were blessed with a routine in TI Basic which allowed high resolution graphics plotting, continually redefining characters, thanks to Peter Brooks, a felow founder member of the first UK user group. This was painfully slow, and as TI Basic does not have CALL CHARPAT had to make use of a large string array, and also boolean algebra had to be done the hard way.
Then along came Extended Basic, which I think most people now have? And Gary Harding rewrote Peter's routine making use of CHARPAT and OR. The program below is an example of its use. The maths is placed in a subroutine, so the only variable you need to avoid in your inserted routines is S, which keeps track of which character we are redefining.
100 ! hi res plotting - ti ex bas only 110 ! after brooks, harding etc. 120 ! initialise: 130 S=31 :: FOR C=0 TO 14 :: CALL COLOR(C,16,2) :: NEXT C 140 CALL HCHAR(1,1,S,768) :: CALL SCREEN(2) 150 ! 160 ! 170 ! 180 ! YOUR PROGRAM HERE 190 ! 200 ! 210 FOR COL=40 TO 140 STEP 100 :: FOR ROW=20 TO 160 220 CALL PLOT(ROW,COL,S) :: NEXT ROW :: NEXT COL 230 ! 240 FOR RAD=0 TO 6.5 STEP 0.0125 250 CALL PLOT(36*SIN(RAD)+99,36*COS(RAD)+76,S) :: NEXT RAD 260 ! 270 ! 280 ! 10000 GOTO 10000 10010 STOP 10020 ! 30000 SUB PLOT(R,C,S) 30010 IF R>190 OR C>254 THEN SUBEXIT 30020 IF R<1 OR C<1 THEN SUBEXIT 30030 R=INT(R+.4) :: C=INT(C+.4) 30040 Y=INT(R/8+0.875) :: X=INT(C/8+0.875) 30050 H$="0123456789ABCDEF" 30060 B=C-X*X+8 :: P=2*R-16*Y+16+(B<5) 30070 IF B>4 THEN B=B-4 30080 CALL GCHAR(Y,X,H) 30090 IF H>31 THEN 30120 ELSE IF S=143 THEN SUBEXIT 30100 S=S+1 :: D$=RPT$("0000",4) :: CALL CHAR(S,D$) 30110 CALL HCHAR(Y,X,S) :: H=S :: GOTO 30130 30120 CALL CHARPAT(H,D$) 30130 N=(POS(H$,SEG$(D$,P,1),1)-1)OR(S^(4-B)) 30140 D$=SEG$(D$,1,P-1)&SEG$(H$,N+1,1)&SEG$(D$,P+1,16-P) 30150 CALL CHAR(H,D$) :: SUBEND 31000 ! ORIGINAL ROUTINE TIDINGS OCT 1982
Yes it is just a little slow, but remember it is all Extended Basic with no extras required, no disk drive, no 32k ram!
Chuck also wrote directly to me, asking about using the Drawnplot routines to be found in the Triton module Super Extended Basic.
When driven from a program, Drawnplot has only a limited set of commands, but sufficient for our purposes. The biggest drawback -to me! - is that the image does not appear on the screen until it is finished. For a lengthy chaotic or fractal image this can mean a long time with nothing obvious happening, so in the program below I have added a screen counter. During processing some odd characters appear on the screen - ignore them! - Drawnplot does not really like you to use the screen while it is plotting!The program below is a routine for a chaotic graphics plot, and really does take a very long time to finish! The end result is interesting as total order, represented by a single line, becomes total chaos after repeated bifurcation.Super Extended Basic requires that you have the 32k ram attached, and you enter the graphics mode by typing the command sequence:
CALL FILES(2) NEW CALL INIT CALL DRAWNPLOT
Now you can input or load your program as follows:10 ! high resolution graphics using 20 ! triton super extended basic and 32k ram 30 ! after brooks, harding etc 40 ! 100 CALL LINK("GCLEAR") 110 ! ORBITDGM PROGRAM 120 ! OR insert your program here: 130 FOR C=-2 TO 0.25 STEP .00625 140 X=0 :: M=160*(C+2) :: FOR I=0 TO 200 150 X=X*X+C :: IF I<50 THEN 170 160 N=(180/4)*(2-X) :: CALL PSET(M,N) 170 NEXT I 180 CALL LINK("MOVE",80,160) 190 CALL LINK("LABEL","Press E to Exit") 200 CALL LINK("SHOW") 210 STOP 10000 SUB PSET(X,Y) 10010 CALL LINK("MOVE",X,Y) :: CALL LINK("DRAW",X,Y) 10020 SUBEND - - - - -
It would be amiss of me not to make this a complete article by covering some other possibilities...
For Myarc Extended Basic, you require the Myarc module, Myarc expansion memory, and the disk and rom chip supplied with the module. The listing immediately above needs the following changes:100 CALL GRAPHICS(3) 180 REM 190 CALL WRITE(0,160,80,"* done *") 200 REM 10010 CALL POINT(1,X,Y)
MYARC XB is fast and has the unique ability of being able to tell you if a pixel is on or off - and like the Missing Link you can have sprites in high resolution mode!
- - - - -
For THE MISSING LINK, a commercial disk from Texaments requiring any Extended Basic plus 32k ram and disk system, the following amendments are required to the program:100 CALL LINK("CLEAR") 180 REM 190 CALL LINK("PRINT",160,80,"* DONE *") 200 REM 10010 CALL LINK("PIXEL",X,Y)
- - - - -
There is a French utilitiy in circulation called JBM103, which would require the following:100 CALL LOAD(-31890,56,0) :: CALL LOAD(-31964,56,0) 105 CALL LINK("CLEAR") :: CALL LINK("SCR2") 180 REM 190 REM 200 REM 10010 CALL LINK("POINT",16,X,Y)
- - - - - - - -
The graphics enthusiast thus has a choice of programming environments- each choice has something to offer. My present first choice tends to be The Missing Link, but there are occaisions when Myarc XB is necessary.
Both The Missing Link and JBM103 can save your art forms in TI Artist format, and I have lost count of the number of utilities you can use with this format! Enjoy.
Stephen Shaw UK April 1992
And here are a few more graphics listings - small listings, complex graphics. There are written for The Missing Link, but the data above will help you use other TI graphics programs:
100 REM CIRCLES 110 REM JE CONNETT/PWH MOON/S SHAW 1990 120 SIDE=20 130 REM 140 CALL LINK("CLEAR") 150 FOR I=1 TO 150 :: FOR J=1 TO 150 160 X=I*SIDE/150 :: Y=J*SIDE/150 :: C=INT(X*X+Y*Y):: D=C/2 :: IF D-INT(D)>.1 THEN 180 170 CALL LINK("PIXEL",I+20,J+20) 180 NEXT J :: NEXT I 190 PIC=PIC+1 :: A$="DSK2."&STR$(PIC) 200 CALL LINK("SAVEP",A$) 210 SIDE=SIDE*1.2 :: GOTO 140 220 END ---------------------------------- 100 CALL LINK("CLEAR") 110 H=240 :: V=180 120 REM 130 REM 140 X=6.10 150 Y=6.00 160 REM 170 REM 180 FOR L=1 TO 3299 190 NX=1-Y+ABS(X):: NY=X :: X=NX :: Y=NY 200 A=100+X*7-Y*7 210 B=70+X*7+Y*7 220 CALL LINK("PIXEL",A,B) 230 NEXT L 240 CALL LINK("PRINT",180,180,"END") 250 X=8.30 :: Y=8.02 260 FLAG=FLAG+1 :: IF FLAG>2 THEN 260 ELSE IF FLAG>1 THEN X=8.56 :: Y=3.76 :: GOTO 160 ELSE GOTO 160 ----------------------------------------- 100 CALL LINK("CLEAR") 110 H=240 :: V=180 120 REM 130 REM 140 X=-.100000000001 150 Y=0 160 REM 170 REM 180 FOR L=1 TO 5299 190 NX=1-Y+ABS(X):: NY=X :: X=NX :: Y=NY 200 A=100+X*14-Y*14 210 B=60+X*14+Y*14 220 CALL LINK("PIXEL",A,B) 230 NEXT L 240 CALL LINK("PRINT",180,180,"END") 260 GOTO 260 =========================================== ==========================================Return to top of page
Using USING
by Mark Schafer
This is a new and different animal for me, as I normally do not write tutorials. It came up at a recent meeting that some people are having trouble with PRINT USING. Since I consider it to be no problem, I volunteered to write an article about it. As for the title, remember that USING can also be used in a DISPLAY USING statement. There's a lot of ground to cover, so let's get started with....
Beginner's Stuff
USING represents a method by which you can get data to print in a specific format instead of the default format. The syntaxes are:
PRINT USING format:print-list
DISPLAY [option-list:] USING format[:print-list]
where format is a line number or a string expression. A line number would be the line where an IMAGE statement is found which would contain the string expression which is the format. A string expression can be as simple as a string literal enclosed in quotes or a complicated expression made up variables, function calls, whatever. Now let's compare the two methods of printing:
100 PRINT -56.7;109.2850 110 PRINT USING "####.# ###.####":-56.7,109.285 RUN this program and it looks like this: -56.7 109.285 -56.7 109.2850
USING allows you to better control the spacing as well as put trailing zeroes to the right of the decimal point.
Let's look at the format string. It is made up of fields with optional text. Fields are like fill-in-the-blanks. They mark the place where an unknown value will be printed. Text is printed the same way every time. Fields are made up of pound signs (#) with possibly a decimal point, a minus sign, or maybe some circumflexes (^). I will cover circumflexes in a later section.Pound signs take the place of a digit or sign. So in line 110 above, I printed -56.7 with the field "####.#". -56.7 has only three characters to the left of the decimal point, so the initial character is left blank; the second one is where the minus sign went. Numbers are always aligned with the decimal point. If there isn't one, it's assumed to be at the end.
If there's a minus sign in the field, it always goes at the beginning. It indicates that you want the minus sign to appear immediately to the left of the number if it is negative. However, this is the same thing another pound sign would do, so you never really need to use a minus sign (except for a more advanced purpose to be discussed later.) In other words, "-##.##" does the same thing as "###.##".
The decimal point indicates where you want it to be. The number of pound signs you put to the left of it dictates how many digits you want to the left; the number you put on the right indicates how many decimal places you want. The decimal is always printed even if there are no pound signs after it.
If there are fewer digits in the value to the left of the decimal point than there are in the field, spaces are used to fill it out. If there are too many, the computer will refuse to print your value and fill the field with asterisks (*). This means your value is too high and/or there isn't enough places in your field. This includes the minus sign, if any.If there are fewer digits in the value to the right of the decimal point than there are in the field, zeroes are used to fill in the remainder. If there are too many, the computer will estimate the number to the number of places given. So .## can be used to estimate to the nearest 100th, .# to the nearest tenth, and if there are no decimal places, it will estimate to the nearest unit.
Below is a table of how various values will be printed with various fields. The left side represents the value; across the top are the fields.
# ## ### #.# ##.## ###.### 2 2 2 2 2.0 2.00 2.000 -13 * ** -13 *** ***** -13.000 9.671 * 10 10 9.7 9.67 9.671 125.678 * ** 126 *** ***** 125.678 -.385 * -0 -0 -.4 -.39 -.385 -3.05 * -3 -3 *** -3.05 -3.050
Generally, XB handles format strings like this: It keeps printing text until it comes to a field (characterized by a pound sign). Then it looks for the next value to be printed. If there is one, it prints it in the format specified; if there isn't one, it terminates there and doesn't print anything else. However, you must specify at least one value and there must be at least one field in the format. Except, curiously, DISPLAY USING doesn't need any values.Why anyone would use DISPLAY USING without any values is beyond me. Anyway, if it reaches the end of the string, and there's more values to be printed, it goes to the next line and starts over at the beginning of the string. So it's ok if the number of fields doesn't match the number of values.
Going back to syntax, if you want to use the format "I HAVE $###.##", you have three ways of doing it:
120 IMAGE I HAVE $###.## 130 PRINT USING 120:M 140 A$="I HAVE $###.##" 150 PRINT USING A$:M 160 PRINT USING "I HAVE $###.##":M
Notice that if use the first method using IMAGE, you don't need quotes. The only time you need quotes with an IMAGE statement would be when you have leading or trailing spaces. If you're going to use it repeatedly in a program, IMAGE is the most efficient method. If you're only using it once, go with the third method. Practically the only time you need the second method would be when the format string is constructed so you may not know exactly what it looks like. Remind me, and I might discuss that later.The IMAGE statement must be on a line by itself. The computer ignores it when it comes to it in a program the same as it does the DATA statement, so you can put it anywhere.
Circumflexes are used to denote scientific notation which leads us to the next section....
Intermediate Stuff
You may want the number to come out in scientific notation (E format) even if the number normally wouldn't. To do this you put four or five circumflexes at the end of the field. Four means you want two digits in the exponent; five means you want three. If you put less than four, they will be treated as text; if you put more than five, the first five will be used, and the rest will be treated as text.There's a little something different about E format. It always reserves the first character for the sign, so you'll need at least two #'s in the mantissa (or precede the field with a sign). Using the same numbers as above, the table can be amended thusly:
##^^^^ ####^^^^ #.####^^^^^ 2 2E+00 200E-02 .2000E+001 -13 -1E+01 -130E-01 -.1300E+002 9.671 1E+01 967E-02 .9671E+001 125.678 1E+02 126E+00 .1257E+003 -.385 -4E-01 -385E-03 -.3850E+000 -3.05 -3E+00 -305E-02 -.3050E+001
This format also estimates whenever it isn't given enough places to express the exact value or tacks on zeroes when given too many. You'll probably not need this format unless you're dealing with exceedingly low or high numbers.Time to switch to another concept. USING can also be used to format text values. No bells or whistles here, though. Any field that can be used to format a number can also be used to format text. Text is just left-justified, and all characters within a field are treated the same. I can give you a table, but I assure you, it's quite boring:
### ###.### -###^^^^ BOB BOB BOB BOB JOHN *** JOHN JOHN 25% OFF! *** ******* 25% OFF!
In general, it makes more sense to use only #'s when constructing a text field. You may want to do something like column 2 if you're printing a table of numbers, and you want to use the same format string for the column headers as in the table.
Of course you can mix numeric and text values for the same format as in something like:
170 IMAGE ##### HAS $###.##. 180 PRINT USING 170:"MARY",123.4 This will print: MARY HAS $123.40.
Note the computer recognizes the period at the end as a period and not as a decimal point since the field already has one. Even if it didn't, it wouldn't make any difference since the decimal point would be printed at the end.
Now suppose you want part of a line formatted instead of a whole line. Don't worry; you can always put a semicolon at the end of a PRINT or PRINT USING statement, so you can stay on the same line for the next PRINT. You can also use this technique if you need to print a # as text instead of a field character. However, you cannot put a comma at the end of a PRINT USING statement or the computer will think you left out a value.Another problem you may have is suppose you want to concatenate two fields, say ## with ###. If you put them together, you get #####, and the computer will see that as one field. Well, you could try using "##-##". The computer will then recognize that as two fields, ## and -##. But if your second field can have three digits, this won't work. If this is the case, you will need to split up the format string into two PRINT USING statements.
Perhaps like this:
190 PRINT USING "##":A; 200 PRINT USING "###":B
You cannot confuse the computer with pound signs, minus signs, circumflexes, decimal points, etc. It will always know where one field ends and another begins. Except in the case like above where two fields collide.I'll give you another way to handle that in....
Advanced Stuff
There isn't very much in the way of advanced stuff because this is such a small subset of a much bigger entity. I always consider undocumented features to be advanced stuff. That's right, boys and girls, USING has an undocumented feature! By "etc." in the above paragraph, I meant the plus sign! It can also be used like the minus sign in a field. What it will do is float the sign in front of the number be it positive or negative. Let me illustrate:+# +### +###.##^^^^ 2 +2 +2 +200.00E-02 -13 ** -13 -130.00E-01 9.671 ** +10 +967.10E-02 125.678 ** +126 +125.68E+00 -.385 -0 -0 -385.00E-03 -3.05 -3 -3 -305.00E-02
If it's negative, you get a minus sign; if it's positive or zero, you get a plus sign. There isn't one word about this in the XB manual. This can be used to write format strings for equations, like this:200 IMAGE ###x^2+##x+## 210 PRINT USING 200:2,7,10 220 PRINT USING 200:-15,-11,1 230 PRINT USING 200:+9,33,-14 This will print: 2x^2 +7x+10 -15x^2-11x +1 9x^2+33x-14
Suppose you don't want it to print those leading spaces when there aren't enough digits to fill the field. This is where you would use a variable for the format string. You would construct it so that each field would only have as many #'s as it needed to print the number (since they're all integers, that can easily be accomplished with LEN(STR$(X))) and concatenate the necessary text and use the variable as the format string. For instance, I have a program that uses a define function like this:240 DEF MF$(X)=" $"&RPT$("#",LEN(STR$(INT(X))))&".##"
That function generates a format string for money so that there will no spaces between the dollar sign and the amount. The reason I did it this way was to get trailing zeroes after the decimal point to look good. However, user-defined function calls take a long time in Extended BASIC, so if need speed or if you only need it once, put a formula like this directly where you need it.There's another manual correction that must be made (although it may have been made already in some addendum I don't know about). The syntax for PRINT USING with files is wrong. I won't reprint it here because I don't like glorifying the incorrect. The correct syntax is as follows:
PRINT [#file-number,[REC record-number,]USING format:print-list That translates specifically as something like: 250 PRINT #1,USING 200:A,B,C 260 PRINT #2,REC 15,USING 200:A*4,B*4,C*4
The file being referenced is most likely the printer, but it could be a disk file. If it is, it must be a DISPLAY format file; you will get a FILE ERROR if is INTERNAL format. Obviously line 260 isn't refering to the printer.PRINT USING is very good for printing to a printer because the printer has so many more columns to print in. So there is a good chance that you may have a program in which a particular PRINT USING is only being used to print to the printer and never to the screen.
If this is the case, there is another solution to the concatenated field problem mentioned in the last section. You can print some unprintable character between the two fields. The computer will then recognize them as two fields but they will be together on the printout! Something like this would be typical:270 A$="##"&CHR$(0)&"###" 280 PRINT #1,USING A$:A,B
CHR$(0) doesn't do anything on most printers, so the two fields will appear consecutive. Note that you couldn't do that in an IMAGE statement since you can only use characters and not expressions. The expression could've also been constructed within line 280 itself.
This should about exhaust the subject of USING except to remind you that you can also use DISPLAY USING if you need to format values somewhere else on the screen (by using the AT option) or if want to BEEP or clear the screen before doing it (ERASE ALL).
Return to top of page
========================================================
Tips from the Tigercub Issue 65.
Note: Jim died a few years back. He contributed some 72 monthly articles to TI user groups. He always formatted them for 28 column printing- here presented as two columns per page.
ONLY print these pages using a fixed width font!
To make the web page look OK I have used the PRE tag.
--------------------------------------------------------
ALL KEY(0,K,S):: IF S<>0 THE No. 65 N 30004 30003 NEXT T :: GOTO 30001 Tigercub Software 30004 IF POS(V$,CHR$(K),1)=0 1N6 Nnuyngwood Ave. THEN 30001 ELSE K$=CHR$(K) ZxCdmbus, OH 43XY3 30005 SUBEND ********* And for a demonstration of the use of that subprogram, My three Nuts & Bolts here is a little game that disks, each containing 100 no one will ever play to the or more subprograms, have end - been reduced to $5.00. I am out of printed documentation 100 DISPLAY AT(3,6)ERASE ALL so it will be supplied on :"THE ULTIMATE TEST":"":" An on disk. swer the question with a num My TI-PD library now has ber according to whether the well over 500 disks of fair- number or color shown," ware (by author's permission 110 DISPLAY AT(8,1):"or the only) and public domain, all note sounded, was 1stor 2nd arranged by"category and as or 3rd, etc." full as possible, provided 120 DISPLAY AT(23,6):"PRESS with loaders by full program ANY KEY" :: DISPLAY AT(23,6) name rather than filename, :"press any key" :: CALL KEY Basic programs converted to (0,K,SS):: IF SS=0 THEN 120 XBasic, etc. The price is ELSE CALL CLEAR just $1.50 per disk(!), post 130 DATA 2,BLACK,3,GREEN,5,B paid if at least eight are LUE,9,RED,12,YELLOW,14,PURPL ordered. TI-PD catalog #5 E and the latest supplement is 140 FOR J=1 TO 6 :: READ C(J available for $1 which is ),C$(J):: CT$=CT$&CHR$(J):: deductible from the first W$=W$&CHR$(J+48):: NEXT J :: order. T=2 :: DL=500 :: V$="12" 150 RANDOMIZE :: T$,NN$=CT$ It is a bit of a nuisance :: FOR J=1 TO T :: X=INT(RND to have to hit Enter after *LEN(T$)+1):: X$=SEG$(T$,X,1 inputting a single character ):: T$=SEG$(T$,1,X-1)&SEG$(T such as Y or N for "yes" or $,X+1,255):: Y(J)=ASC(X$) "no". CALL KEY accepts a 160 X=INT(RND*LEN(NN$)+1):: single character without X$=SEG$(NN$,X,1):: NN$=SEG$( Enter, but has no blinking NN$,1,X-1)&SEG$(NN$,X+1,255) cursor to tell you that it :: S(J)=ASC(X$):: NEXT J :: is waiting. I should have FOR J=1 TO T had this one in my Nuts & 170 Z(J)=INT(89*RND+10):: FO Bolts years ago - the CALL R K=1 TO J-1 :: IF Z(J)=Z(K) KEY WITH CURSOR subprogram! THEN 170 R is the row, C is the TAB 180 NEXT K :: NEXT J :: CALL position, V$ is the valida- CLEAR :: CALL COLOR(3,16,1, tion string, such as "YyNn", 4,16,1) and the character selected 190 FOR J=1 TO T :: CALL SCR is returned in K$. EEN(C(Y(J))):: CALL SOUND(-9 99,110*S(J),0):: DISPLAY AT( 30000 SUB CALLKEY(R,C,V$,K$) 12,12):Z(J):: FOR D=1 TO DL 30001 CALL HCHAR(R,C+2,30):: :: NEXT D :: NEXT J FOR T=1 TO 3 :: CALL KEY(0, 200 CALL CLEAR :: CALL SCREE K,S):: IF S<>0 THEN 30004 N(16):: CALL COLOR(3,2,1,4,2 30002 NEXT T :: CALL HCHAR(R ,1):: X=INT(3*RND+1):: W=INT ,C+2,20):: FOR T=1 TO 3 :: C (T*RND+1):: ON X GOTO 210,23 ====================================== END OF TIPS PAGE ONE ======================================= 0,210 FCTN Z instead of & to under 210 IF X=1 THEN Q$=C$(Y(W))E line, FCTN C instead of @ to LSE IF X=3 THEN Q$=STR$(Z(W) double-strike, and FCTN A ) instead of * to call a value 220 DISPLAY AT(12,1):"WHICH added file. I don't know why WAS ";Q$ :: GOTO 240 Texas Instruments didn't do 230 CALL SOUND(1,30000,30):: that in the first place, and DISPLAY AT(12,1):"WHICH WAS I wonder why the McGoverns ?" :: FOR D=1 TO 200 :: NEXT didn't make that fix. D :: CALL SOUND(500,110*S(W Now, can anyone tell me ),0) how to replace the ^, which 240 CALL CALLKEY(12,20,V$,K$ tends to disappear, and the ):: Q=ASC(K$)-48 period, which will make the 250 IF Q=W THEN DISPLAY AT(1 whole line disappear if it 5,12):"RIGHT!" ELSE DISPLAY happens to be at the begin- AT(15,12):"WRONG!" ning of the line? 260 IF Q=W THEN DL=DL-50 ELS E DL=DL+50 If you are one of the few 270 IF DL<100 THEN DL=500 :: who are still interested in T=T+1 :: V$=SEG$(W$,1,T) recreational computing - the 280 GOUO 150 use of the computer to solve 290 SUB CALLKEY(R,C,V$,K$) puzzles and math problems 300 CALL HCHAR(R,C+2,30):: F just for the fun of it - you OR T=1 TO 3 :: CALL KEY(0,K, might be interested in Rec- S):: IF S<>0 THEN 330 reational and Educational 310 NEXT T :: CALL HCHAR(R,C Computing, published 8 times +2,20):: FOR T=1 TO 3 :: CAL a year at xyz tyulet Terrace L KEY(0,K,S):: IF S<>0 THEN (REC is no more alas) . The 330 annual subscription is $36. 320 NEXT T :: GOTO 300 Program listings are in dia- 330 IF POS(V$,CHR$(K),1)=0 T lects of Basic other than TI HEN 300 ELSE K$=CHR$(K) but usually not hard to con- 340 SUBEND vert. That is where I found this I have warned repeatedly ridiculously short, simple over the years, in these and fast card shuffling rou- Tips and in Micropendium and tine. elsewhere, that printing program listings through the 100 DIM C(52) Funlweb Formatter usually 110 FOR X=1 TO 52 :: C(X)=X results in garbled listings :: NEXT X that cannot be keyed in cor- 120 FOR X=52 TO 1 STEP -1 :: rectly - but I still see the I=INT(RND*X+1) garbled listings published. 130 T=C(I):: C(I)=C(X):: C(X Here is a fix to the Funlweb )=T :: NEXT X FO file that will partially solve the problem - In the same place, I read Boot DSKU. Select 1. File a routine to extract a root Utilities. Select 5. Find to 16-digit accuracy instead String. Enter filename FO of the 8 digits available and the drive number. Enter on a PC from the basic for- H for hex. Enter the string mula ROOT=NUMBER^(1/POWER). 2A23214026 . Enter replace We don't need it - our obso- string 7C2321605C . When the lete 16k 16-bit computer can string is found, enter R for give us 14-digit accuracy replace, then CTRL W, hit from the basic formula! Enter twice to accept the defaults. Thereafter, use The same publication gave ================================================= END OF TIPS PAGE TWO ====================================================me the idea for this little can peek behind the curtain, game - opens one of those you did not pick, and shows a goat. 100 DISPLAY AT(3,6)ERASE ALL Then he offers to let you :"THE GAME OF N":"":"You and change your choice. Should the computer will take tu you switch, stand pat, or rns adding to a num- ber to does it make no difference? reach a goal." You now have a 50-50 bet, 110 DISPLAY AT(8,1):"If you so it makes no difference, reach the goal, you win. Yo right? But some very distin- u get to go first andyou sho guished mathematicians were uld be able to win almost saying you should switch, so every time." I wrote this computer simu- 120 RANDOMIZE :: N=INT(RND*1 lation to prove them wrong. 5)+15 :: R=INT(4*RND+3):: S= Key it in, run it, and be R+1 :: D=N-INT(N/S)*S :: T=0 surprised. Do figures lie? 130 DISPLAY AT(13,1):"The go Do computers lie? Is there al is";N:"":"Maximum input i something wrong with my sim- s";R :: DISPLAY AT(19,1):RPT ulation? $(" ",96) 140 DISPLAY AT(17,1):"Your n 100 CALL CLEAR umber?" :: ACCEPT AT(17,14)S 110 DATA CAR BEHIND,A PICKS, IZE(1)VALIDATE(DIGIT):A :: I HOST SHOWS,A WINS,B WINS,C W F A<1 OR A>R THEN DISPLAY AT INS (15,1):"" :: GOTO 130 120 FOR J=1 TO 3 :: READ M$ 150 T=T+A :: DISPLAY AT(21,1 :: DISPLAY AT(J,1):M$ :: NEX ):"Total is";T :: IF T=N THE T J :: FOR J=12 TO 14 :: REA N DISPLAY AT(23,1):"YOU WIN! D M$ :: DISPLAY AT(J,1):M$ : " :: GOSUB 190 :: GOTO 120 : NEXT J 160 IF N-T<S THEN P=N-T :: T 130 FOR J=1 TO 1000 :: RANDO =T+P :: DISPLAY AT(19,1):"Co MIZE :: X=INT(3*RND+1):: DIS mputer adds";P :: DISPLAY AT PLAY AT(1,13):X !RANDOMLY PL (21,1):"Total is";T :: DISPL ACE CAR AY AT(23,1):"COMPUTER WINS!" 140 A=INT(3*RND+1):: DISPLAY :: GOSUB 190 :: GOTO 120 AT(2,13):A !PLAYER CHOOSES 170 IF T=0 THEN P=D ELSE IF 150 E=INT(3*RND+1):: IF D=X (N-T)/S=INT((N-T)/S)THEN P=I OR D=A THEN 150 :: DISPLAY A NT(R*RND+1)ELSE Y=N-T :: P=Y T(3,13):D :: ! HOST PICKS CU -INT(Y/S)*S RTAIN WITH GOAT 180 T=T+P :: DISPLAY AT(19,1 160 IF A=X THEN AA=AA+1 :: D ):"Computer adds";P :: DISPL ISPLAY AT(12,7):AA ! A DOES AY AT(21,1):"Total is";T :: NOT SWITCH GOTO 140 170 B=INT(3*RND+1):: IF B=A 190 DISPLAY AT(24,8):"PRESS OR B=D THEN 170 ANY KEY" :: DISPLAY AT(24,8) 180 IF B=X THEN BB=BB+1 :: D :"press any key" :: CALL KEY ISPLAY AT(13,7):BB ! B SWITC (0,K,S):: IF S=0 THEN 190 EL HES SE T=0 :: RETURN 190 C=INT(3*RND+1):: IF C=D THEN 190 REC also printed a puzzle 200 IF C=X THEN CC=CC+1 :: D which seemed so simple that ISPLAY AT(14,6):CC ! C CHOOS I could not see why. It goes ES RANDOMLY like this - 210 NEXT J A game show host shows you three curtains. Behind one Here is an improved ver- is a new car, behind the sion of a program that was other two are goats. You in a Tips long ago, to strip choose one. The host, who out the extra blanks from a ===================================== end of tips page three ======================================== Filled and Adjusted Funlweb and change any line reading Formatter file - OPEN #1:"DSK1.FILENAME" - or whatever - to read - 100 DISPLAY AT(3,6)ERASE ALL OPEN #1:DEV$&".FILENAME" :"TIGERCUB UNFILLER":"":" To (don't forget the period be- remove extra spaces from":" fore the filename!). Now you a TI-Writer text which has": can load the program from "been Filled and Adjusted by any drive and it will open " the file on that same drive! 110 DISPLAY AT(8,1):"the For matter, prior to":"reformatt * STRING ASSIGN DEVICE NAME ing." * PLACES DEVICE NAME IN AN 120 DISPLAY AT(15,1):"Input * XBASIC STRING file? DSK" :: ACCEPT AT(15,1 * HARRISON SOFTWARE 6):IF$ :: OPEN #1:"DSK"&IF$, * 8 OCTOBER 1990 INPUT * FOR USE WITH ALSAVE AND XB 130 DISPLAY AT(17,1):"Output * TAKES ONLY 42 BYTES MEMORY file? DSK" :: ACCEPT AT(17, STRASG EQU >2010 17):OF$ :: OPEN #2:"DSK"&OF$ WS EQU >20BA 140 LINPUT #1:M$ :: P=1 DEF DEVICE 150 X=POS(M$,"a",P):: IF X=P DEVICE THEN P=P+1 :: GOTO 150 * USE OUR WORKSPACE 160 X=POS(M$," ",P):: IF X= LWPI WS 0 THEN PRINT #2:M$ :: GOTO 1 * GET THE CRU BASE IN R12 80 MOV @>83D0,R12 170 M$=SEG$(M$,1,X)&SEG$(M$, * GET ROM ADDRESS FOR DEVICE X+2,255):: GOTO 160 * IN R2 180 IF EOF(1)<>1 THEN 140 :: MOV @>83D2,R2 CLOSE #1 :: CLOSE #2 * ENABLE THE ROM LDCR @ONES,0 While a program is run- * ADDING 4 PUTS US AT THE ning, the computer periodi- * LENGTH BYTE cally pauses for a fraction AI R2,4 of a second to do a "garbage * FIRST PARAMETER collection", getting rid of LI R1,1 information it no longer * NOT AN ARRAY VARIABLE needs, to make room in memo- CLR R0 ry. If this pause occurs at * ASSIGN DEVICE NAME TO A a critical moment in program * STRING execution, it can cause pro- BLWP @STRASG blems. Thanks to the Sydney * CLEAR CRU, DISABLE ROM User Group in Australia, LDCR R0,0 here is a CALL LOAD which * LOAD GPL WORKSPACE will force a garbage collec- LWPI >83E0 tion just before that criti- * RETURN TO GPL INTERPRETER cal point - B @>006A CALL LOAD(-31885,144,"",-318 * WORD TO TURN ON ROM IN CRU 58,81,169,152,0) ONES DATA >0101 END Here is a neat one from Bruce Harrison. Key it in, (you can skip the lines that Getting short on memory, start with an asterisk) and so more next time. assemble it, then use ALSAVE to imbed it in any program that opens a disk file. Put Jim Peterson CALL LINK("DEVICE",DEV$) at the beginning of the program ===================================Bruce Harrison is on the web
Return to top of page