Portfolio BASIC, version 4.0 (c) 1991 BJ Gleason by BJ Gleason, The American University INTRODUCTION PBASIC is a simple BASIC interpreter. It only requires 38k of disk space and about 59k of memory to run. PBASIC is a batch oriented interpreter. It will also interact with the built-in editor for program development. PBASIC was one of the winners in the Compuserve/Portfolio Conference Programming Contest, 1990. A NOTE FROM THE AUTHOR A number of considerate users have offered their help. If you have an interesting application that you have developed in PBASIC, I will be more than happy to distribute your code in future releases. Please make sure to place your name and other information as REMarks in the program. You can include a documentation file as well. The only thing that I ask is that you do not charge for the use of your program, as I am not charging for the use of this interpreter. Send me a note, and tell me where the code is and I will include it in the package. Thanks to all you have helped and are going to help! Now that files and such have been added, I am going to take a bit of a break. I will release upgrades as bugs dictate, and will, as always, listen to you, the user. But quite frankly, except for a few minor functions, I don't think there is much else to add. PBASIC has grown about as large as I would like it to. If it grows any larger, there will be little room left for your code. MANUAL AVAILABLE A 240+ page manual on PBASIC is under works and will be available March 1, 1991. The manual is 8.5 x 11, and has comb binding so it can lay flat. Each instruction is explained in detail, with examples. The manual will cost 25 dollars, including postage. If you are interested in obtaining the manual, send a check or money order to address on the last page of this document. I am sorry that the manual was delayed, but there were a few minor setbacks. WHAT THE CRITICS SAY: PBASIC 2.1 was reviewed by John Jainschigg in Atari Explorer, January 1991. Here is some of he said: "...PBASIC is a terrific little job of programming... Though freeware, PBASIC has been professionally and completely documented... even those who are waiting on tenterhooks for Atari's own Portfolio BASIC may find PBASIC very useful in the interim. The program is reasonably reliable, complete, and professionally executed - and at the present time, stands as the best alternative for casual programming on the Portfolio system." DESIGN CONSIDERATION When I was laying out the initial design of PBASIC, here are some of the topics I took into consideration: - Microsoft BASIC compatible. - Size of Interpreter (as small as possible). - Unique features of the Portfolio. - Using the Built-in editor for Program Editing. - Reasonable size BASIC programs. NEW FEATURES FOR VERSION 4.0 FILES! FILES! FILES! Sequential Files. New Statements: USING, CLOSE, EOF, INPUT$, NUMFMT, OPEN, PRINT#, REPEAT, UNTIL, WEND, WHILE, WRITE# New Functions: ACOS, AND, ASIN, COSH, DEG, DMS, EOF, EQV, IMP, LTRIM$, MSD, OR, RAD, RTRIM$, SINH, SPC, TAB, TANH, WKSREAD, WKSREAD$, WKSTYPE, XOR New Portfolio Only: MENU, SCRLOAD, SCRSAVE Menus. Worksheet Importing Functions. ATARI key ( /|\ ) now exits PBASIC program. SIEVE.BAS - 30% faster! INTERFACING WITH THE EDITOR Instead of trying to create an editor, PBASIC makes full use of the built in editor. If you run BASIC without any parameters, it will load the last file you used in the editor. To speed up the process, you might want to rename PBASIC.EXE to P.EXE, so you only need to type P at the prompt. You can also specify a file to execute on the command line. Whenever an error is detected, an error message is displayed, along with the line number. Press any key and PBASIC will invoke the built-in editor and point to the error position. This will only happen if the file you are executing is the same as the one you are editing. On other systems, you will be returned to the DOS prompt. On a PC compatible machine, the error message will include the line number, character position and offset from the front of the file. This is so that the PBASIC EDITOR, for the PC, can determine where the error is and point to it. ALTR.COM is a small TSR program that will, only from inside the editor, save the current file and invoke PBASIC. PBASIC.EXE should be rename P.EXE for the command to work. ALTR takes up about 450 bytes. It can be removed by rebooting the machine. It can only be loaded into memory once. The command will only work inside the editor. When the program is finished, PBASIC will wait for a keypress and then return you to the editor. RUNNING PBASIC There are two forms to execute PBASIC: PBASIC [-T] PBASIC filename.ext [-T] In the first form, the default file is the last one edited in the built-in editor on the Portfolio. The second form loads and executes the specified file. If you leave off the extension, the default ".BAS" is added. If you have run the ALTR program before editing your code, you can execute PBASIC by pressing . The command line switch -T will turn on the trace feature. This is the same as putting TRON at the beginning of you program. GENERAL Source code is standard ASCII format. Source code can be in upper or lower case. 200 floating point variables. Variable names can not exceed 8 characters in length. Strings are always allocated 256 bytes. FOR/NEXT loops may be nested 10 deep. GOSUBs may be nested 10 deep. WHILE / WEND may be nested 10 deep. REPEAT / UNTIL may be nested 10 deep. Line numbers are not required for each statement. Only 100 line numbers are allowed. They do not have to be in sequence. Line numbers can range from 0 to 99999. Multiple statements per line (:) is supported. Up to 10 Files can be open at the same time. DEVELOPING PROGRAMS WITH GWBASIC You can develop your programs on the PC with Microsoft BASIC or QuickBASIC. If using Microsoft BASIC, be sure to save the file in ASCII format [ SAVE "myfile",A ] so that it can be read by PBASIC. For easier development on a PC, PBE, the PBASIC Editor is now available. PBE operates similar to Turbo Pascal, and allows you to execute programs from inside the editor. IT will also let you transfer files back and forth to the Portfolio. MATH EXPRESSIONS Single precision math. Parentheses supported. Standard operator evaluation. Hexadecimal and Octal constants are supported. - negation ^ exponent * multiply / divide % remainder (MOD) \ integer division + addition - subtraction AND, OR, NOT, XOR, EQV, IMP <, >, <=, >=, =, <> NOTES ON CONVENTIONS USED An expression (exp) can contain variables, constants. When a dummy exp is indicated, it is suggested that you use a constant, i.e. POS(0). A variable name (varname) must be used when indicated. Unless otherwise noted, all parameters can be constants, variables or equations. BASIC STATEMENTS I have tried to keep the syntax and semantics for the statements as close to Microsoft BASIC as possible. The notes presented indicate exceptions. There are some statements included that are not from Microsoft. They will not run on GWBASIC. BLOAD filename, offset Load a file to location SEG:offset. BSAVE filename, offset, length Copies memory to file, starting from SEG:offset for length bytes. CALL address Transfer control to SEG:address. Data is passed via the registers with the REG statement/function. CALL INTERRUPT intno Invoke DOS interrupt intno. Data is passed via the registers with the REG statement/function. CHAIN filename Load and execute the indicated file. All variables are retained. CHDIR path Change the current directory to path. CLOSE# fileno Close the file. CLS Clears the screen. DATA list of numbers/strings Allows for numbers to be stored inline. Data statements MUST have a line number. Numbers are separated by commas. Data statements may be located on any line of the program. Strings must be enclosed in quotes. 12 DATA 1,2,3,4,5,6 DECR(var) Decrement the variable by 1. DEF SEG = exp Assigns a segment address for direct memory accessing via PEEK, POKE and CALL. DIM varname(size,[size])[,varname(size,[size])....] Creates a one or two dimensional array of single precision floating point variables. Arrays start at 0. Arrays are not initialized to a value. Arrays must be defined before they are used. Upper array bounds are not checked, arrays are not allowed to go below 0. END SYSTEM and END have the same effect. ERROR errnum Simulate Error for testing ON ERROR GOTO. EVAL var$ Evaluates the contents of var$ as if it was part of a BASIC program. FOR varname = exp TO exp [STEP exp] FORMFEED Send a formfeed to the printer. GOSUB line number GOTO line number IF exp THEN statement [ ELSE statement ] INCR(var) Increment var by 1. INPUT ["prompt" (,|;)] varname Reads input from the keyboard. Only one variable is allowed per input. If a comma (,) separates the prompt string and the varname, no question mark (?) will be printed. If a semi-colon (;) is used, the question mark will appear. INPUT# fileno, varname This will read a variable from a disk file. KILL filename Delete filename from disk. LOCATE row,col Move the cursor to row, col. LPRINT list of expressions Send output to printer. See PRINT. MKDIR path Create a directory named path. NEXT [varname] You can not use an array element for varname. NUMFMT = "format" In PBASIC numbers are not displayed in classic GWBASIC format. GWBASIC always prints numbers with a leading space or -, and a trailing space. To make the porting of GWBASIC programs easier, you can specify the format that numbers are to print with the NUMFMT statement. The default is "%g", and GWBASIC format would be "% g ". This can also be used if you want all numbers in scientific or other format. See the PRINT USING description for the format. ON ERROR GOTO line number Error trapping. When an error occurs, user will be transferred to line number. A line number of 0 will disable error trapping. ON exp GOTO list of line numbers ON exp GOSUB list of line numbers OPEN "mode",fileno,filename Open a file. Mode can be: I Input O Output A Append Fileno can be between 1 and 10. Only ten files may be open at any one time. Filename is any standard MS/DOS filename. OUT port, exp Send value to the indicated port. PGLOAD filename Load a .PGC file into screen memory. PGSAVE filename Save video memory to .PGC file. PGSHOW filename, delay Display a .PGC file, and wait delay seconds. If delay is 0, wait for keypress. POKE addr, exp Places value at SEG:addr. SEG is set via the DEF SEG statement. NOTE: Due to the design of the Portfolio, if you poke screen memory (DEF SEG=&HB000), the value may not appear. After you poke, you should use the REFRESH statement to update the screen. PRINT list of expressions List of expressions can consist of strings, variables, constants or expressions, separated by the comma (,) or semi-colon (;) or a space ( ). Starting with version 4.0, the ? can be used as an abbreviation for PRINT. PRINT# fileno, list of expressions Same as PRINT, but send output to file. PRINT USING format; list of variables This is not GWBASIC compatible. To implement the full version of the PRINT USING would take up too much room. This version is like C's printf. Format is a string, indicating the format to print a single variable. Each variable in the list is printed with that format. For more details, refer to Turbo C's reference manual. Format Specifiers: %s String %f Real [-]dddd.dddd %e Real [-]d.ddde[+/-]ddd %E Real [-]d.dddE[+/-]ddd %g Real, general format, e or f %G Real, general format, E or f %% Print % character in format string % g Print numbers in GWBASIC format Widths/Precisions: n n characters are printed 0n n characters with leading 0's .0 no decimal point .n n digits after the decimal point Examples Output "|%10.2f|";123.123 | 123.12| "|%10.0f|";123.123 | 123| "|%5.0f%%|";10;15 | 10%|| 15%| "|%010.2f|";123.456 |0000123.46| "|%e|";456.789 |4.56789e+02| "|%E|";567.901 |5.67901E+02| PRINT# fileno, USING format; list of variables Same as PRINT USING, but send output to file. PRINTER This is a toggle to start copying all PRINT statements to the printer. Issue it again and it will toggle off. It can be used instead of converting all PRINTs to LPRINTs. Information will still be displayed on the screen. This will not wrap the output lines like the screen will. PRTSC This invokes the PRINT SCREEN function to copy the screen out to the printer. If you are using a laser printer, you might want to use a FORMFEED after this to do a page eject. PSET (row, col) [, exp] Set the pixel at row, col to exp. The Portfolio, regardless of the screen mode, has a maximum 64x240 for row, col. Exp can evaluate to 0 or 1. RANDOMIZE Initialize the random number generator. READ list of variables Read the values of the variables from the DATA statements. Variables can be simple or array. REG rn, val Set rn to val. Allows for access to the 8086's register set. Values for rn are: 0 - Flags 1 - AX 2 - BX 3 - CX 4 - DX 5 - SI 6 -OBBSCBB[X\ˈH\وH[H\YۛܙY [H[B[\HH][H HX\\HSH][Y[ BBBTPU SS^BB][Y[]Y[HTPU[SS][Y[B\H^X]Y[[^XY\QKBBTԑH[H\CBB]H[\[]H[\HXYYYB line number. Line number specified must be a data statement. If no line number is given, the data pointer will point back to the first data /a@~~~~|$ ~~~| B|d@'~~~~~~~~~~~~~~|D @&|p|@$$&|"| $p<<@N|r||$$&| ~~~~~~~~~~~~~~|$@ B| |p |r|<$@$p| |` B|p| C~~~~~~~~~~~~~~|L`p @N| B|d@&~~~~|$ $~~~~|$̐'~~~~~~~~~~~~~~|$@B|r|L$@` $|D$| B|L ~|$@` $| ~~~~~~~~~~END have the same effect. ERROR errnum Simulate Error for testing ON ERROR GOTO. EVAL var$ Evaluates the contents of var$ as if it was part of a BASIC program. FOR varname = exp TO exp [STEP exp] FORMFEED Send a formfeed to the printer. GOSUB line number GOTO line number IF exp THEN statement [ ELSE statement ] INCR(var) Increment var by 1. INPUT ["prompt" (,|;)] varname Reads input from the keyboard. Only one variable is allowed per input. If a comma (,) separates the prompt string and the varname, no question mark (?) will be printed. If a semi-colon (;) is used, the question mark will appear. INPUT# fileno, varname This will read a variable from a disk file. KILL filename Delete filename from disk. LOCATE row,col Move the cursor to row, col. LPRINT list of expressions Send output to printer. See PRINT. MKDIR path Create a directory named path. NEXT [varname] You can not use an array element for varname. NUMFMT = "format" In PBASIC numbers are not displayed in classic GWBASIC format. GWBASIC always prints numbers with a leading space or -, and a trailing space. To make the porting of GWBASIC programs easier, you can specify the format that numbers are to print with the NUMFMT statement. The default is "%g", and GWBASIC format would be "% g ". This can also be used if you want all numbers in scientific or other format. See the PRINT USING description for the format. ON ERROR GOTO line number Error trapping. When an error occurs, user will be transferred to line number. A line number of 0 will disable error trapping. ON exp GOTO list of line numbers ON exp GOSUB list of line numbers OPEN "mode",fileno,filename Open a file. Mode can be: I Input O Output A Append Fileno can be between 1 and 10. Only ten files may be open at any one time. Filename is any standard MS/DOS filename. OUT port, exp Send value to the indicated port. PGLOAD filename Load a .PGC file into screen memory. PGSAVE filename Save video memory to .PGC file. PGSHOW filename, delay Display a .PGC file, and wait delay seconds. If delay is 0, wait for keypress. POKE addr, exp Places value at SEG:addr. SEG is set via the DEF SEG statement. NOTE: Due to the design of the Portfolio, if you poke screen memory (DEF SEG=&HB000), the value may not appear. After you poke, you should use the REFRESH statement to update the screen. PRINT list of expressions List of expressions can consist of strings, variables, constants or expressions, separated by the comma (,) or semi-colon (;) or a space ( ). Starting with version 4.0, the ? can be used as an abbreviation for PRINT. PRINT# fileno, list of expressions Same as PRINT, but send output to file. PRINT USING format; list of variables This is not GWBASIC compatible. To implement the full version of the PRINT USING would take up too much room. This version is like C's printf. Format is a string, indicating the format to print a single variable. Each variable in the list is printed with that format. For more details, refer to Turbo C's reference manual. Format Specifiers: %s String %f Real [-]dddd.dddd %e Real [-]d.ddde[+/-]ddd %E Real [-]d.dddE[+/-]ddd %g Real, general format, e or f %G Real, general format, E or f %% Print % character in format string % g Print numbers in GWBASIC format Widths/Precisions: n n characters are printed 0n n characters with leading 0's .0 no decimal point .n n digits after the decimal point Examples Output "|%10.2f|";123.123 | 123.12| "|%10.0f|";123.123 | 123| "|%5.0f%%|";10;15 | 10%|| 15%| "|%010.2f|";123.456 |0000123.46| "|%e|";456.789 |4.56789e+02| "|%E|";567.901 |5.67901E+02| PRINT# fileno, USING format; list of variables Same as PRINT USING, but send output to file. PRINTER This is a toggle to start copying all PRINT statements to the printer. Issue it again and it will toggle off. It can be used instead of converting all PRINTs to LPRINTs. Information will still be displayed on the screen. This will not wraxp is a dummy expression. RAD(exp) Convert degrees to radians. RAND(exp) This will return a number between 0 and exp-1. REG(rn) Returns rn's value. Allows for access to the 8086's register set. Values for rn are: 0 - Flags 1 - AX 2 - BX 3 - CX 4 - DX 5 - SI 6 - DI RIGHT$(x$,n) Returns the rightmost n characters from x$. RND This will return a number between 0 and 1. RTRIM$(n$) Strips any trailing spaces from the string. SGN(exp) Returns the sign of exp. -1 exp < 0 0 exp = 0 1 exp > 0 SIN(exp) Returns the sine of exp. SINH(exp) Returns the hyperbolic sine of exp. SPACE$(n) Returns a string of n spaces. SPC(n) Returns a string of n spaces. SQR(exp) Returns the Square Root of exp. STR$(n) Returns the string representation of n. STRING$(n,m) Returns a string composed of n characters. m is the ASCII value of the characters. TAB(n) Moves the cursor to the nth column. TAN(exp) Returns the tangent of exp. TANH(exp) Returns the hyperbolic tangent of exp. TIME$ Returns the system time. TIMER Returns the number of seconds since midnight. TRUE Returns -1. UCASE$(x$) Returns the uppercase version of x$. VAL(x$) R''@A'G'gx8x8x8gVARSEG(var) Returns the segment of the var @pppπÀpppτOOπρO @pppπÈ20971)2:79:427:41:2:97:421609713970;52342"20:":294+)790:0"062!;212+"3420971)2:79:4299431:2:97:4216097 Increment var by 1. INPUT ["prompt" (,|;)] varname Reads input from the keyboard. Only one variable is allowed per input. If a comma (,) separates the prompt string and the varname, no question mark (?) will be printed. If a semi-colon (;) is used, the question mark will appear. INPUT# fileno, varname This will read a variable from a disk file. KILL filename Delete filename from disk. LOCATE row,col Move the cursor to row, col. LPRINT list of expressions Send output to printer. See PRINT. MKDIR path Create a directory named path. NEXT [varname] You can not use an array element for varname. NUMFMT = "format" In PBASIC numbers are not displayed in classic GWBASIC format. GWBASIC always prints numbers with a leading space or -, and a trailing space. To make the porting of GWBASIC programs easier, you can specify the format that numbers are to print with the NUMFMT statement. The default is "%g", and GWBASIC format would be "% g ". This can also be used if you want all numbers in scientific or other format. See the PRINT USING description for the format. ON ERROR GOTO line number Error trapping. When an error occurs, user will be transferred to line number. A line number of 0 will disable error trapping. ON exp GOTO list of line numbers ON exp GOSUB list of line numbers OPEN "mode",fileno,filename Open a file. Mode can be: I Input O Output A Append Fileno can be between 1 and 10. Only ten files may be open at any one time. Filename is any standard MS/DOS filename. OUT port, exp Send value to the indicated port. PGLOAD filename Load a .PGC file into screen memory. PGSAVE filename Save video memory to .PGC file. PGSHOW filename, delay Display a .PGC file, and wait delay seconds. If delay is 0, wait for keypress. POKE addr, exp Places value at SEG:addr. SEG is set via the DEF SEG statement. NOTE: Due to the design of the Portfolio, if you poke screen memory (DEF SEG=&HB000), the value may not appear. After you poke, you should use the REFRESH statement to update the screen. PRINT list of expressions List of expressions can consist of strings, variables, constants or expressions, separated by the comma (,) or semi-colon (;) or a space ( ). Starting with version 4.0, the ? can be used as an abbreviation for PRINT. PRINT# fileno, list of expressions Same as PRINT, but send output to file. PRINT USING format; list of variables This is not GWBASIC compatible. To implement the full version of the PRINT USING would take up too much room. This version is like C's printf. Format is a string, indicating the format to print a single variable. Each variable in the list is printed with that format. For more details, refer to Turbo C's reference manual. Format Specifiers: %s String %f Real [-]dddd.dddd %e Real [-]d.ddde[+/-]ddd %E Real [-]d.dddE[+/-]ddd %g Real, general format, e or f %G Real, general format, E or f %% Print % character in format string % g Print numbers in GWBASIC format Widths/Precisions: n n characters are printed 0n n characters with leading 0's .0 no decimal point .n n digits after the decimal point Examples Output "|%10.2f|";123.123 | 123.12| "|%10.0f|";123.123 | 123| "|%5.0f%%|";10;15 | 10%|| 15%| "|%010.2f|";123.456 |0000123.46| "|%e|";456.789 |4.56789e+02| "|%E|";567.901 |5.67901E+02| PRINT# fileno, USING format; list of variables Same as PRINT USING, but send output to file. PRINTER This is a toggle to start copying all PRINT statements to the printer. Issue it again and it will toggle off. It can be used instead of converting all PRINTs to LPRINTs. Information will still be displayed on the screen. This will not wray is available. Example: DIM s$(1) : rem s$(0), s$(1) will hold screen SCRSAVE s$(0) : rem save it .... SCRLOAD s$(0) : rem restore it SOUND code, duration This will activate the tone generator. Duration is the length of tone in 10 msec intervals. Tone codes are displayed below. These codes are taken from the Atari Portfolio Technical Reference Manual, copyrighted by the Atari Corporation. CODE NOTE Frequency (Hz) 48 D#5 622.3 49 E5 659.3 50 F5 698.5 51 F#5 740.0 52 G5 784.0 53 G#5 830.6 54 A5 880.0 55 A#5 932.3 56 B5 987.8 57 C6 1046.5 58 C#6 1108.7 41 D6 1174.7 59 D#6 1244.5 60 E6 1318.5 61 F6 1396.9 14 F#6 1480.0 62 G6 1568.0 44 G#6 1661.2 63 A6 1760.0 4 A#6 1864.7 5 B6 1975.5 37 C7 2093.0 47 C#7 2217.5 6 D7 2349.3 7 D#7 2489.0 Aside from these codes, other values will produce sounds as well. STATUS exp This will enable or disable the Status line. This is the line that you see when you use the key on the Portfolio. 0 for off, 1 for on. TICK exp Sets the Clock tick speed. 0 is Normal, 1 tick every 128 seconds. 1 is Fast, 1 tick every second. 1 uses much more power. VCSRLIN Returns the current virtual cursor line. VLOCATE row,col Move the virtual cursor to row, col. This location will be at position 1,1 on the physical screen. VMOVE dir, dis Move the screen in direction dir for dis number of lines. Works only in Static and Tracked modes. Same as using the ALT arrow keys. Values for dir are 1=Up,2=Down,3=Left,4=Right. VPOS(exp) Returns the current virtual cursor column. Exp is a dummy expression. BREAKING OUT OF PROGRAMS It appears that if you use the CONTROL-C key to break out of a PBASIC program, it will lock up a few minutes later. I have tried to trace this, but to no avail. Chalk it up a difference between the PC and Portfolio. To eliminate this problem, you can now use the ATARI key, ( /|\ ) by itself, to exit from a PBASIC program. Press the key at any point. As long as you hold down the key, the error message "BREAK in xx" will remain on the screen. Release the key and you are returned to the MD/DOS prompt. If you execute the program from the editor, you will be returned to the editor, with the cursor pointing to the last executed statement. UPGRADE HISTORY Version 4.0 New Statements: USING, CLOSE, EOF, INPUT$, NUMFMT, OPEN, PRINT#, REPEAT, UNTIL, WEND, WHILE, WRITE# New Functions: ACOS, AND, ASIN, COSH, DEG, DMS, EOF, EQV, IMP, LTRIM$, MSD, OR, RAD, RTRIM$, SINH, SPC, TAB, TANH, WKSREAD, WKSREAD$, WKSTYPE, XOR New Portfolio Only: MENU, SCRLOAD, SCRSAVE Sequential Files. Menus. Worksheet Importing Functions. Reorganized GetToken to increase speed. Reserved word lookup is now indexed binary search. Code was tighten and refined. Arrays can be used with FOR statements. Fixed error in .PGC compression routines. To convert any old .PGC files to the correct format, use the following program: 10 INPUT "Filename? ";f$:IF f$ = "" THEN END SCREEN 6:PGLOAD f$:PGSAVE f$:SCREEN 7:GOTO 10 Changed PC error messages to interface with PBE. IF statements modified to allow for single expression evaluation. Allows for IF EOF(1) THEN etc... If the result is 0, it is false, anything else is true. Modified the FOR statement to work more like GWBASIC. If the starting value to beyond the ending value, the loop is not executed. This includes nested loops. The Atari key ( /|\ ) will now act as a break key. Reorganized the IF statement to handle strings better. Installed option to output numbers in GWBASIC style: leading space or -, followed by space. Can be set by NUMFMT="% g " at the beginning of the program. Eliminated recursive ON ERROR trapping. Fixed DIM problem with multiple/mixed arrays. Fixed TAN error. Added looping - WHILE/WEND, REPEAT/UNTIL. Added LEN to the documentation. Fixed CHAIN variable loss. Added additional math error traps. Fixed -0 problem. Fixed negative numbers in print statements. Disk Size - 38539 bytes SPEED.BAS - 19.4 seconds SIEVE.BAS - 51.4 seconds TEST40.BAS - 17.0 seconds TEST31.BAS - 16.5 seconds TEST30.BAS - 15.9 seconds TEST21.BAS - 10.0 seconds Version 3.1a January 12, 1991 Minor bug : A$ = A$ + ... A$ is lost. Fixed. Version 3.1 January 5, 1991 New Statements: BLOAD, BSAVE, CALL, CALL INTERRUPT, CHAIN, CHDIR, DECR, ERROR, EVAL, INCR, KILL, MKDIR, ON ERROR GOTO, PGLOAD, PGSAVE, PGSHOW, RESUME, RMDIR, RUN New Functions: BIN$, COMMAND$, ERL, ERR, FALSE, LCASE$, PI, TRUE, UPCASE$, VARSEG, VARPTR Corrected the spelling of Walter Daniel's name. :-} Added support for .PGC files. Fixed DATA wrap around problem. Fixed DIAL problem. Error message for Portfolio Only Statements on PC. Disk Size - 35186 bytes SPEED.BAS - 25.9 seconds SIEVE.BAS - 79.5 seconds TEST31.BAS - 21.0 seconds TEST30.BAS - 20.5 seconds TEST21.BAS - 13.0 seconds Version 3.0 November 25, 1990. Added sample programs. Complied with Turbo C, version 2.0. Added Help file for Portfolio Address Function. Two Dimensional Arrays. Expanded TEST.BAS to TEST30.BAS with strings. Disk Size - 33123 bytes SPEED.BAS - 27.4 seconds TEST30.BAS - 21.5 seconds (corrected) TEST21.BAS - 13.0 seconds (corrected) New Functions: PBVER Version 2.9 Beta Release - September 30, 1990. Added Strings. Modified READ, SWAP and DIAL to handle strings. Added STRING arrays. Modified IF and PRINT to work with string expressions. Fixed PRINT" problem. Allow line numbers directly after THEN or ELSE. Now allows two dimensional arrays of any type. Converted to Turbo C++, Version 1.0. New Functions : ASC, DATE$, INSTR, INKEY$, VAL, LEFT$, MID$, RIGHT$, CHR$, HEX$, OCT$, SPACE$, STR$, STRING$, TIME$ Version 2.2 Not Released. Added hashing feature to symbol table to speed up variable table access. 10% increase in TEST. Added automatic default extension of ".BAS" Version 2.1 August 4, 1990 New Statements: DATA, READ, RESTORE New Functions : LOG TRON invoked from command line switch -T Adjusted the screen coordinates from 0,0 to 1,1 to match GWBASIC. While this will cause some incompatibilities with previous versions of PBASIC, it will make it more compatible with GWBASIC. Added INP to the documentation. Added FRE to the documentation. Installed Binary search for command checking. Speed increase about 40%. One letter variable names are not checked in command table. Fixed the load routine to allow for no CR/LF at the end of the file. Fixed FIX function. Fixed scientific constants. Fixed power (^) function. Disk Size - 29649 bytes SPEED.BAS - 30.9 seconds TEST21.BAS - 12.9 seconds Version 2.0 July 27, 1990 New Statements: LPRINT, PRINTER, FORMFEED, PRTSC, WAIT, OUT, DIM New Functions : LPOS, ATN, EXP, FIX, INT, COS, SIN, SQR, TAN, TIMER, \, INP, FRE New Portfolio Only : GETDISPLAY, DISPLAY, VLOCATE, VMOVE, VPOS, VCSRLIN, ROMVER, PORT 200 variables, 8 significant characters. TSR to invoke BASIC from inside editor. Program size limited to available memory. All variables are now SINGLE PRECISION FLOATING POINT. One Dimensional Floating Point Arrays. Fixed FOR/NEXT looping with a negative step. Fixed the use of FUNCTIONS in PRINT statements. Fixed EOF error on Portfolio: Lockup if no END statement. Added extensive printer support. DEFINT will now cause a syntax error. RND was changed to make it MS compatible. SWAP was make array compatible. Fixed ... else "string" problem. Added NEXT to the documentation. Version 1.1 July 21, 1990 New Statements: DEF SEG, POKE New Functions : PEEK New Portfolio Only : REFRESH, TICK, CLICK, STATUS Automatically invoke Editor on Error. Fixed ALARM problem: keystroke was going into buffer. Fixed ON x GOTO/GOSUB problem: Offset line count by 1. Improved Error Detection. Allow REM in PRINT with preceding colon (:). Implement the quote (') as a substitute for REM. Fix PSET documentation to indicate ()'s. Screen mode changes, return to original on error. Allow for spaces as separator in PRINT. Version 1.0 July 14, 1990 Initial release. TECHNICAL NOTES PBASIC is about 3300 lines of code was written in Turbo C, version 2.0, compiled to an executable file just under 58k in size. PBASIC was then compressed with LZEXE, version 0.91, to further reduce the size to about 38k. PBASIC will run on a regular PC, providing you do not use any Portfolio specific statements. If you have the Portfolio Emulation software (I60, I61), you can use all the features. PBASIC will now generate an erroςςOOppπOOOO πώO@ppχOO πώOODCχOpπ Oπ@ϒπO πρOOApτO@DpppϜpppϒςOOOOOOψAςOώ ppρOό O πψppO ψpOOO  p 2 - STOP encountered ERPϐϞϐpppOϐπϘpτϘpOτπϘpϐπϙppOϒϘϜpϐppOϐπϐppπ ϑO pOτ ϐπτppGϙ OpFOϙόOppDOρOpAϐπτO pp@OτOOppCπ πϘpBOϐOppPGLOAD f$:PGSAVE f$:SCREEN 7:GOTO 10 Changed PC error messages to interface with PBE. IF statements modified to allow for single expression evaluation. Allows for IF EOF(1) THEN etc... If the result is 0, it is false, anything else is true. Modified the FOR statement to work more like GWBASIC. If the starting value to beyond the ending value, the loop is not executed. This includes nested loops. The Atari key ( /|\ ) will now act as a break key. Reorganized the IF statement to handle strings better. Installed option to output numbers in GWBASIC style: leading space or -, followed by space. Can be set by NUMFMT="% g " at the beginning of the program. Eliminated recursive ON ERROR trapping. Fixed DIM problem with multiple/mixed arrays. Fixed TAN error. Added looping - WHILE/WEND, REPEAT/UNTIL. Added LEN to the documentation. Fixed CHAIN variable loss. Added additional math error traps. Fixed -0 problem. Fixed negative numbers in print statements. Disk Size - 38539 bytes SPEED.BAS - 19.4 seconds SIEVE.BAS - 51.4 seconds TEST40.BAS - 17.0 seconds TEST31.BAS - 16.5 seconds TEST30.BAS - 15.9 seconds TEST21.BAS - 10.0 seconds Version 3.1a January 12, 1991 Minor bug : A$ = A$ + ... A$ is lost. Fixed. Version 3.1 January 5, 1991 New Statements: BLOAD, BSAVE, CALL, CALL INTERRUPT, CHAIN, CHDIR, DECR, ERROR, EVAL, INCR, KILL, MKDIR, ON ERROR GOTO, PGLOAD, PGSAVE, PGSHOW, RESUME, RMDIR, RUN New Functions: BIN$, COMMAND$, ERL, ERR, FALSE, LCASE$, PI, TRUE, UPCASE$, VARSEG, VARPTR Corrected the spelling of Walter Daniel's name. :-} Added support for .PGC files. Fixed DATA wrap around problem. Fixed DIAL problem. Error message for Portfolio Only Statements on PC. Disk Size - 35186 bytes SPEED.BAS - 25.9 seconds SIEVE.BAS - 79.5 seconds TEST31.BAS - 21.0 seconds TEST30.BAS - 20.5 seconds TEST21.BAS - 13.0 seconds Version 3.0 November 25, 1990. Added sample programs. Complied with Turbo C, version 2.0. Added Help file for Portfolio Address Function. Two Dimensional Arrays. Expanded TEST.BAS to TEST30.BAS with strings. Disk Size - 33123 bytes SPEED.BAS - 27.4 seconds TEST30.BAS - 21.5 seconds (corrected) TEST21.BAS - 13.0 seconds (corrected) New Functions: PBVER Version 2.9 Beta Release - September 30, 1990. Added Strings. Modified READ, SWAP and DIAL to handle strings. Added STRING arrays. Modified IF and PRINT to work with string expressions. Fixed PRINT" problem. Allow line numbers directly after THEN or ELSE. Now allows two dimensional arrays of any type. Converted to Turbo C++, Version 1.0. New Functions : ASC, DATE$, INSTR, INKEY$, VAL, LEFT$, MID$, RIGHT$, CHR$, HEX$, OCT$, SPACE$, STR$, his thanks to Walter Daniel, for helping me track down the ever-elusive bugs, and putting up with a flaky copy of version 2.9. Thanks also to Don Messerli, for his help implementing the graphic routines to support the .PGC graphics standard. Finally, many thanks to Ron Luks, the sysop of the APORTFOLIO conference on Compuserve. ADDRESS If you have an comments, suggestions or bug reports, you can write to the author at: BJ Gleason The American University CSIS (Thin Air Labs) 4400 Massachusetts Avenue, N.W. Washington, DC 20016 Compuserve : 73337,2011 This program and documentation can be copied and distributed freely. It can not be sold or used for commercial purposes without permission. PBASIC version 4.0, Copyright 1991 by BJ Gleason. Portfolio, Atari, Microsoft, GWBASIC are trademarks of their respective companies.