Jump to content
IGNORED

Atari BASIC use of arrays


Recommended Posts

I have this Atari BASIC program written by someone else I converting to TI-BASIC (MS BASIC derivative).

In the program we have DIM PILE(1,1)

the programmer refers to the array as PILE(PLAYER,0) & PILE(PLAYER) omitting the 2nd array element. the program works so I'm assuming if the 2nd element is omitted it it defaults to 0? so PILE(PLAYER,0) is the same as PILE(PLAYER) ? Am I right?

Link to comment
Share on other sites

2 hours ago, hloberg said:

I have this Atari BASIC program written by someone else I converting to TI-BASIC (MS BASIC derivative).

In the program we have DIM PILE(1,1)

the programmer refers to the array as PILE(PLAYER,0) & PILE(PLAYER) omitting the 2nd array element. the program works so I'm assuming if the 2nd element is omitted it it defaults to 0? so PILE(PLAYER,0) is the same as PILE(PLAYER) ? Am I right?

You are right, though this is just (another) defect of Atari Basic where a check for the dimensionality of the original array is missing on its use. Similarly, one can also access 1-dimensional arrays with two indices giventhat the second index is zero.

  • Thanks 1
Link to comment
Share on other sites

thank you, that makes sense now.

the guy who wrote this little game in Atari BASIC (millebournes) I'm translating to TI XBASIC seemed to relish in the little idiosyncrasies of Atari BASIC.  I was talking on the ti99 forum how he used NOT PLAYER throughout the program. NOT in Atari BASIC gives a logical NOT ie : NOT 0=1 and NOT 1 (or anything else)=0. In MSBASIC derivatives like TI BASIC NOT is binary; so NOT 0=-1 & NOT 1=-2 etc...

Link to comment
Share on other sites

This came up recently elsewhere I believe.

 

In practice you'd probably get a little speed and size advantage by omitting the 2nd dimension when referencing.

But it can have compatibility problems with other variants of Basic on the Atari which need both dimensions always.

 

Yes - the boolean functions in most old Basics used -1 as true, Atari uses 1.  And when testing any nonzero result should also give "true".

 

e.g.

IF A THEN B=100

Should execute on any nonzero value of A.

  • Thanks 1
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...