--- title: "Structured SuperBasic Version 2.3" type: "article" slug: "structured-superbasic-version-2-3" url: "http://localhost/article/structured-superbasic-version-2-3/" markdown_url: "http://localhost/article/structured-superbasic-version-2-3.md" published_at: "2025-11-18T09:00:36+00:00" modified_at: "2026-06-21T23:21:00+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "INTRODUCTION Structured SuperBasic (SSB) is another way of writing SuperBasic programs. It allows programmers to write SuperBasic programs without line numbers and with white space between blocks. SSB is essentially a filter. It takes in a program file that is written in SSB and outputs a program file that is in SuperBasic. SSB programs are…" category: - name: "QL Hacker's Journal" slug: "ql-hackers-journal" taxonomy: "category" url: "http://localhost/category/periodicals/ql-hackers-journal/" post_tag: - name: "Full Text" slug: "fulltext" taxonomy: "post_tag" url: "http://localhost/tag/fulltext/" - name: "QL" slug: "ql" taxonomy: "post_tag" url: "http://localhost/tag/ql/" - name: "Type-in program" slug: "type-in-program" taxonomy: "post_tag" url: "http://localhost/tag/type-in-program/" model: - name: "Sinclair QL" slug: "sinclair-ql" taxonomy: "model" url: "http://localhost/model/sinclair-ql/" indiv: - name: "Tim Swenson" slug: "tim-swenson" taxonomy: "indiv" url: "http://localhost/indiv/tim-swenson/" publication_r: id: 33686 title: "QL Hacker’s Journal" type: "periodical" url: "http://localhost/periodical/ql-hackers-journal/" authors_r: - name: "Tim Swenson" slug: "tim-swenson" taxonomy: "indiv" url: "http://localhost/indiv/tim-swenson/" issue: "1" issues_articles: - id: 61529 title: "QL Hacker’s Journal 1" type: "issue" url: "http://localhost/issue/ql-hackers-journal-1/" pubdate: "January 1991" archive_link: true archiveurl: "https://archive.org/download/ql-hackers-journal/QL%20Hacker%27s%20Journal%201.txt" --- # Structured SuperBasic Version 2.3 ### INTRODUCTION Structured SuperBasic (SSB) is another way of writing SuperBasic programs. It allows programmers to write SuperBasic programs without line numbers and with white space between blocks. SSB is essentially a filter. It takes in a program file that is written in SSB and outputs a program file that is in SuperBasic. SSB programs are written using a text editor, be it ED, THE EDITOR, MicroEMACS, or even Quill. This the SuperBasic version of the program was compiled using QLiberator to create the executable version. This package consists of a number of files: - SSB_SSB – SSB version of program - SSB_BAS – SuperBasic version of program - SSB_DOC – Program Documentation (Due to a problem with QLiberator, I am unable to provide an executable copy of this program. If you are able to get this program to compile and run properly, I would like to have a copy) ### DEFINITION OF STRUCTURED SUPERBASIC Structured SuperBasic is defined below: #### Line Numbers Line numbers are not used in SSB. SuperBasic code is entered without line numbers. #### Indenting SSB lines may be indented. This indenting will be retained in the SuperBasic output file. #### Blank Lines Blank lines are ignored by the program and are not passed to the SuperBasic program. Blank lines are used to make the program structure clearer. ### Include Statements SSB does support include statements so that a program can be distributed across a number of files. Include statements can be placed any where in a file, but they must start in column 1. The syntax is: ``` #include flp1_file_name #INCLUDE flp1_file_name ``` The case of the letters must be the same. #Include will not work. The program expects the file name to start one space after the include statement and end with the end of line. You may use any drive or device type. ### Labels Labels are used for GOTOs and GOSUBs. Labels are started with an @ sign then the label name, such as @loop. The program is case sensitive about labels. @LOOP is not the same as @loop. If the program comes across an unknown label, it will notify you and then skip the label. The place-defining label must start in the first column and may have nothing after it. All other label references must be placed at the end of a line. The program does not check to see of a label is connected to a GOTO or GOSUB statement. You may not use the @ symbol in your program, except for labels. The program allows up to 30 labels, of length 15. You may change the SuperBasic version of the program to however many labels you need. SSB makes a limitation that you may not use the @ character in any of your programs. Use CHR$(64) in its place. If you want the following line: ``` IF a$="@" THEN ..... use the next line: IF a$=CHR$(64) THEN .... ``` It will work every time. #### Remarks SSB uses two different type of remark statements. Both remark statements start with remark characters and continues to the end of the line. The remark characters must be the first non-space characters in the line. **##** This remark statement puts a REMARK line in the SuperBasic program. Do not use a remark in a line by itself. ****** This remark statement is ignored by the program. No remark statement is passed to the SuperBasic program. #### Other The SSB program does absolutely no syntax checking on the input program. If the program has syntax errors, when the output file is loaded into SuperBasic, those lines with the errors will start with the SuperBasic keywork MISTAKE. ### USE OF THE STRUCTURED SUPERBASIC FILTER PROGRAM The SSB program may be started by LRUN (for the SuperBasic version) or EXEC or EXEC_W (for the executable version). Both programs are exactly the same. The executable version of the program was created using the QLiberator SuperBasic compiler. Once the program starts you will be asked for the name of the input file name. This is the SSB program file. The entire file name including drive must be entered. Then you will be prompted for the output file name. Like the input file name, you must enter the drive. If the input file does not exist or if the output file exists the program will bomb out. The program will then prompt you for the starting line number and the line increments. You must enter both numbers. The program does not provide defaults. Now the program will make two passes through the input file. As each pass is run, you will see a grey character for each 10 lines processed by the program. This will allow you to see that the program is working. When the program is done, the output file will ready to be loaded into SuperBasic and run. ### ADVANTAGES OF STRUCTURED SUPERBASIC SSB gives one the advantage of writing SuperBasic code without having to worry about any line numbers. If you go back and insert some code in a section, you need not waste time wasting time renumbering the lines. SSB is designed to writing longer programs that require them to be easy to read. It is designed for those programmers that write most of the code before running any of it. SSB does bring about the same restrictions that compilers do, that being, making changes to the code, run the SSB filter program (like a compiler) and then load and run the program. If you make any changes to the program while in SuperBasic, you must make the same changes to the SSB code. ### EXAMPLE STRUCTURED SUPERBASIC PROGRAM This is a sample SSB program. ``` ** This line will not be passed to ** the SuperBasic program. ** This program prints the numbers from ** 0 to 19. let x=0 @loop let x=x+1 print x if x<20 then goto @loop stop ``` This is the Structured SuperBasic filter program written in Structured SuperBasic. It is a good example of how easy SSB is to read over regular SuperBasic. ``` Strutured SuperBasic Filter Author: Timothy Swensn Date Created: 16 Oct 1990 Date Revised: 16 Oct 1990 This program takes in SSB code and outputs a file that is runnable in SuperBasic Init Variables DIM label$(30,16) DIM label(30) label_var = 1 num_count = 0 file_num = 5 OPEN #3,con_300x150a100x0_32 BORDER #3,2,4 PAPER #3,0 : INK #3,4 : CLS #3 PRINT #3," STRUCTURED SUPERBASIC FILTER" PRINT #3," Version 2.3" PRINT #3," by Timothy Swenson" PRINT #3 INPUT #3,"Enter input file: ";in_file$ INPUT #3,"Enter output file: ";out_file$ INPUT #3,"Enter Starting Line Number: ";line_num_d INPUT #3,"Enter Increment for Line Numbers: ";line_delta line_num = line_num_d PRINT #3," PASS 1" pass_one in_file$, file_num PRINT #3 PRINT #3," PASS 2" line_num = line_num_d num_count = 0 file_num = 5 DELETE out_file$ OPEN_NEW #4,out_file$ pass_two in_file$, file_num CLOSE #4 PRINT #3 PRINT #3,"Program Done" CLOSE #3 STOP DEFine PROCedure pass_one (in_file$, file_num) OPEN_IN #file_num,in_file$ REPeat pass_1 num_count = num_count + 1 IF (num_count MOD 10) = 0 THEN PRINT #3,CHR$(1); INPUT #file_num,in$ IF EOF(#file_num) THEN EXIT pass_1 IF LEN(in$)=0 THEN END REPeat pass_1 temp=first_char IF in$(temp TO temp+1)="**" THEN END REPeat pass_1 IF in$(1)=CHR$(64) THEN label$(label_var) = in$ label(label_var) = line_num label_var = label_var + 1 ELSE IF in$(1 to 8)="#include" or in$(1 to 8)="#INCLUDE" THEN pass_one in$(10 to ), file_num+1 ELSE line_num = line_num + line_delta END IF END IF END REPeat pass_1 CLOSE #file_num END DEFine pass_one DEFine PROCedure pass_two (in_file$, file_num) OPEN_IN #file_num,in_file$ REPeat pass_2 num_count = num_count + 1 IF (num_count MOD 10) = 0 THEN PRINT #3,CHR$(1); INPUT #file_num,in$ IF EOF(#file_num) THEN EXIT pass_2 IF LEN(in$)=0 THEN END REPeat pass_2 temp=first_char IF in$(1)=CHR$(64) THEN END REPeat pass_2 IF in$(temp TO temp+1)="**" THEN END REPeat pass_2 IF in$(temp TO temp+1)=" " THEN PRINT #4,line_num;" remark ";in$(1 TO temp-1);in$(temp+2 TO ) ELSE temp= CHR$(64) INSTR in$ IF temp<>0 THEN a$ = in$(temp TO ) temp2 = 0 @label1 temp2 = temp2 + 1 IF temp2 > 30 THEN PRINT #3,"Warning - Label ";a$;" Not Found" END REPeat pass_2 END IF IF label$(temp2) <> a$ THEN GO TO @label1 PRINT #4,line_num;" ";in$(1 TO temp-1);label(temp2) ELSE IF in$(1 to 8)="#include" or in$(1 to 8)="#INCLUDE" THEN pass_two in$(10 to), file_num+1 ELSE PRINT #4,line_num;" ";in$ END IF END IF END IF line_num = line_num + line_delta END REPeat pass_2 CLOSE #file_num END DEFine pass_two DEFine FuNction first_char LOCal count count=0 @label2 count=count+1 IF in$(count)=" " THEN GO TO @label2 RETurn count END DEFine first_char ```