ticalc.org
Basics Archives Community Services Programming
Hardware Help About Search Your Account
   Home :: Community :: Articles :: BASIC Library Functions
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: HELP!!!
Person_2000

That same think happened to me. Make sure you have Filelib. It helps. That may still happen, but there is an updated version of Tetris for the Ti-89. It works very well. Give it a try.

Reply to this comment    15 June 1999, 22:39 GMT


Re: HELP!!!
Skawalker  Account Info

gray4lib is an assembly library, NOT a basic one and therefore must be in the same folder as DoorsOS or PlusShell for asm programs like Tetris to access it.

Reply to this comment    10 September 2000, 05:21 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  Account Info
(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: Re: BASIC Library Functions
Jenab6  Account Info
(Web Page)

Ah phooey. Every instance of " → " in my last post is code language for the "right arrow" symbol that you get when you press STO on the calculator.

Reply to this comment    11 September 2008, 02:57 GMT

Re: BASIC Library Functions
Mike Tindal  Account Info
(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"
josh
(Web Page)

To meet the goals you are setting, the goal of every programmer must be to:
1. Become a good assembly programmer
2. Make sure every other programmer is a good assembly programmer

This is almost impossible, as assembly programming is a very difficult subject and very tedious.

Also, as each of these programmers releases beta versions of their programs in assembly, they will inevitably have problems, and we will still have calculators crashing continuously.

I personally am not ready to delve into the complex subject of assembly.

Reply to this comment    19 November 1998, 17:21 GMT


Re: Re: Re: Article: "BASIC Library Functions"
Rix

I don't agree. Assembly language is not at all that hard. The calculators have all got very few bytes of memory and are very slow (at least the basic is). To make fast and small programs it is a must to use assembly language. Maybe on a 450 MHz Pentium II, it is not necessary but on the TI calculators it most certainly is.

Reply to this comment    19 November 1998, 20:13 GMT


Re: Re: Re: Re: Article: "BASIC Library Functions"
Kelly
(Web Page)

I think that TI-BASIC librarys are a good idea, but I honestly dont ever see it implemented. The only programs that are very complex and that are used by many different users are asm programs. Personally, I have my own set of library functions that I use on my TI-89 to do such things as compute matrix exponentials, or do contour integration, but being that these sorts of applications are very specialized to grad level math courses in college, I dont think anybody else might find them useful, especially in writing their own programs. Lets keep libs reserved for asm code only.

Reply to this comment    19 November 1998, 21:38 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: Re: Re: Article: "BASIC Library Functions"
Dux Gregis
(Web Page)

The ti-86 has user defined functions, only that the functions have to be written in assembly. I was thinking about writing a library for grayscale to be used by basic programs, but there are too many difficulties, for example, I would have to recreate all of the normal functions for the second plane like Line( and PixelOff(. Considering that a good grayscale game couldn't be made in basic anyway, there's no point.

Reply to this comment    21 November 1998, 07:16 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

Re: Re: Article: "BASIC Library Functions"
Wayne-O
(Web Page)

THIS is the best idea Ive seen posted here. A ASM prog that can call ASM libraries for use in basic programs would be great, but as for how it would be done, someone with alot more experiance than I would have to figure that out

Reply to this comment    20 November 1998, 00:19 GMT


Re: Re: Re: Article: "BASIC Library Functions"
SPUI

I have fantasized about this for the 86.
Here is how it would work:

PROGRAM: TONTO
:....................
:675->A
:"factor"->asmstr
:STRRUN
:....................

OK, so it's not perfect, but SPUIs aren't. They are troublesome for pedestrians :)

Reply to this comment    20 November 1998, 02:17 GMT

Re: Re: Article: "BASIC Library Functions"
Harper Maddox
(Web Page)

Bill Nagel already accomplished this task with his program "Aurora" for the Ti-83. Do you guys remember the API? I believe he lists the funciton s capable by aurora in 83 assembly. I myself might try to do this during christmas holidays. If anyone else (a serious programmer who can help me) wants to work on this project with me, then give me an email or find me on icq.

Reply to this comment    20 November 1998, 18:39 GMT

Re: Re: Article: "BASIC Library Functions"
Dux Gregis

I posted what I wrote above before I read this, but anyhow, I'm sure the 89/92+ have the same asap things as what the 86 and apparently the 83 have to support functions made in assembly.

Reply to this comment    21 November 1998, 07:24 GMT


Re: Re: Article: "BASIC Library Functions"
Mastab

There already is such a program for the TI-89/plus and it is called BASIC somthing. It is an ASM program and dosn't require any extra libs!

Reply to this comment    15 April 1999, 00:16 GMT

1  2  

You can change the number of comments per page in Account Preferences.

  Copyright © 1996-2012, the ticalc.org project. All rights reserved. | Contact Us | Disclaimer