Jump to content
chessplayerjames

Atari BASIC Prints "Tab" Characters to Text File

Recommended Posts

Good evening all,

 

(Background Information)

Spoiler

Last semester in college, we had to design a compiler.  I decided I'd try my luck (and rack my brain) to create a similar compiler...for the Atari 800XL.  I am using the Altirra emulator.

 

I am creating a program in BASIC, and sometimes when I write text files to disk, I get a weird "tab" character, comprising of several spaces at the beginning of each line.  As evidence of so many spaces, the file size is considerably greater than it should be (is several bytes bigger for each line, and in one file that had hundreds of lines, the file-size was almost five times bigger).

image.png.38133ed1f306ebcd291e6b2ae6fcaf75.png

EDIT: There are exactly ten spaces at the beginning of each line.

 

My code looks something like this:

image.thumb.png.23ffdc29f61a39e8a05ae287cb1c5a1f.png

 

I have made other BASIC programs that do not do these weird tab characters.  Example:

image.png.324d920aae591d4bff425abb0ccafe1b.png

This has no "tabs" or spaces at the beginning of each line (like the first photo shows).

 

What am I doing wrong here?

 

Any and all help will be greatly appreciated.

 

Thanks,

James

Edited by chessplayerjames
Specifying where tab character is/number of spaces on each line

Share this post


Link to post
Share on other sites

First thing I would check, is the value of the 2 variables STARTSTATE and NUMSTATES.  ASCII value for TAB is decimal 09. 

 

May I ask - what are those 2 values, and why are they being printed before the string contained in INPUTS$?

  • Like 1

Share this post


Link to post
Share on other sites
12 minutes ago, Stephen said:

First thing I would check, is the value of the 2 variables STARTSTATE and NUMSTATES.  ASCII value for TAB is decimal 09. 

 

May I ask - what are those 2 values, and why are they being printed before the string contained in INPUTS$?

STARTSTATE and NUMSTATES are 0 and 126 respectively (that is the number they should be giving, and they are "correctly" printed to the text file, except for the extra spaces).  STARTSTATE represents the entry point of the automaton, and NUMSTATES is the number of states in the automaton.  INPUTS$ is the list of characters that the automaton accepts.  Although the order could be changed (I tried it just in case and got the same result of the spaces), it doesn't (in my theory) affect the outcome.

 

EDIT: To be specific, there are ten spaces at the start of each line.

Edited by chessplayerjames
Specifying how many spaces

Share this post


Link to post
Share on other sites

It is because you are printing with a comma between the #1 and the variable name. You must use a semicolon:

 

600 PRINT #1;STARTSTATE

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
5 minutes ago, vitoco said:

It is because you are printing with a comma between the #1 and the variable name. You must use a semicolon:

 

600 PRINT #1;STARTSTATE

 

This solution worked perfectly.  I officially feel stupid now.  Thank you very much.  Should I assume that I need to use semicolon in inputs as well?

Share this post


Link to post
Share on other sites

For INPUT it doesn't matter in stock Atari Basic - the statement doesn't allow prompts like most others so comma or semicolon for IOCB based input is the same probably for consistency.

  • Like 1

Share this post


Link to post
Share on other sites

Hi!

Quote

Good evening all,

 

I am creating a program in BASIC, and sometimes when I write text files to disk, I get a weird "tab" character, comprising of several spaces at the beginning of each line.  As evidence of so many spaces, the file size is considerably greater than it should be (is several bytes bigger for each line, and in one file that had hundreds of lines, the file-size was almost five times bigger).

 

EDIT: There are exactly ten spaces at the beginning of each line.

 

My code looks something like this:

image.thumb.png.23ffdc29f61a39e8a05ae287cb1c5a1f.png

You are using a ",", this is the "TAB" you are seeing.

 

Correct syntax is:

? #1;"My Text"

 

Have Fun!

 

Edit: Sorry, did not see that this was already answered! I'm late reading the forum 😛 

Edited by dmsc

Share this post


Link to post
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...