Jump to content
IGNORED

BASIC Cross Reference Program?


ballyalley

Recommended Posts

In the May 1984 issue of "Compute!" magazine, there was a utility by Jim Butterfield for the Commodore 64 (and PET/CBM) called "CROSS-REF." The program "will analyze a BASIC program stored on disk and give you information on all line number references and all variable references." For complete a complete discription about the program, here's a link to the original article:

http://www.atarimagazines.com/compute/issue48/299_1_A_BASIC_Cross-Reference.php

Was a program like "CROSS-REF" written for the Atari 8-Bit computers?

Link to comment
Share on other sites

Hmmm,

 

there are some similar programs on the A8 available, XREF comes to mind:

http://gury.atari8.info/details_software/151.php

 

Think I have collected some of these old programs on a disk-image, named VARIABLE.ATR or something similar. Will check tomorrow and when found, will upload the image here...

Link to comment
Share on other sites

In the May 1984 issue of "Compute!" magazine, there was a utility by Jim Butterfield for the Commodore 64 (and PET/CBM) called "CROSS-REF." The program "will analyze a BASIC program stored on disk and give you information on all line number references and all variable references." For complete a complete discription about the program, here's a link to the original article:

 

http://www.atarimagazines.com/compute/issue48/299_1_A_BASIC_Cross-Reference.php

 

Was a program like "CROSS-REF" written for the Atari 8-Bit computers?

Yes.

From Antic Vol. 3, issue 4, August 1984. By Bill Brown

 

Here's a MYDOS453.ATR with CROSSREF.BAS on it.

MYDOS453.ATR

Link to comment
Share on other sites

I was going to suggest the wedge called Extended BASIC but I just discovered it tends corrupt MyDOS 4.53/3 and 4.53/4 and with SDX I can't exit BASIC once I've entered it.

 

Extended BASIC added a handful of features to Atari BASIC, two of them being a cross reference and a quick reference.

 

The cross reference feature, XREF, is quite fast and you can route the output to any CIO device.

 

-SteveS

Link to comment
Share on other sites

There were *lots* of these written for the A8. Most of the mags published at least one.

 

APX -- (check Atarimania for the APX Basic Utility Diskette). The disk is in the Utility section and the docs (PDF) are in the Manuals section.

 

In addition, BASIC XL and BASIC XE had these built in to them as LVAR. If you look in the Atarimax forum in the MyIDE-II section, there is the BASIC XL rom that runs from the MyIDE-II FAT-32 loader (if you have the MyIDE-II cart).

 

Analog published a ML utility in the June, 1987 that resided on page 6 -- Variable Searcher, and it should do what you are looking for.

 

...lots of these utilities are available.

 

-Larry

Link to comment
Share on other sites

Yes.

From Antic Vol. 3, issue 4, August 1984. By Bill Brown

 

Here's a MYDOS453.ATR with CROSSREF.BAS on it.

 

