BASIC Library Functions
|
Posted on 19 November 1998
The following text was written by Dennis Lambe
Jr.: The power of the TI-89/92/92+ calculators still amazes me. Their
advanced symbolic math capabilities have revolutionized the way I thought of calculators.
But what is even more amazing to me than what they do is what they can do. When TI
introduced the incarnation of TI-BASIC used by these calculators, including the ability to
create functions and pass parameters, a doorway was opened for the functionality of these
calculators to be expanded limitlessly. This makes me wonder why a common library of
utility functions and programs haven't been developed to make it easier to write more
complicated calculator aplications without duplicating code and wasting time. I
have developed a number of these utilities, but I never released them for one, rather
embarassing reason: my overuse of ASM games has caused my calculator to crash before I could
back up my most favorite creations. However, I continue my work, and I invite the rest of
the TI community to join me. With that in mind, I have developed a few standards that will
make an organized effort easier. First of all, I suggest that every "library"
utility be placed in a folder named "libs", thus keeping the main folder from getting
cluttered and providing a place for permanent data to be stored. A variable named
"calctype" should be kept in this folder, and it should contain either "92", "92+", or "89",
depending on the calculator it exists on. This will allow graphics routines to be written
that can be run on any of the three calculators without the need for editing. Most
importantly, the routines should be coded in such a way as to work no matter what folder
they are executed from, since many complicated programs often exist in their own folders.
As for what these routines should do, I leave that up to your imaginations. I
myself am working on a Long File Name system to hold saved games, Organizer information, or
whatever. I've actually already written one, and am simply adapting it for use by multiple
programs. Oh, and I've cut back on my game playing, so maybe you'll actually get to
see it before it gets erased :-)
|
|
Reply to this item
|
HELP!!!
|
Fran Frisina
|
Okay, I got my first little game (tetris) and tried to run it, then it said "LIBRARY NOT FOUND: gray4lib." However, I DO have that lib and the other required in my LIBS folder!
Help!
E-mail me please!
franf@hhs.net
|
Reply to this comment
|
8 May 1999, 03:39 GMT
|
|
Re: Article: "BASIC Library Functions"
|
John Kabakoff
|
There is a Basic library out right now for the TI 89 it is called BasicLib. It was written by a French guy named Alban Gervaise(SP?). It allows you to invert text,simplify sprite routines,right in the status bar,change fonts,turn the calculator off and more all in basic by storing the commands as a string to the variable b_l and calling the library. I think it is a vary nifty little program that allows basic programmers to add cool affects to games/programs. I say that basic libraries are cool and needed for basic programmers that have no clue about ASM.
thank you for your time,
John Kabakoff
|
Reply to this comment
|
30 May 1999, 23:56 GMT
|
|
Re: BASIC Library Functions
|
Jenab6
(Web Page)
|
I got my TI-89T, HW4, OS 3.01 in the mail yesterday, and today I have my first ever TI-BASIC program. I'm really proud of it. It converts a calendar date into a Julian date, which astronomers like to use because it makes finding time differences in days easy.
You can add it to your library if you want. Here's the code. I haven't got the cable stuff figured out yet.
:julian()
:Prgm
:ClrIO
:InputStr "CDATE (YYYY.MMDD)",cd
:InputStr "UT (HH.MMSS)",ut
:expr(left(ut,2))→h
:expr(mid(ut,4,2))→m
:expr(mid(ut,6,2))→s
:(h+m/60+s/3600)/24-1/2→t
:expr(left(cd,4))→y
:expr(mid(cd,6,2))→m
:expr(mid(cd,8,2))→d
:If m>2 then
:0→n
:Else
:-1→n
:EndIf
:1461*(y+4800+n)→j1
:int(j1/4)→j1
:m-2-n*12→j2
:int(367*j2/12)→j2
:y+4900+n→j3
:int(j3/100)→j3
:int(3*j3/4)→j3
:j1+j2-j3-32075+d+t→j
:Disp "JDATE:,j
:EndPrgm
If the date is 10 September 2008 (enter 2008.0910) and the time is 12h UT (enter 12.0000), then the Julian Date is 2454720.0 if you have your calc output set to approximate.
|
Reply to this comment
|
11 September 2008, 02:54 GMT
|
|
Re: BASIC Library Functions
|
Mike Tindal
(Web Page)
|
I agree. I am writing a set of libraries for the TI-89 that I think would be helpful to the games I write. Rewriting code wastes a lot of time, so if you only had to write it once, it would make life a lot easier.
- Never trust your reality. Nothing is as it seems.
|
Reply to this comment
|
9 September 2000, 03:53 GMT
|
|
Re: Article: "BASIC Library Functions"
|
Mark Driggs
|
Basic libraries sound great, especially for the lay calculator user. I can't program much more than basic, and the code tends to be tedious. However, the idea isn't that lofty and really won't make an impact in my opinion. By all means, go ahead and library away, but machine code is where all the library efforts should go. I'll have to agree with you on the confusing folder layout. I don't want to type parenthesis or slashed to run my programs, I like point and click (or in the case of ti, push and push).
|
Reply to this comment
|
19 November 1998, 10:57 GMT
|
|
Re: Article: "BASIC Library Functions"
|
EC
|
That's not a good idea.
The control over the calculator with BASIC is
so limited. I personally, hate BASIC graphics
on my 92, because whenever it happens, I have to
see those graph menus, and it usually changed
my Graph settings, etc.
There is a thing called: ASSEMBLEY
So why not use that???
If all programs were written by good programmers,
there wouldn't be such many crashes, and it
would have been more enjoyable
|
Reply to this comment
|
19 November 1998, 15:20 GMT
|
|
|
|
|
Re: Re: Article: "BASIC Library Functions"
|
Jeff Tyrrill
|
Assembly is usually only better than TI-Basic for games, not math, and still, any type of program can be written with TI-Basic much more easily than in assembly. The TI-92/89's TI-Basic is especially powerful because it contains many programming functions the TI-8x calculators lack, like true user-defined functions, local variables, indirection (converting a string to a variable name), and the ability to store/display specific areas of the graph screen as pictures rather than the whole screen (good for games). Only poorly written TI-Basic programs screw up calculator settings and the graph screen. To prevent this, insert the following code at the beginning of a TI-92/92+/89 Basic program:
Local modestr,curgdb,funcgdb
getMode("ALL")\->\modestr
StoGDB curgdb
ClrGraph
setMode("Graph","FUNCTION")
StoGDB funcgdb
FnOff
PlotsOff
setGraph("Grid","OFF") ;if your program needs it
setGraph("Axes","OFF") ;if your program needs it
setGraph("Labels","OFF") ;if your program needs it
ClrDraw
setMode("SPLITSCREEN","FULL")
and insert the following at the end of the program to restore the settings:
RclGDB funcgdb
RclGDB curgdb
setMode(modestr)
If you're frustrated because programs other people have written screw up the graph screen, just write your own program that has the above code, and calls the program you want to run in the middle.
TI-Basic is quite powerful, even for games, and definitely for math, and libraries will encourage people to write more programs.
|
Reply to this comment
|
21 November 1998, 03:29 GMT
|
|
|
|
|
|
|
|
Re: Re: Re: Article: "BASIC Library Functions"
|
House
|
On the TI-92 Plus and the TI-89 (not avail on regular 92, mind you), there is a NewProb function that clears all a-z variables, turns off function and stat plots (FnOff, PlotsOff), and performs ClrDraw, ClrErr, ClrGraph, ClrHome, ClrIO, and ClrTable. You could use this to shorten the header in Jeff's example and add a few extra commands at the same time.
|
Reply to this comment
|
21 November 1998, 06:04 GMT
|
|
Re: Article: "BASIC Library Functions"
|
Dormando
(Web Page)
|
Most likely, one of the reasons for such a thing would be the fact that most people just don't have the time to program assembler for these calculators. The thing about assembler programs is that it takes time. It would be great to be able to program basic routines (even though it is mundane and slow), the basic is a lot better on the 89/92/92+.
Still, real geeks use assembler :)
|
Reply to this comment
|
19 November 1998, 21:46 GMT
|
|
Re: Article: "BASIC Library Functions"
|
Master Nick
(Web Page)
|
I agree, libraries are needed for basic programming. I program for the Ti-85, and basic code takes up a lot of space, so libraries would be useful. They can also be useful for certain complex routines that beginning programmers need. For example, if you didn't know how to use the getKy function, and you wanted to make some sort of a menu, you could just download the library and use it in your program. So not only will it allow beginning programmers to make more advanced applications, but it will allow a standard for certain functions, programs will take up less space, and can be faster(if the programmer of the library optimizes the code). I, myself am working on a library for basic programming. It will be something like Turbo Vision which is OOP libraries for Turbo Pascal.
|
Reply to this comment
|
19 November 1998, 21:49 GMT
|
|
Re: Article: "BASIC Library Functions"
|
agent double "O-SH*T"
|
i for 1 agree with you and i will probably make some of my own libs
|
Reply to this comment
|
19 November 1998, 22:03 GMT
|
|
Re: Article: "BASIC Library Functions"
|
Quija13
|
How about making an asm program that allows basic programs to call it and then it in return uses the asm libraries? Kind of like a bridge between basic programs and asm libraries
|
Reply to this comment
|
19 November 1998, 23:00 GMT
|
|
1 2
You can change the number of comments per page in Account Preferences.
|