Jump to content
IGNORED

Maximum line length in basic exceeded by Compute! listing


Recommended Posts

Hi Atarians,

 

I am learning Atari basic and am entering in programs from COMPUTE!, Analog, etc. I am using a 48k Atari 400. I am experiencing an error that I think is due to the COMPUTE! program listing exceeding the maximum allowable characters per line.

 

The listing in the magazine shows this for line 503 I spaced it the same as the magazine listing :

503 IF A=54 THEN GRAPHICS 7:SETCOLOR 1,C

,12:SETCOLOR 2,C,6:SETCOLOR 0,C,4:SETCOL
OR 4,HUE,SHADE:POKE 764,255:? CHR$(253):
GOSUB 3000
And I get an error when typing in line 503. The basic interpreter hilites the position where the round bracket would be after :CHR$
I checked and retyped a few times and then thought there may be a limit to the number of characters per line number. From what I have read the Atari has a three-line limit, and this goes over three lines.
This program has a line 504 with another IF statement, so it seems that this program must have run somehow? I'd appreciate some guidance here. I also attached a clipping from the compute Issue, Aug 81, issue 15. I checked the following issue for Errata but didn't find any.
Thank you, I appreciate the help.
KB
Link to comment
Share on other sites

Atari Basic allows you to use abbreviations for keywords. You use a period in place of the rest of the keyword name following one to three of its characters (dependent upon where in the list the keyword originates. Unfortunately, REM is the first keyword (as such its abbreviation is simply a period). Of the line you posted, GRAPHICS (GR.) and SETCOLOR (SE.) would be the big gainers. Also, don't forget that you don't need spaces except when a variable name is followed by an alphanumeric character.

Link to comment
Share on other sites

503IF A=54THEN GR.7:SE.1,C,12:SE.2,C,6:SE.0,C,4:SE.4,HUE,SHADE:POKE764,255:?CHR$(253):GOS.3000 = 94 characters out of the 120 allowed (or 114 allowed if you are using the default left margin of 2). The latter is altered by POKE82,0 to get rid of the left margin.

Link to comment
Share on other sites

BTW you can hack the list in the Atari Basic rom so that all keywords use unique two letter abbreviations (after you exhaust the initial 26 letters) to generate some impossible line listings when you reload the program into an unhacked Basic ;) The keyword list is simply the ATASCII values of the characters, with the last letter of each keyword having the high bit set in addition, followed by the jumptable location. Line listings shortened too much may generate a stack overflow when Basic attempts to parse it!

  • Like 2
Link to comment
Share on other sites

The mags took a lot of flak for those long lines! In addition to Nukey Shay's excellent explanation, usually those long lines can be tamed by just POKE 82, 0. And as you learn, consider a more full-featured Basic such as Turbo Basic which allows multi-line IF statements. IF: ELSE: ENDIF The closest thing to Atari Basic is the superb Altirra Basic. I think it also allows the improved IF structure.

Link to comment
Share on other sites

Yep. 114 characters (3*38) is the default limit you can type, E: limit is 120. Basic itself actually can accept 256 characters and sets up the input buffer as such which allows longer lines if using e.g. the ENTER "filespec" command.

That limit also allows overflow such that the first half of page 6 can get overwritten.

 

Also, now famously such exploits are used in the 10-liner Basic game competition.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

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...