chessplayerjames Posted June 19, 2020 Share Posted June 19, 2020 (edited) 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). EDIT: There are exactly ten spaces at the beginning of each line. My code looks something like this: I have made other BASIC programs that do not do these weird tab characters. Example: 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 June 19, 2020 by chessplayerjames Specifying where tab character is/number of spaces on each line Quote Link to comment Share on other sites More sharing options...
+Stephen Posted June 19, 2020 Share Posted June 19, 2020 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$? 1 Quote Link to comment Share on other sites More sharing options...
chessplayerjames Posted June 19, 2020 Author Share Posted June 19, 2020 (edited) 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 June 19, 2020 by chessplayerjames Specifying how many spaces Quote Link to comment Share on other sites More sharing options...
vitoco Posted June 19, 2020 Share Posted June 19, 2020 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 1 1 Quote Link to comment Share on other sites More sharing options...
chessplayerjames Posted June 19, 2020 Author Share Posted June 19, 2020 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? Quote Link to comment Share on other sites More sharing options...
Rybags Posted June 19, 2020 Share Posted June 19, 2020 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. 1 Quote Link to comment Share on other sites More sharing options...
dmsc Posted June 20, 2020 Share Posted June 20, 2020 (edited) 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: 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 June 20, 2020 by dmsc Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.