Thanks for the recommendation of CROSSREF.BAS. I am trying it on the original "Temple of Apshai" program, which was written in BASIC. I downloaded the program from AtariMagazines.com and then I used "TYPO" to make sure that the program is correct. It was accurately typed. Good. I ran CROSSREF on itself. It worked fine. I ran CROSSREF on one of the programs on the Apsahi disk (INN.BAS, which is 134 sectors) and it works okay. The other program on the Apshai disk (DM.BAS, which is 148 sectors) makes CROSSREF crash with an Error 9 ("Array or String DIM Error). I guess that DM.BAS has too many variables. Do you know of any workaround for this?

 

I'll try some of the other recommended variable listing programs next week, when I get the chance.

Link to comment
Share on other sites

 

Thanks for the recommendation of CROSSREF.BAS. I am trying it on the original "Temple of Apshai" program, which was written in BASIC. I downloaded the program from AtariMagazines.com and then I used "TYPO" to make sure that the program is correct. It was accurately typed. Good. I ran CROSSREF on itself. It worked fine. I ran CROSSREF on one of the programs on the Apsahi disk (INN.BAS, which is 134 sectors) and it works okay. The other program on the Apshai disk (DM.BAS, which is 148 sectors) makes CROSSREF crash with an Error 9 ("Array or String DIM Error). I guess that DM.BAS has too many variables. Do you know of any workaround for this?

 

I'll try some of the other recommended variable listing programs next week, when I get the chance.

There are two cross refs on the mydos453.atr, 'crossref.bas' and 'xref.bas'. The thing you might try is when you get the dim error, note the line number and look at that line to see

what string variable (XXX$(Y,Y)) is there. You can then try increasing the size of the string variable at the beginning of the program. You can even try to maximize the offending $ variable.

You might also see at what element is too big (the Y,Y in my example).

 

Lemme see.

X=FRE(0)

DIM X$(X-500)

something like that.

 

(Looking at the code listing). you could change line 110 to something like this:

110 DIM LABEL$(256),VNPTR(256),VNEND(256),SOURCE$(20),TARGET$(20)

But then, you needn't change all of them, just the offending one that is reported in your error causing line.

There is plenty of room to increase the variables. The other possible error cause is a byte number greater than 255.

You can figure it out from the code of the error line.

If you want, run it again and write down the error info and post it here.

Edited by russg
Link to comment
Share on other sites

There are two cross refs on the mydos453.atr, 'crossref.bas' and 'xref.bas'. The thing you might try is when you get the dim error, note the line number and look at that line to see

what string variable (XXX$(Y,Y)) is there. You can then try increasing the size of the string variable at the beginning of the program. You can even try to maximize the offending $ variable.

You might also see at what element is too big (the Y,Y in my example).

 

Lemme see.

X=FRE(0)

DIM X$(X-500)

something like that.

 

(Looking at the code listing). you could change line 110 to something like this:

110 DIM LABEL$(256),VNPTR(256),VNEND(256),SOURCE$(20),TARGET$(20)

But then, you needn't change all of them, just the offending one that is reported in your error causing line.

There is plenty of room to increase the variables. The other possible error cause is a byte number greater than 255.

You can figure it out from the code of the error line.

If you want, run it again and write down the error info and post it here.

I tried CROSSREF.BAS on TEMPLE.DUN 130 sectors. It didn't work. I enlarged the DIMs and it went along but failed. I think line 2060 was where I got

a error 9, NV went above 128. It could be crossref.bas just doesn't work on large BASIC files.

Link to comment
Share on other sites

Just as an aside -- what started all this was Adam (BallyAlley) and I having a discussion in e-mail, about the details of the Commodore 64 version of the "Temple of Apshai" game. (Not the Trilogy version of Apshai. That version came a few years later than the one he and I and another person were discussing.)

 

Somewhere in that conversation, I had brought up the idea of how much I loved the C64's "CrossRef" program, by Jim Butterfield ... and I had mentioned to Adam that I had re-written the BASIC portion of that (hybrid Basic / machine language) program, to send the output either to the screen -OR- to a file on a floppy disc drive (instead of screen or printer) ... etc., etc. ... and I was just stoked, in general, that I had gained a version of Jim's great old program, which didn't need to have its output sent to the screen -- (which is useless, for programs of that size) -- and which didn't need to go to a printer, either. In that context, I had off-handedly asked if the Atari 8-bit computers had some similar program. (Which Adam asked, over here; above.)

 

Sounds like there's a lot of CrossRef type programs for Atari 8-bits ... as written by various parties, back in the day ... but I guess my original question, to Adam, was if there was a conversion of that one specific program, by that one specific author. (Since I had always loved how great that program is, for the Commodore series of computers.)

 

So ... are any of the actual Cross Ref "type" of programs, conversions of what Butterfield had done on the C64?

 

I'm not trying to knock the other programs. Just wondering what's out there.

Link to comment
Share on other sites

I was going to suggest the wedge called Extended BASIC but I just discovered it tends corrupt MyDOS 4.53/3 and 4.53/4 and with SDX I can't exit BASIC once I've entered it. [...] Extended BASIC added [...] cross reference and a quick reference.

 

I don't mind if the wedge called "Extended BASIC," doesn't work with MyDOS, as I usually just use DOS 2.0s. I'm trying to find a program that I like best; thus, I'd like to try this wedge. However, I can't seem to find this "Extended BASIC" wedge anyplace. I've tried AtariMania and other similar places with no luck. Can you point me to a link? Or at least maybe who wrote or released it?

Link to comment
Share on other sites

I'm still having trouble getting a BASIC variable cross-reference of one of the Temple of Apahai's BASIC programs. I've thus far used:

  1. "CROSSREF.BAS" - This BASIC program works fine with INN.BAS, but it fails with DM.BAS. The error message is "ERROR 9 at LINE 2060." This translates to "Array or String DIM Error." Since so many cross reference programs have been named so far, I have not yet tried the advice of "russg" to change the DIM (see his posting for details).
  2. "Variable Searcher" - This ML programs works fine with INN.BAS, but it fails with "DM.BAS" The error that it gives is "ERROR 4" which means: "TOO MANY VARIABLES."
  3. "XREF" - BASIC program which is very slow, even when using Altirra's warp speed. XREF works fine with INN.BAS, but it fails with DM.BAS. The BASIC error message is: "ERROR 5 AT LINE 12110" and then "STOPPED AT LINE 20010" Error 5 is "String Length Error."

I'm beginning to suspect that the INN.BAS program has problems. It was taken from a copy protected disk. See this posting for the version of INN.BAS that I'm using:

http://atariage.com/forums/topic/230278-temple-of-apshai-read-files-from-atx-disk-image/?do=findComment&comment=3082522

Can anyone get a variable cross-reference of INN.BAS using any of the programs mentioned thus far in this thread?


Link to comment
Share on other sites

 

I don't mind if the wedge called "Extended BASIC," doesn't work with MyDOS, as I usually just use DOS 2.0s. I'm trying to find a program that I like best; thus, I'd like to try this wedge. However, I can't seem to find this "Extended BASIC" wedge anyplace. I've tried AtariMania and other similar places with no luck. Can you point me to a link? Or at least maybe who wrote or released it?

I can't seem to find it on my hard disk but I found it here:

http://www.umich.edu/~archive/atari/8bit/Unverified/Cislib_a/extbas.obj

 

Just rename it as AUTORUN.SYS on your DOS 2.x disk and boot to BASIC. Extended BASIC will 'wedge' itself in place.

 

Here's the documentation: http://www.umich.edu/~archive/atari/8bit/Unverified/Cislib_a/extbas.doc

 

There was a newer version but I have no idea what I did with that.

 

-SteveS

  • Like 1
Link to comment
Share on other sites

I'm still having trouble getting a BASIC variable cross-reference of one of the Temple of Apahai's BASIC programs. I've thus far used:

  1. "CROSSREF.BAS" - This BASIC program works fine with INN.BAS, but it fails with DM.BAS. The error message is "ERROR 9 at LINE 2060." This translates to "Array or String DIM Error." Since so many cross reference programs have been named so far, I have not yet tried the advice of "russg" to change the DIM (see his posting for details).
  2. "Variable Searcher" - This ML programs works fine with INN.BAS, but it fails with "DM.BAS" The error that it gives is "ERROR 4" which means: "TOO MANY VARIABLES."
  3. "XREF" - BASIC program which is very slow, even when using Altirra's warp speed. XREF works fine with INN.BAS, but it fails with DM.BAS. The BASIC error message is: "ERROR 5 AT LINE 12110" and then "STOPPED AT LINE 20010" Error 5 is "String Length Error."

I'm beginning to suspect that the INN.BAS program has problems. It was taken from a copy protected disk. See this posting for the version of INN.BAS that I'm using:

 

http://atariage.com/forums/topic/230278-temple-of-apshai-read-files-from-atx-disk-image/?do=findComment&comment=3082522

 

Can anyone get a variable cross-reference of INN.BAS using any of the programs mentioned thus far in this thread?

 

 

 

I got INN.BAS to cross ref, using my modified CROSSREF.BAS from Antic (mine is called MYREF6.BAS, on the MYXREF.ATR in the zip)

The .REF files are ATASCII. The .ASC files are ASCII (for PC). INN.BAS I did successfully. DM.BAS is just too big to do in one piece,

so I broke into two parts (DM1.LST and DM2.LST, which you have to SAVE into tokenized BASIC to run MYREF6.BAS on.)

DM.BAS has 2800 variable references, too many for any cross ref I could find.

CROSSREF.zip

Link to comment
Share on other sites

Adam, did you perhaps post the summary portion of your initial question (in post #13) "backwards"? Double-check your question's summary, as posted above, please.

 

 

re: 2800 different variable references, in one part of the Atari's code

 

 

Hmm. I wonder how many of that large number of references are "repeats" of previous ones?

 

Any idea if that's a possible problem here?

 

I partly ask because the C64 Cross-Ref program by Jim Butterfield had no problem with the C64's code -- and that's basically a "one-piece" combo of the Dungeon and Inn pieces of code. So, the C64 version should be larger than both "halves" for the Atari version; or so I would think. And all ports -- (as far as I know, anyway) -- of the game, on various computers, seem to be using a generic "engine" with only a small amount of changes. (Other than those required for varying display devices, sound devices, etc.)

 

So, if correct, that would seem to imply that the cross reference programs used to date, on the Atari version of the code, aren't as robust as might be hoped. (Yes, no?)

 

I guess that surprised me. The program for the C64, by Jim Butterfield, as originally published as a type-in program in Compute! magazine, not only listed every variable (of any type) in an alphabetized way, but also made a complete reference listing of every single line of BASIC code which got "called" by any other line in the program. And I've used it a LOT, over the years, with various pieces of code written by various authors (including my own BASIC code). So, I'm surprised Adam's having this many problems, on the Atari side of things. Hopefully, one of the programs will work out fine, sooner or later ... but if not, maybe some Atari coder could do a "port" of Butterfield's code?

Link to comment
Share on other sites

The .REF files are ATASCII. [...] DM.BAS has 2800 variable references, too many for any cross ref I could find.

 

The .REF files are not included in the archive, but I don't need them.

 

DM.BAS is split into two reference files (DM1 and DM2). These files contain many of the same variables (and I understand why that is-- no need to explain). Without having to hand-edit the files, can you think of any way to combine the files so that all the instances of each variables are grouped together?

 

Thanks for creating the cross-reference files-- I was beginning to wonder if I'd be able to make this work at all. AtariAge forum members are a unique breed-- and all the personal help that I get here just is another reason to keep coming back.

Link to comment
Share on other sites

Adam, did you perhaps post the summary portion of your initial question (in post #13) "backwards"?

I re-read the posting. Nope. It's posted in the order it was written.

 

I wonder how many of that large number of references are "repeats" of previous ones?

Well, there are no repeated lines from file to file, BUT, there CAN be repeats. For instance, if a BASIC line uses a variable more than once, then that line number will be listed several times in the cross-reference file. Here is an extreme example for line 5040:

 

5040 P(U1)=XA-V1:P(U2)=YA-W2:P(U3)=P(U1): P(U4)=P(U2): P(U0)=P(U2)

 

The DM cross reference file for the P( variable begins like this:

 

P(

12 5040 5040 5040

5040 5040 5040 5040

5040 5283 5283 5296

 

In this example line 5040, variable P( is listed 8 times. That's exactly how many times the variable is used in that line. I'm not sure if this might be considered extreme, but I like that the cross-reference program works this way.

 

 

I partly ask because the C64 Cross-Ref program by Jim Butterfield had no problem with the C64's code -- and that's basically a "one-piece" combo of the Dungeon and Inn pieces of code.

You have to remember that the Atari 800 was originally released with 8K (or was it 16K?). In order for as many users as possible to use published programs, many of the programs in the Atari magazines are written for computers with 32K. Even though you might have owned an Atari 800XL with 64K or a 130XE with 128K, the program would not have taken advantage of that. I'm not sure if this is the trouble with the cross-reference programs that I used, but it's an example of what MAY be a reason that the DM.BAS code has to be split into two pieces in order to work.

 

[That] would seem to imply that the cross reference programs used to date, on the Atari version of the code, aren't as robust as might be hoped [that they would be]. (Yes, no?)

Check out the output and see what you think. I'm sure that if I continued to look through the other cross-reference programs that I'd eventually find a program that would work without splitting the DM.BAS file. But now it doesn't matter, as I have the information that I wanted. However, if someone does happen to know, off-hand, of a program that would work without splitting large BASIC programs, then perhaps I'll try that in the fuuture.

 

maybe some Atari coder could do a "port" of Butterfield's code?

Well, that would be some job! Especially since I've only ever seen Butterfield's Cross-Ref printed in a BASIC loader format and not in an assembly listing. Even is the source code were available (and I bet that it is someplace), it would probably just be easier to modify an Atari program already written to use more memory. Perhaps such a program could even take advantage of extra RAM above 64K.

Link to comment
Share on other sites

here's the xref (and qref) of dm.bas to go with the same for inn.bas which I uploaded earlier. These were all outputted from Extended BASIC.

 

Thanks for the listing (as well as the link to the Extended BASIC program). The spacing of the output is pretty unusual; It's hard to tell where one variable's line number listing begins and another ends. I did notice at the end of the listing that some variables are in memory but are not referenced by any line numbers. I understand that this is normal.

Link to comment
Share on other sites

 

The .REF files are not included in the archive, but I don't need them.

 

DM.BAS is split into two reference files (DM1 and DM2). These files contain many of the same variables (and I understand why that is-- no need to explain). Without having to hand-edit the files, can you think of any way to combine the files so that all the instances of each variables are grouped together?

 

Thanks for creating the cross-reference files-- I was beginning to wonder if I'd be able to make this work at all. AtariAge forum members are a unique breed-- and all the personal help that I get here just is another reason to keep coming back.

Hello,

The INN.REF, DM1.REF and DM2.REF files are on the MYXREF.ATR image in the zip file. I don't know how to combine the two DM.BAS REF files,

either on the Atari or using, like, NOTEPAD on the two .ASC PC files. I guess you could copy and pasted using NOTEPAD on the ASCII files.

I guess you could just print out the ASCII files and check both for what you're looking for.

I use speedscript to SEARCH and FIND things on a LIST file. I got rid of all the TRAP statements. It was hard to tell where a problem occurred.

Now if a problem occurs you get an error message at the offending line.

My modified crossref.bas, called MYREF6.BAS is also on the .ATR

Edited by russg
Link to comment
Share on other sites

I took the two files referenced and loaded them into Basic XL, then used LVAR to cross reference them to [ATASCII] disk files.

 

Thanks for creating this listing. This BASIC XL cross reference using LVAR is actually my favorite listing so far. This is because DM.BAS didn't have to be split into more than one file, plus there are no repeated line numbers. For instance, variable P( on line 5040 isn't listed eight times because it's used that often on one line. This makes the variable cross-references much easier to read (and use, I'm hoping).

 

Since the files that "Larry" created with LVAR are in ATASCII format, I'm reposting them in ASCII format in case anyone is curious about them:

 

DMINN-XREF (ASCII).zip

 

I think using a combination of these utility programs will be most useful and I really want to thank everyone who has pitched in to help me find a great BASIC variable cross-reference program.

 

I'll have to explore BASIC XL. I've never played with it, and I've always wanted to do that.

 

BTW: I noticed that people are posting to this thread often enough that we're making posts to it at the same time, which might lead to confusion. Maybe that's what Ward was referring to when he wondered if I posted in the wrong order?

Link to comment
Share on other sites

 

Thanks for the listing (as well as the link to the Extended BASIC program). The spacing of the output is pretty unusual; It's hard to tell where one variable's line number listing begins and another ends. I did notice at the end of the listing that some variables are in memory but are not referenced by any line numbers. I understand that this is normal.

Yes, I found the double spacing in XREF in Extended BASIC unneccessary. I do like how it list the number of occurences of a variable for each line number, e.g. P( 8/5040 for 8 occurrences on line 5040.. I would have preferred line number then number of occurrences.

 

[EDIT]

Disregard the comment about double spacing. It's just been a while since I looked at 40 column "print".

 

Yep leftover variables. Delete a line but the variable name remains in Variable Name Table. Make a type of a veriable name, same thing happens. We learned to LIST the file to disk (or cassette) every so often to clean up the program.

 

-SteveS

Edited by a8isa1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...