PDA

View Full Version : Problem with TI-Basic Program



mutantcamel
May 14th, 2009, 01:02 PM
*****

luckybob
May 14th, 2009, 08:23 PM
its because you are trying to use v$ as a dim. you are trying to comare an entire list to a single part of the list.

That is what stands out to me.

chuckcmagee
May 14th, 2009, 08:50 PM
Well, close there Bob.

V$ is a single string variable.
V$(1) is an array of string variables

As in, DIM V$(12) would be an array of 12 string variables

So V$ is one kind of thing and V$(I) is another.

If you are limited to single letter variables then you need some other name for V$(1), like Z$(1). I don't think you can name a single string the same as a array of strings.

i.e. " already defined "

chuckcmagee
May 14th, 2009, 09:05 PM
The easiest fix is to find where the verb array V$(25) is initialized and change to VP$(25)

then change 310

310 IF V$=VP$(I) THEN VB=I

chuckcmagee
May 14th, 2009, 09:13 PM
Of course, you then have to look thru the entire program for other V$( and change them all to VP$(

Terry Yager
May 14th, 2009, 09:27 PM
Of course, you then have to look thru the entire program for other V$( and change them all to VP$(

Or better yet, write some kinda program to do that for you...You could call it an 'Editor', with a 'Search' feature...

--T

chuckcmagee
May 14th, 2009, 11:44 PM
As that code is doing a table lookup for the correct verbs, it is pretty likely that line 310 and where the table is setup are the only 2 places it is used.

So, go down to line 1600 and start looking for the initialization code.

mutantcamel
May 15th, 2009, 09:01 AM
*****

chuckcmagee
May 15th, 2009, 06:41 PM
Put all the "DIM" statements close to where you define V,W, etc.

Just "edit 1600" and change the line number to 74, press enter, do the same for the next line. That way the variables and arrays will be defined earlier.

You can leave where they are initialized alone. You will next a dummy 1600 line if you leave the gosub 1600 line, like 1600 REM

mutantcamel
May 16th, 2009, 01:44 AM
Thanks.

I now get an invalid dimension error for part of the gosub line: DIM VP$(V) and DIM O$(W)

It seems to accept D$ and R$ as they both have numbers within the brackets, but not letters...

my cc-40 book says the one dimensional array takes the form:

dim array-name(integer-constant)

so I'm gonna somehow replace with v and w with numbers....aswell as for line 1610

1610 DIM C(W),L(G),F(W)

chuckcmagee
May 16th, 2009, 02:15 AM
I thought of that, the fact that using a variable might not work but I tried it with my Tandy 200 and it worked so I thought maybe I was wrong.

mutantcamel
May 16th, 2009, 02:53 AM
God knows how I'm gonna do it though....:(

chuckcmagee
May 16th, 2009, 04:37 AM
1610 DIM C(W),L(G),F(W)

Huh, you lost me on that one.

How about

1610 DIM C(36),L(18 ),F(36)

mutantcamel
May 16th, 2009, 07:34 AM
*****

chuckcmagee
May 16th, 2009, 02:27 PM
You missed 1690 on the VP$ to Z$ changes

mutantcamel
May 17th, 2009, 02:18 AM
Thanks, but it makes no difference, it's line 1600 again, the variable has been previously defined error still!! Ah well!

Ksarul
May 17th, 2009, 08:00 AM
Is it possible one of your four defined DIM objects in line 1600 is one of the predefined/reserved objects in the CC40 ROM?

Try and separate each of them to a separate line to find out which one is the problem and try renaming just that one--of course, it is possible that all of them will give issues, so rem out the first one that causes problems after it errors just to see if it passes any of the others through OK.

mutantcamel
May 17th, 2009, 11:58 AM
I tried that but it says "already defined" for each one of the dims. I'm thinking it's due to the position of the gosub in the program. The thing is I've tried putting it at the beginning (lines 1600-1650) and now I get this same error the 1st time V$ is listed again in the program

240 V$="":W$="":VB=0:OB=0

What I could do with is someone who is good with TI-BASIC who could rewrite the program for me! I think it'll need several changes.....money is not a problem!!!

ahm
May 18th, 2009, 09:50 AM
We're going to need a manual for this mysterious TI Enhanced BASIC.

I've started messing with your program in MBASIC on CP/M (because I have it handy).
First thing I notice is there's not enough data items to correctly fill R$.

carlsson
May 18th, 2009, 11:29 AM
The nice thing about Basic is that everyone can have their own dialect!

It is possible that your TI Extended Basic doesn't support arrays of strings at all. If the Extended Basic on CC-40 is anything like Extended Basic on the TI-99/4 series, you should replace LEFT$, MID$ and RIGHT$ by various SEG$ which has the same syntax as MID$.

Generally string handling is something that can be done in many ways. The MID$ style is Microsoft Basic compatible, while e.g. Sinclair Basic uses A$(1 TO ..) which also means DIM A$(10) on the ZX Spectrum means reserve room for one string that is 10 characters long, not ten strings of arbitrary length.

Aha, I downloaded the TI Extended Basic manual. Although it is for the TI-99 computer, for now I would presume the dialect is the same as on the CC-40. Correct me if I'm wrong.


If you dimension an array, the DIM statement must appear in the program at a lower numbered line than any other reference to the array.

Browse to page 40 of 130:
http://www.digitpress.com/library/manuals/ti994a/ti%20extended%20basic.pdf (9 MB large file)

It means you have some reshuffling to do, move the subroutine from line 1600 to the beginning of the program.

ahm
May 18th, 2009, 11:56 AM
No need to reshuffle. Just move the DIM statements to the top of the program.

mutantcamel
May 19th, 2009, 08:56 AM
I just realised myself the TI uses SEG$ and not MID$, so have corrected those lines.

I've moved the 2 lines with the dim commands to the top of the program.

The program now starts, but it's not linking to the data commands at the mo, do I need to stick all those to the top aswell, 1620 onwards? That would mean a lot of renumbering! Just use a goto instead?

At the moment I get the messages "Your Location" then nothing, followed by "Exits" etc....

It then let's me type in a command but I get a string number mismatch error on line 390 when I do:

390 IF VB>V AND OB>0 THEN M$="YOU CAN'T '"+Q$+"'":PAUSE 1.5

The CC-40 manual btw is available at:

ftp://ftp.whtech.com/hexbus_cc40_ti74/CC40%20user%20guide/

You will to load a paper port reader to view the files though in .max format...

ahm
May 19th, 2009, 12:07 PM
The program now starts, but it's not linking to the data commands at the mo, do I need to stick all those to the top aswell,


No, you should be able to have DATA statements anywhere in the program.
(Of course, having seen what this weird BASIC dialect requires of DIM statements,
I'm not making any promises).

carlsson
May 19th, 2009, 12:55 PM
TI Extended Basic does not use + to concatenate strings. You should replace those with & signs:

390 IF VB>V AND OB>0 THEN M$="YOU CAN'T '"&Q$&"'":PAUSE 1.5

I'm not sure if PAUSE exists neither, but you'll find out if it does and for how long it will pause.

Edit: Ok, browsing through the reference manual you really have PAUSE using that syntax, so no worries. It also says DATA can be anywhere in the program, but you may not have other commands on the same line as a DATA statement. I suppose you need to be experienced in other Basics to know what to look for could be different in the dialect you're currently working with. For an untrained eye two slightly different statements may look very much alike.

mutantcamel
May 20th, 2009, 04:28 AM
I put the pauses in myself, cos the display of a CC-40 is only a single line, without a pause the message is not visible by the naked eye! The longer the text, the more time I give in order to read it.

As for using + signs I'm sure I've used them in CC-40 basic before...but I will give & a try it out when I get home....

Also I'm gonna have to rewrite the READ lines as I think the cc-40 only responds to numbers in brackets and not letters...

Not really sure what I'm doing...but it's all good fun!

carlsson
May 20th, 2009, 06:12 AM
Perhaps you added numerical variables?

A=3:B=4:C=A+B
PRINT C
7

A$="3":B$="4":C$=A$&B$
PRINT C$
34

ahm
May 21st, 2009, 09:22 AM
Did we ever find out what book this is in?

I might be interested in trying this on MBASIC.

mutantcamel
May 22nd, 2009, 06:42 AM
I have the book at home. Maybe I'd give you the title if you help to get this to work on mine first! The program I listed is the entire program though

mutantcamel
May 23rd, 2009, 04:46 AM
The book is called "Write your own Adventure Programs for your Microcomputer" ISBN - 0-86020-741-2

JGardner
June 14th, 2009, 10:14 AM
CC40 BASIC is a subset of TI Extended BASIC.

N=3:DIM A$(N)! is not valid.

N must be explicit, ie 7, 32, or whatever. Also, the 1st element is 0,
not 1 - A frequent source of confusion.

As previously noted, SEG$, not MID$. Another foo factor is that if
you allow 0 as the 2nd parameter in a SEG$ you'll get an error.

I was digging through some old files this weekend and found a DOS
executable I wrote about 20 years ago that will take a ASM7 .LST
file and turn it into a *.B74 file, as in

100 CALL POKE(ADR,BYTE0,BYTE1,BYTE2, ...)
110 CALL POKE(ADR+10, ...)

And so on. Useful for CC40/TI74 asm routines.

If anyone can use it let me know.

Jack

JGardner
June 14th, 2009, 10:17 AM
Oops. Should be...

N=DIM A$(N)! is not valid.