[net.micro] How can I write BASIC lines >80 chars on C64?

LAVITSKY@RU-BLUE.ARPA (03/08/84)

From:  Eric <LAVITSKY@RU-BLUE.ARPA>

Mail-From: JAROCHA-ERNST created at  7-Mar-84 16:35:21
Date: 7 Mar 84 16:35:21 EST
From: Chris Jarocha-Ernst <JAROCHA-ERNST@RU-BLUE.ARPA>
Subject: How can I write BASIC lines >80 chars on C64?
To: LAVITSKY@RU-BLUE.ARPA
cc: JAROCHA-ERNST@RU-BLUE.ARPA


During the course of converting programs designed for other micros to run
on my C64, I occasionally encounter lines in BASIC that simply cannot be
split into smaller lines (e.g., ON X GOTO 1200,1300,1400,1500 etc, for some
80+ characters).  While I can sometimes squeeze these in by using the BASIC
abbreviations, this doesn't always solve the problem.

Is there a way to create lines greater than 80 characters?  As far as I can
tell, the *Programmer's Reference Manual* says no.  Anyone know better?

Chris
-------
-------

al@genrad.UUCP (Al Gudaitis) (03/10/84)

Actually, there is no reason why your ON X GOTO 1,2,3 type statement cannot be
split up into several lines.  As long as the argument (X in this case) is in
the range of 0 to 127, you won't get a syntax error and if there isn't a line
number to match the argument, then execution simply continues on the next line.
So:

100 ON X GOTO 1001,1002,1003,1004,1005,1006,1007,1008,1009

can be converted into:

100 ON X GOTO 1001,1002,1003,1004,1005
101 ON X-5 GOTO 1006,1007,1008,1009

Just make sure that the highest value computed GOTO's come last so that X-5,
X-10 or whatever don't give you negative numbers.  Of course, the other method
is to use some IF statements to send the program to the appropriate range of
computed GOTO's.  The input buffer length is what limits the C64 to
approximately 80 character lengths.  BASIC, itself, could handle NEARLY 256
character lines if you tokenized them yourself and poked them into program
space with the correct next-line pointers.  But that is probably more difficult
than doing what I suggested above.

porter@inuxd.UUCP (J Porter) (03/12/84)

Yes there is a way to put more that 80 characters on a BASIC line on the 64.
The technique is covered in a series of articles in COMPUTE! back before
the 64 was born.  Specifically, Sept/Oct 1980 (The original compactor for
PET written in BASIC) and it's companion uncompactor in the May 1981 issue
(both by Robert Baker) and the third is a machine language compactor in 
the July 1982 issue.

Both compactors create a new disk file based on an old disk file - so two
drives are important.  It would take more than a casual once over to
convert them to a single drive compactor.  The theory of operation is there.
You can now get 256 characters on the same line.  It is hell to edit,
since the screen editor works only with 80, but that is why you have 
uncompactor programs.  The 4040 dual disk and the 1541 have nearly
identical operating systems and you should not have to go to any
conversion for the disk commands unless you start modifying the DOS 
in the drive.

I'm sure this program is planned for a future COMPUTE! issue.  I would
also expect a really good basic aid soon from COMPUTE!  If you can't find
back issues, I could send you xerox copies.

Jeff Porter  (inuxd!porter)
AT&T Consumer Products
Indianapolis