home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Alpha / Whiteline Alpha.iso / tools / prtfolio / pbasic.txt < prev    next >
Encoding:
Text File  |  1994-09-22  |  71.4 KB  |  2,359 lines

  1. Portfolio BASIC, version 4.9  (c) 1991 BJ Gleason
  2.  
  3. by BJ Gleason,  The American University
  4.  
  5.  
  6. INTRODUCTION
  7.  
  8.      PBASIC is a simple BASIC interpreter.  It only requires 43k
  9.      of disk space and about 67k of memory to run.  PBASIC is a
  10.      batch oriented interpreter.  It will also interact with the
  11.      built-in editor for program development.
  12.  
  13.      PBASIC was one of the winners in the Compuserve/Portfolio
  14.      Conference Programming Contest, 1990.
  15.  
  16.  
  17. A NOTE FROM THE AUTHOR
  18.  
  19.      A number of considerate users have offered their help.  If
  20.      you have an interesting application that you have developed
  21.      in PBASIC, I will be more than happy to distribute your code
  22.      in future releases.  Please make sure to place your name and
  23.      other information as REMarks in the program.  You can
  24.      include a documentation file as well.  The only thing that I
  25.      ask is that you do not charge for the use of your program,
  26.      as I am not charging for the use of this interpreter.  Send
  27.      me a note, and tell me where the code is and I will include
  28.      it in the package.
  29.  
  30.      Thanks to all you have helped and are going to help!
  31.  
  32.  
  33. MANUAL AVAILABLE
  34.  
  35.      A 250 page manual on PBASIC is now available.  The manual is
  36.      8.5 x 11, and has comb binding so it can lay flat.  Each
  37.      instruction is explained in detail, with examples.  The
  38.      manual costs 35 dollars, including postage.  If you are
  39.      interested in obtaining the manual, send a check or money
  40.      order to "BJ Gleason" at the address on the last page of
  41.      this document.
  42.  
  43.  
  44. WHAT THE CRITICS SAY:
  45.  
  46.      PBASIC 2.1 was reviewed by John Jainschigg in Atari
  47.      Explorer, January 1991.  Here is some of he said: 
  48.      "...PBASIC is a terrific little job of programming... Though
  49.      freeware, PBASIC has been professionally and completely
  50.      documented... even those who are waiting on tenterhooks for
  51.      Atari's own Portfolio BASIC may find PBASIC very useful in
  52.      the interim.  The program is reasonably reliable, complete,
  53.      and professionally executed - and at the present time,
  54.      stands as the best alternative for casual programming on the
  55.      Portfolio system."
  56.  
  57.      Ron Luks, Sysop of the APORTFOLIO forum on Compuserve says:
  58.      "...I was blown away!!!  Its FAR, FAR more complete and
  59.      polished that I ever would have expected for a freeware
  60.      product.  The PBASIC manual is equal to the best I've seen
  61.      for any commercial program, and superior to 90% or the
  62.      rest."
  63.  
  64.      Don Messerli, developer of the PGC graphics standard, stated
  65.      in ATARI.RSC, The Atari Developer's Resource, May 1991:
  66.      "PBASIC is the most significant public domain program, and
  67.      arguably the most significant third-party application of any
  68.      kind currently available for the Portfolio."
  69.  
  70.  
  71. NOTES TO NEW USERS
  72.  
  73.      PBASIC is not like GWBASIC in one important feature. 
  74.      GWBASIC has a built-in editor, and PBASIC does not.  PBASIC
  75.      uses the Atari Portfolio's Built-in editor.  PBASIC is run
  76.      from the command line, with the name of the program you want
  77.      to execute.  For example, to run the program MENU.BAS, you
  78.      would type:  PBASIC MENU
  79.  
  80.      For more information, see INTERFACING WITH THE EDITOR, and
  81.      RUNNING PBASIC.
  82.  
  83.  
  84. PROGRAM LAUNCHER
  85.  
  86.      On the disk, there are a number of example programs.  To use
  87.      any of these programs, enter the command "PBASIC filename"
  88.      where filename is the name of the program you wish to
  89.      execute.  An alternative method is to use the program
  90.      launcher, MENU.BAS.  This provides a pull-down interface to
  91.      all the demo programs.  To use the launcher, enter the
  92.      command "PBASIC MENU".
  93.  
  94.  
  95. COMPATIBILITY NOTE
  96.  
  97.      There was a slight change in the PBASIC language from
  98.      version 4.5 to 4.6 that caused a minor incompatibility with
  99.      some programs.  For example, the following line was correct
  100.      in version 4.5:
  101.  
  102.           PSET (x,y)
  103.  
  104.      Notice the space between the "T" and the "(".  In version
  105.      4.6 and later this will cause an "= expected error in xx"
  106.      error.  In functions and statements that require the use of
  107.      a "(" as part of the syntax, no space is allowed.  So the
  108.      line would have to be re-written as:
  109.  
  110.           PSET(x,y)
  111.  
  112.      This can be done automatically with SPB.EXE, which will
  113.      eliminate any needed line numbers, spaces and REMarks.
  114.  
  115.  
  116. DESIGN CONSIDERATION
  117.  
  118.      When I was laying out the initial design of PBASIC, here are
  119.      some of the topics I took into consideration:
  120.  
  121.           - Microsoft BASIC compatible.
  122.           - Size of Interpreter (as small as possible).
  123.           - Unique features of the Portfolio.
  124.           - Using the Built-in editor for Program Editing.
  125.           - Reasonable size BASIC programs.
  126.  
  127.  
  128. NEW FEATURES FOR VERSION 4.9
  129.  
  130.      New Statements: SHIFT
  131.      Added Double Height, Half Height, Half Width characters.
  132.      Added OR and XOR characters to screen.
  133.      Modified PRINT EOL to match character size.
  134.      Fixed LOCATE for Graphics Screen.
  135.      Fixed Two Dimensional Array Problem.
  136.      Added array Accessing for MENU function.
  137.  
  138.  
  139.  
  140. INTERFACING WITH THE EDITOR
  141.  
  142.      Instead of trying to create an editor, PBASIC makes full use
  143.      of the built in editor.
  144.  
  145.      If you run BASIC without any parameters, it will load the
  146.      last file you used in the editor.  To speed up the process,
  147.      you might want to rename PBASIC.EXE to P.EXE, so you only
  148.      need to type P<RETURN> at the prompt.  You can also specify
  149.      a file to execute on the command line.
  150.  
  151.      Whenever an error is detected, an error message is
  152.      displayed, along with the line number.  Press any key and
  153.      PBASIC will invoke the built-in editor and point to the
  154.      error position.  This will only happen if the file you are
  155.      executing is the same as the one you are editing.  On other
  156.      systems, you will be returned to the DOS prompt.
  157.      On a PC compatible machine, the error message will include
  158.      the line number, character position and offset from the
  159.      front of the file.  This is so that the PBASIC EDITOR, for
  160.      the PC, can determine where the error is and point to it.
  161.  
  162.      ALTR.COM is a small TSR program that will, only from inside
  163.      the editor, save the current file and invoke PBASIC. 
  164.      PBASIC.EXE should be rename P.EXE for the <ALT-R> command to
  165.      work.  ALTR takes up about 450 bytes.  It can be removed by
  166.      rebooting the machine.  It can only be loaded into memory
  167.      once.  The <ALT-R> command will only work inside the editor.
  168.  
  169.      When the program is finished, PBASIC will wait for a
  170.      keypress and then return you to the editor.
  171.  
  172.  
  173. RUNNING PBASIC
  174.  
  175.           There are two forms to execute PBASIC:
  176.  
  177.                PBASIC [-T] [-E] [-P]
  178.  
  179.                PBASIC filename.ext [-T] [-E] [-P]
  180.  
  181.      In the first form, the default file is the last one edited
  182.      in the built-in editor on the Portfolio.  The second form
  183.      loads and executes the specified file.  If you leave off the
  184.      extension, the default ".BAS" is added.
  185.  
  186.      If you have run the ALTR program before editing your code,
  187.      you can execute PBASIC by pressing <ALT-R>.
  188.  
  189.      The command line switch -T will turn on the trace feature. 
  190.      This is the same as putting TRON at the beginning of you
  191.      program.
  192.  
  193.      The command line switch -E will force Portfolio Emulation. 
  194.      This can lock you your computer it I60 and I61 are not
  195.      loaded first.
  196.  
  197.      The command line switch -P will turn off the Portfolio
  198.      before the .BAS program is loaded.  This will allow the user
  199.      to load PBASIC from one card, and run a program on another
  200.      card.  Press any key to continue.
  201.  
  202.  
  203. GENERAL
  204.  
  205.      Source code is standard ASCII format.
  206.  
  207.      Source code can be in upper or lower case.
  208.  
  209.      130 variables.  Variable names can not exceed 8 characters
  210.      in length.
  211.  
  212.      Default string size is 256 bytes.  This can be changed with
  213.      SSIZE.
  214.  
  215.      FOR/NEXT loops may be nested 10 deep.
  216.  
  217.      GOSUBs may be nested 10 deep.
  218.  
  219.      WHILE / WEND may be nested 10 deep.
  220.  
  221.      REPEAT / UNTIL may be nested 10 deep.
  222.  
  223.      Line numbers are not required for each statement.  Only 100
  224.      line numbers are allowed.  They do not have to be in
  225.      sequence.  Line numbers can range from 1 to 65535.
  226.  
  227.      Multiple statements per line (:) is supported.
  228.  
  229.      Up to 10 Files can be open at the same time.
  230.  
  231.  
  232. DEVELOPING PROGRAMS WITH GWBASIC
  233.  
  234.      You can develop your programs on the PC with Microsoft BASIC
  235.      or QuickBASIC.  If using Microsoft BASIC, be sure to save
  236.      the file in ASCII format [ SAVE "myfile",A ] so that it can
  237.      be read by PBASIC.  
  238.  
  239.      For easier development on a PC, PBE, the PBASIC Editor is
  240.      now available.  PBE operates similar to Turbo Pascal, and
  241.      allows you to execute programs from inside the editor.  IT
  242.      will also let you transfer files back and forth to the
  243.      Portfolio.
  244.  
  245.  
  246. MATH EXPRESSIONS
  247.  
  248.           Single precision math.  Parentheses supported. 
  249.      Standard operator evaluation.  Hexadecimal and Octal
  250.      constants are supported.
  251.  
  252.           - negation
  253.           ^ exponent
  254.           * multiply
  255.           / divide
  256.           % remainder (MOD)
  257.           \ integer division
  258.           + addition
  259.           - subtraction
  260.           AND, OR, NOT, XOR, EQV, IMP
  261.           <, >, <=, >=, =, <>
  262.      
  263.  
  264. NOTES ON CONVENTIONS USED
  265.  
  266.      An expression (exp) can contain variables, constants.  When
  267.      a dummy exp is indicated, it is suggested that you use a
  268.      constant, i.e. POS(0).
  269.  
  270.      A variable name (varname) must be used when indicated.
  271.  
  272.      Unless otherwise noted, all parameters can be constants,
  273.      variables or equations.
  274.  
  275.      
  276. BASIC STATEMENTS
  277.  
  278.           I have tried to keep the syntax and semantics for the
  279.      statements as close to Microsoft BASIC as possible.  The
  280.      notes presented indicate exceptions.  There are some
  281.      statements included that are not from Microsoft.  They will
  282.      not run on GWBASIC.
  283.  
  284.  
  285.      BLOAD     filename, offset
  286.  
  287.                Load a file to location SEG:offset.
  288.  
  289.  
  290.      BSAVE     filename, offset, length
  291.  
  292.                Copies memory to file, starting from SEG:offset
  293.                for length bytes.
  294.  
  295.  
  296.      CALL      address
  297.  
  298.                Transfer control to SEG:address.  Data is passed
  299.                via the registers with the REG statement/function.
  300.  
  301.  
  302.      CALL INTERRUPT intno
  303.  
  304.                Invoke DOS interrupt intno.  Data is passed via
  305.                the registers with the REG statement/function.
  306.  
  307.  
  308.      CHAIN     filename
  309.  
  310.                Load and execute the indicated file.  All
  311.                variables are retained.
  312.  
  313.      CHDIR     path
  314.  
  315.                Change the current directory to path.
  316.  
  317.  
  318.      CLOSE#    fileno
  319.  
  320.                Close the file.
  321.  
  322.  
  323.      CLS
  324.  
  325.                Clears the screen.
  326.  
  327.  
  328.      CMODE     = cm
  329.  
  330.                Set character mode when printing in graphics mode. 
  331.                The bit pattern is:
  332.  
  333.                     0    Underline      (+1)
  334.                     1    Reverse        (+2)
  335.                     2    Double Width   (+4)
  336.                     3    Upside Down    (+8)
  337.                     4    Sideway        (+16)
  338.                     5    Double Height  (+32)
  339.                     6    Half Height    (+64)
  340.                     7    Half Width     (+128)
  341.                     8    OR bits        (+256)
  342.                     9    XOR bits       (+512)
  343.  
  344.                To set Reverse Wide = 2+4 = 6.  Use 24 to print
  345.                sideways in the other direction.
  346.  
  347.  
  348.      COMOUT    = val
  349.  
  350.                Send val to serial port.  See TERMINAL.BAS.
  351.  
  352.  
  353.      COMSET    = config
  354.  
  355.                Set the serial port to the config byte, bits
  356.                defined as follows:
  357.  
  358.           7 6 5          4 3        2             1 0 
  359.           Baud Rate      Parity     Stop Bits     Word Length
  360.           0 0 0 = 110    x 0 = none 0 = 1 bits    1 0 = 7 bits
  361.           0 0 1 = 150    0 1 = odd  1 = 2 bits    1 1 = 8 bits
  362.           0 1 0 = 300    1 1 = even
  363.           0 1 1 = 600
  364.           1 0 0 = 1200
  365.           1 0 1 = 2400
  366.           1 1 0 = 4800
  367.           1 1 1 = 9600
  368.  
  369.                See TERMINAL.BAS.
  370.  
  371.  
  372.      DATA      list of numbers/strings
  373.  
  374.                Allows for numbers to be stored inline.  Data
  375.                statements MUST have a line number.  Numbers are
  376.                separated by commas.  Data statements may be
  377.                located on any line of the program.  Strings must
  378.                be enclosed in quotes.
  379.  
  380.                     12 DATA 1,2,3,4,5,6
  381.  
  382.  
  383.      DECR(var)
  384.  
  385.                Decrement the variable by 1.
  386.  
  387.  
  388.      DEF funname(params) = expression
  389.  
  390.                Creates a functions called funname.  All variables
  391.                are global.  Function names do not have to begin
  392.                with FN.  Only numerical functions are allowed.
  393.  
  394.  
  395.      DEF SEG   = exp
  396.  
  397.                Assigns a segment address for direct memory
  398.                accessing via PEEK, POKE and CALL.
  399.  
  400.  
  401.      DIM       varname(size,[size])[,varname(size,[size])....]
  402.  
  403.                Creates a one or two dimensional array of single
  404.                precision floating point variables.  Arrays start
  405.                at 0.  Arrays are not initialized to a value. 
  406.                Arrays must be defined before they are used. 
  407.                Upper array bounds are not checked, arrays are not
  408.                allowed to go below 0.
  409.  
  410.  
  411.      END
  412.  
  413.                SYSTEM and END have the same effect.
  414.  
  415.  
  416.      ERROR     errnum
  417.                Simulate Error for testing ON ERROR GOTO.
  418.  
  419.  
  420.      EVAL      var$
  421.  
  422.                Evaluates the contents of var$ as if it was part
  423.                of a BASIC program.
  424.  
  425.  
  426.      EXITCMD   s$
  427.  
  428.                Exit PBASIC, and place the contents of s$ in the
  429.                keyboard buffer.
  430.  
  431.                     ....
  432.                     EXITCMD "dir *.dat"
  433.                          {exit PBASIC}
  434.                     A>dir *.dat
  435.                     .....
  436.  
  437.  
  438.      EXITCODE  n
  439.  
  440.                Exit PBASIC, and set MS/DOS ERRORLEVEL variable to
  441.                n.  ERRORLEVEL can be tested in a batch file.
  442.  
  443.                     SAMPLE.BAT
  444.                          CLS
  445.                          PBASIC myfile
  446.                          IF ERRORLEVEL 5 GOTO :ERROR
  447.                          ....
  448.  
  449.  
  450.      FOR       varname = exp TO exp [STEP exp]
  451.  
  452.  
  453.      FORMFEED
  454.  
  455.                Send a formfeed to the printer.
  456.  
  457.  
  458.      GLOCATE row,col
  459.  
  460.                Set the graphics cursor to location row, col. 
  461.                Used with GPRINT.
  462.  
  463.  
  464.      GOSUB     line number
  465.  
  466.  
  467.      GOTO      line number
  468.  
  469.      GPRINT list of expressions
  470.  
  471.                Bit mapped character display.  Top bit is 0,
  472.                bottom bit is 7.  Expressions can be a string of
  473.                hexadecimal values, or hex numbers.  Separators
  474.                are (;) and (,) where the comma will skip one
  475.                space.  This is handy for creating your own
  476.                character set.
  477.  
  478.                     screen 6
  479.                     gprint "58483e28cc" : 'display a man
  480.                     wait
  481.                     end
  482.  
  483.      IF        exp THEN statement [ ELSE statement ]
  484.  
  485.  
  486.      IF        exp THEN
  487.                     statements
  488.                [ ELSE
  489.                     statements ]
  490.                ENDIF
  491.  
  492.                Multi-line IF statements may not be nested.  There
  493.                can not be anything after the THEN or the ELSE on
  494.                the same line.
  495.  
  496.  
  497.      INCR(var)
  498.  
  499.                Increment var by 1.
  500.  
  501.  
  502.      INPUT     ["prompt" (,|;)] varname
  503.  
  504.                Reads input from the keyboard.  Only one variable
  505.                is allowed per input.  If a comma (,) separates
  506.                the prompt string and the varname, no question
  507.                mark (?) will be printed.  If a semi-colon (;) is
  508.                used, the question mark will appear. 
  509.  
  510.      INPUT#    fileno, varname
  511.  
  512.                This will read a variable from a disk file.
  513.  
  514.  
  515.      KILL      filename
  516.  
  517.                Delete filename from disk.
  518.  
  519.  
  520.      LINE(x1,y1)-(x2,y)[,c[,B[F]]]
  521.                Line will draw a line from x1,y1 to x2,y2.  c is
  522.                the color of the line.  B means to draw a box, and
  523.                F is to fill the box.
  524.  
  525.                NOTE:  You must write as LINE(... not LINE (...
  526.  
  527.  
  528.      LOCATE    row,col[,cursor]
  529.  
  530.                Move the cursor to row, col.  The optional
  531.                parameter cursor can be used to turn the cursor on
  532.                or off.  On the Portfolio: 0=off, 1=underline,
  533.                2=block.  On the PC: 0=off, 1=block, 2=block.
  534.  
  535.  
  536.      LPCHR$(x)
  537.  
  538.                Send the ASCII character of value x to the
  539.                printer.  This was done to allow the printing of
  540.                characters 0 and 9, where are filtered by the
  541.                LPRINT statement.
  542.  
  543.  
  544.      LPRINT    list of expressions
  545.  
  546.                Send output to printer.  See PRINT.
  547.  
  548.  
  549.      MID$(s$,p[,l])=r$
  550.  
  551.                Replace the characters in s$, starting at position
  552.                p, for length l, with the characters in r$.
  553.  
  554.  
  555.      MKDIR     path
  556.  
  557.                Create a directory named path.
  558.  
  559.  
  560.      NEXT      [varname]
  561.  
  562.                If no variable name is given, last FOR statement
  563.                is used.  If variable name is given, matching FOR
  564.                is searched for and used, if found.  This process
  565.                allows for exiting early from inner loops.
  566.  
  567.  
  568.      NUMFMT    = "format"
  569.  
  570.                In PBASIC numbers are not displayed in classic
  571.                GWBASIC format.  GWBASIC always prints numbers
  572.                with a leading space or -, and a trailing space. 
  573.                To make the porting of GWBASIC programs easier,
  574.                you can specify the format that numbers are to
  575.                print with the NUMFMT statement.  The default is
  576.                "%g", and GWBASIC format would be "% g ".  This
  577.                can also be used if you want all numbers in
  578.                scientific or other format.  See the PRINT USING
  579.                description for the format.
  580.  
  581.  
  582.      ON ERROR GOTO line number
  583.  
  584.                Error trapping.  When an error occurs, user will
  585.                be transferred to line number.  A line number of 0
  586.                will disable error trapping.
  587.  
  588.  
  589.      ON        exp  GOTO  list of line numbers
  590.  
  591.  
  592.      ON        exp  GOSUB list of line numbers
  593.  
  594.  
  595.      OPEN      "mode",fileno,filename
  596.  
  597.                Open a file.  Mode can be:
  598.  
  599.                     I    Input
  600.                     O    Output
  601.                     A    Append
  602.  
  603.                Fileno can be between 1 and 10.  Only ten files
  604.                may be open at any one time.  Filename is any
  605.                standard MS/DOS filename.
  606.  
  607.  
  608.      OUT       port, exp
  609.  
  610.                Send value to the indicated port.
  611.  
  612.  
  613.      POKE      addr, exp
  614.  
  615.                Places value at SEG:addr.  SEG is set via the DEF
  616.                SEG statement.  NOTE: Due to the design of the
  617.                Portfolio, if you poke screen memory (DEF
  618.                SEG=&HB000), the value may not appear.  After you
  619.                poke, you should use the REFRESH statement to
  620.                update the screen.
  621.  
  622.  
  623.      PRINT[@l,] list of expressions
  624.  
  625.                List of expressions can consist of strings,
  626.                variables, constants or expressions, separated by
  627.                the comma (,) or semi-colon (;) or a space ( ). 
  628.                Starting with version 4.0, the ? can be used as an
  629.                abbreviation for PRINT.  @l indicate screen
  630.                position 0-319, 40 columns by 8 rows.  For Model
  631.                100 compatibility.
  632.  
  633.                The PRINT statements will now work on a graphics
  634.                screen, but the screen will not scroll.
  635.  
  636.  
  637.      PRINT#    fileno, list of expressions
  638.  
  639.                Same as PRINT, but send output to file.
  640.  
  641.  
  642.      PRINT[@l,] USING format; list of variables
  643.  
  644.                This is not GWBASIC compatible.  To implement the
  645.                full version of the PRINT USING would take up too
  646.                much room.  This version is like C's printf. 
  647.                Format is a string, indicating the format to print
  648.                a single variable.  Each variable in the list is
  649.                printed with that format.  For more details, refer
  650.                to Turbo C's reference manual.  @l indicate screen
  651.                position 0-319, 40 columns by 8 rows.  For Model
  652.                100 compatibility.
  653.  
  654.                Format Specifiers:
  655.  
  656.                     %s        String
  657.                     %f        Real [-]dddd.dddd
  658.                     %e        Real [-]d.ddde[+/-]ddd
  659.                     %E        Real [-]d.dddE[+/-]ddd
  660.                     %g        Real, general format, e or f
  661.                     %G        Real, general format, E or f
  662.                     %%        Print % character in format string
  663.                     % g       Print numbers in GWBASIC format
  664.                     
  665.                Widths/Precisions:
  666.  
  667.                     n         n characters are printed
  668.                     0n        n characters with leading 0's
  669.                     .0        no decimal point
  670.                     .n        n digits after the decimal point
  671.  
  672.                Examples                      Output
  673.      
  674.                     "|%10.2f|";123.123       |    123.12|
  675.                     "|%10.0f|";123.123       |       123|
  676.                     "|%5.0f%%|";10;15        |   10%||   15%|
  677.                     "|%010.2f|";123.456      |0000123.46|
  678.                     "|%e|";456.789           |4.56789e+02|
  679.                     "|%E|";567.901           |5.67901E+02|
  680.  
  681.  
  682.      PRINT#    fileno, USING format; list of variables
  683.  
  684.                Same as PRINT USING, but send output to file.
  685.  
  686.  
  687.  
  688.      PRINTER   
  689.  
  690.                This is a toggle to start copying all PRINT
  691.                statements to the printer.  Issue it again and it
  692.                will toggle off.  It can be used instead of
  693.                converting all PRINTs to LPRINTs.  Information
  694.                will still be displayed on the screen.  This will
  695.                not wrap the output lines like the screen will.
  696.  
  697.  
  698.      PRTSC
  699.  
  700.                This invokes the PRINT SCREEN function to copy the
  701.                screen out to the printer.  If you are using a
  702.                laser printer, you might want to use a FORMFEED
  703.                after this to do a page eject.
  704.  
  705.  
  706.      PSET(row, col) [, exp]
  707.  
  708.                Set the pixel at row, col to exp.  The Portfolio,
  709.                regardless of the screen mode, has a maximum
  710.                64x240 for row, col.  Exp can evaluate to 0 or 1.
  711.  
  712.  
  713.      RANDOMIZE
  714.  
  715.                Initialize the random number generator.
  716.  
  717.  
  718.      READ      list of variables
  719.  
  720.                Read the values of the variables from the DATA
  721.                statements.  Variables can be simple or array.
  722.  
  723.  
  724.      REG       rn, val
  725.  
  726.                Set rn to val.  Allows for access to the 8086's
  727.                register set.  Values for rn are:
  728.  
  729.                     0 - Flags
  730.                     1 - AX
  731.                     2 - BX
  732.                     3 - CX
  733.                     4 - DX
  734.                     5 - SI
  735.                     6 - DI
  736.      
  737.  
  738.      REM
  739.  
  740.                Remark.  The rest of the line is ignored.  You can
  741.                also use the quote (') mark as a REM statement.
  742.  
  743.  
  744.      REPEAT / UNTIL exp
  745.  
  746.                Statements between the REPEAT and UNTIL statements
  747.                are executed until exp becomes TRUE.
  748.  
  749.  
  750.      RESTORE   [line number]
  751.  
  752.                Sets the internal data pointer to the specified
  753.                line number.  Line number specified must be a data
  754.                statement.  If no line number is given, the data
  755.                pointer will point back to the first data
  756.                location.
  757.  
  758.  
  759.      RESUME    line number
  760.  
  761.                After an error is trapped via ON ERROR GOTO,
  762.                resume will allow a program to continue at the
  763.                indicated line number.
  764.  
  765.  
  766.      RETURN
  767.  
  768.                Return from a subroutine invoked via a GOSUB.
  769.  
  770.  
  771.      RMDIR
  772.  
  773.                Remove a directory from the disk.  Directory must
  774.                be empty.
  775.  
  776.  
  777.      RUN       filename
  778.  
  779.                Load and execute the indicated program.  All the
  780.                variables are reset.
  781.  
  782.      SCREEN    exp
  783.  
  784.                Set the screen mode.  There is no testing for
  785.                validity.  Some of the values that work on the
  786.                Portfolio are:
  787.  
  788.                      4   graphics  320x200
  789.                      5   graphics  320x200
  790.                      6   graphics  640x200
  791.                      7   text      80x25
  792.                      8   graphics  160x200
  793.                     10   graphics  640x200
  794.  
  795.                These are standard PC modes, but remember that the
  796.                Portfolio Screen is only 240x64.
  797.  
  798.                If you use the screen function of the portfolio,
  799.                it is highly recommended that you set the screen
  800.                back to mode 7 before you exit.  Many portfolio
  801.                utilities only work in mode 7.
  802.  
  803.                At present, text will not be displayed properly on
  804.                a graphics screen.
  805.  
  806.  
  807.      SHIFT = x
  808.  
  809.                Set the Shift flags.  See SHIFT (function) for the
  810.                bit map.  This can be used to set NUMLOCK.
  811.  
  812.                     SHIFT = 32  : rem set numlock on
  813.  
  814.  
  815.      SSIZE = x
  816.  
  817.                This sets the default string size.  Normally,
  818.                strings are set to 256 bytes in length.  Under
  819.                many circumstances, this can waste a large amount
  820.                of memory.  For Example, A$(100) normally requires
  821.                about 25600 bytes.  If SSIZE=80, it only requires
  822.                about 8100 bytes.  This should normally be set
  823.                only once at the beginning of the program.  The
  824.                range of x can be 1 to 350.  You can use it
  825.                elsewhere in the program, but be careful.
  826.  
  827.  
  828.      STOP
  829.  
  830.                To allow for "breakpoints", STOP will terminate
  831.                the program and display the line number.  It will
  832.                point the built-in editor to the last position
  833.                executed if the editor file is the same as the
  834.                file being executed.
  835.  
  836.  
  837.      SWAP      varname, varname
  838.  
  839.                Exchange the contents of two variables.  They must
  840.                be of the same type.
  841.  
  842.  
  843.      SYSTEM
  844.  
  845.                END and SYSTEM have the same effect.
  846.  
  847.  
  848.      TROFF
  849.  
  850.                Disable line tracing.
  851.  
  852.  
  853.      TRON
  854.  
  855.                Enable line tracing.  Will display the line number
  856.                in brackets ([x]).  Using this statement will slow
  857.                down the program execution.  Can be placed
  858.                anywhere in program.
  859.  
  860.  
  861.      WAIT
  862.  
  863.                Unlike the GWBASIC version, this only waits for a
  864.                key press.  It gives no prompt and returns no
  865.                value.
  866.  
  867.  
  868.      WHILE exp / WEND
  869.  
  870.                All the statements between the WHILE and WEND
  871.                statements are executed while exp is TRUE.  If exp
  872.                is FALSE, the loop is not executed.
  873.  
  874.  
  875.      WRITE     list of expressions
  876.  
  877.                Similar to PRINT, but each element is separated by
  878.                a command (,), and strings are enclosed in quotes
  879.                (").
  880.  
  881.      WRITE#    fileno, list of expressions
  882.  
  883.                Same as WRITE, but send output to file.
  884.  
  885.  
  886. BASIC FUNCTIONS
  887.  
  888.           I have tried to keep the syntax and semantics for the
  889.      functions as close to Microsoft BASIC as possible.  The
  890.      notes presented indicate exceptions.
  891.  
  892.  
  893.      ABS(exp)
  894.  
  895.                Returns the absolute value of exp.
  896.  
  897.  
  898.      ACOS(exp)
  899.  
  900.                Returns the arc cosine of exp.
  901.  
  902.  
  903.      ARG$(x)
  904.  
  905.                Returns the command line arguments.  ARG$(1) would
  906.                be the first parameter after the PBASIC command. 
  907.                Under DOS 3.0 and later, ARG$(0) would be the name
  908.                of the PBASIC program.
  909.  
  910.      ARGC
  911.  
  912.                Returns the number of parameters on the command
  913.                line when PBASIC starts.  If ARGC returns 0, then
  914.                the program from the editor is being executed.
  915.  
  916.  
  917.      ASC(x$)
  918.  
  919.                Returns ASCII value of the first character in x$.
  920.  
  921.  
  922.      ASIN(exp)
  923.  
  924.                Returns the arc sine of exp.
  925.  
  926.  
  927.      ATN(exp)
  928.  
  929.                Returns the arc tangent of exp.
  930.  
  931.  
  932.      BIN$(n)
  933.  
  934.                Convert n to a Binary string.
  935.  
  936.  
  937.      CEIL(x)
  938.  
  939.                Round x up to the next integer.
  940.  
  941.  
  942.      CHARPTR
  943.  
  944.                Returns the address of the bit maps for the ASCII
  945.                characters.  This address can be used to insert
  946.                your own character set.
  947.  
  948.  
  949.      CHR$(n)
  950.  
  951.                Returns the ASCII character of the value n.
  952.  
  953.  
  954.      COMMAND$
  955.  
  956.                Returns the command line tail.
  957.  
  958.  
  959.      COMIN
  960.  
  961.                Returns the ASCII value from the serial port.  See
  962.                TERMINAL.BAS.
  963.  
  964.  
  965.      COMSTAT
  966.  
  967.                Returns the status of the serial port:
  968.  
  969.                     Bit  Significance (if set)
  970.                               Port Status
  971.                     15   timed-out
  972.                     14   transmit shift register empty
  973.                     13   transmit holding register empty
  974.                     12   break detected
  975.                     11   framing error detected
  976.                     10   parity error detected
  977.                     9    overrun error detected
  978.                     8    receive data ready
  979.                               Modem Status
  980.                     7    receive line signal detect
  981.                     6    ring indicator
  982.                     5    data-set-ready
  983.                     4    clear-to-send
  984.                     3    change in receive line signal detect
  985.                     2    trailing edge ring indicator
  986.                     1    change in data-set-ready status
  987.                     0    change in clear-to-send status
  988.  
  989.                See TERMINAL.BAS.
  990.  
  991.  
  992.      COS(exp)
  993.  
  994.                Returns the Cosine of exp.
  995.  
  996.  
  997.      COSH(exp)
  998.  
  999.                Returns the Hyperbolic cosine of exp.
  1000.  
  1001.  
  1002.      CSRLIN
  1003.  
  1004.                Returns the current cursor line.
  1005.  
  1006.  
  1007.      CWD$
  1008.  
  1009.                Returns the current directory
  1010.  
  1011.  
  1012.      DATE$     
  1013.  
  1014.                Returns the system date.
  1015.  
  1016.  
  1017.      DEG(exp)
  1018.  
  1019.                Converts radians to degrees.
  1020.  
  1021.  
  1022.      DMS(exp)
  1023.  
  1024.                Convert degrees into degrees/minutes/seconds, in
  1025.                the form ddd.mmss.
  1026.  
  1027.  
  1028.      DOSVER
  1029.  
  1030.                Returns the version number of MS/DOS.
  1031.  
  1032.  
  1033.      EOF(fileno)
  1034.  
  1035.                Returns TRUE if fileno is at End-of-File.
  1036.  
  1037.  
  1038.      ERADR
  1039.  
  1040.                Returns the position of the error that occurred,
  1041.                as an offset from the beginning of the program.
  1042.  
  1043.  
  1044.      ERL
  1045.  
  1046.                Return the line number the error occurred on.
  1047.  
  1048.  
  1049.      ERMSG$
  1050.  
  1051.                Returns the text of the error that occurred.
  1052.  
  1053.  
  1054.      ERR
  1055.  
  1056.                Returns the error number of the last error.
  1057.  
  1058.  
  1059.      EXISTS(x$)
  1060.  
  1061.                Returns TRUE if the file x$ exists.
  1062.  
  1063.                     IF EXISTS("mystuff.txt") THEN ...
  1064.  
  1065.  
  1066.      EXP(exp)
  1067.  
  1068.                Returns e to the power of exp.
  1069.  
  1070.  
  1071.      FALSE
  1072.  
  1073.                Returns 0.
  1074.  
  1075.  
  1076.      FILESIZE
  1077.  
  1078.                Returns the filesize of the last file found by
  1079.                FINDFILE or FINDNEXT.
  1080.  
  1081.  
  1082.      FINDFILE$(x$)
  1083.  
  1084.                Returns the name of a file matching x$.  Wildcards
  1085.                are allowed.
  1086.  
  1087.                     print "Directory of ";cwd$
  1088.                     n$=findfile$("*.*")
  1089.                     while n$<>""
  1090.                          print n$;tab(15);filesize
  1091.                          n$=findnext$
  1092.                     wend
  1093.  
  1094.      FINDNEXT$
  1095.  
  1096.                Returns the next file matching the criteria set by
  1097.                FINDFILE.
  1098.  
  1099.  
  1100.      FIX(exp)
  1101.  
  1102.                Returns the integer portion of exp.
  1103.  
  1104.  
  1105.      FRE(exp)
  1106.  
  1107.                Returns the free amount of memory.  The parameter
  1108.                exp is a dummy expression.
  1109.  
  1110.  
  1111.      FREEFILE
  1112.  
  1113.                Returns the next free file number.
  1114.  
  1115.  
  1116.      HEX$(n)
  1117.  
  1118.                Converts n to a hexadecimal string.
  1119.  
  1120.  
  1121.      INKEY$
  1122.  
  1123.                If a key is pressed, the character is returned,
  1124.                otherwise, the empty string ("") is returned.  For
  1125.                a function key, a 2 character string is returned,
  1126.                with the second character indicating the function
  1127.                key.
  1128.  
  1129.  
  1130.      INP(port)
  1131.  
  1132.                Returns the byte value from port.
  1133.  
  1134.  
  1135.      INPUT$(n,#f)
  1136.  
  1137.                Returns the next n characters from file #f.
  1138.  
  1139.  
  1140.      INSTAT
  1141.  
  1142.                Returns TRUE if key has been pressed, otherwise
  1143.                FALSE.
  1144.  
  1145.      INSTR(x$,y$)
  1146.  
  1147.                Returns the position of y$ in x$.
  1148.  
  1149.  
  1150.      INT(exp)
  1151.  
  1152.                Returns the integer portion of exp.
  1153.  
  1154.  
  1155.      ISALTR
  1156.  
  1157.                Returns -1 if ALTR.COM is loaded, 0 otherwise.
  1158.  
  1159.  
  1160.      ISRUN
  1161.  
  1162.                Returns -1 if current program was executed via the
  1163.                RUN "filename" statement from another program.
  1164.  
  1165.                     IF ISRUN THEN RUN "MENU" ELSE END
  1166.  
  1167.  
  1168.      LCASE$(x$)
  1169.  
  1170.                Return the lowercase version of x$.
  1171.  
  1172.  
  1173.      LEFT$(x$,n)
  1174.  
  1175.                Returns the leftmost n characters of x$.
  1176.  
  1177.  
  1178.      LEN(x$)
  1179.  
  1180.                Returns the length of x$.
  1181.  
  1182.      LOG(exp)
  1183.  
  1184.                Returns the natural logarithm of exp.
  1185.  
  1186.  
  1187.      LPOS(exp)
  1188.  
  1189.                Returns the current position of the line printer
  1190.                head.  Exp is a dummy expression.
  1191.  
  1192.  
  1193.      LTRIM$(n$)
  1194.  
  1195.                Strips off any leading spaces.
  1196.  
  1197.      MID$(x$,n[,m])
  1198.  
  1199.                Returns a string from x$, starting at position n
  1200.                for m characters.
  1201.  
  1202.  
  1203.      MSD(exp)
  1204.  
  1205.                Converts degrees/minutes/seconds in the form
  1206.                ddd.mmss to degrees.
  1207.  
  1208.  
  1209.      OCT$(n)
  1210.  
  1211.                Converts n to an Octal string.
  1212.  
  1213.  
  1214.      PASSWORD$
  1215.  
  1216.                Reads a 8 character string from the keyboard
  1217.                without displaying it on the screen.
  1218.  
  1219.  
  1220.      PBVER
  1221.  
  1222.                Returns the version number of PBASIC.
  1223.  
  1224.  
  1225.      PEEK(address)
  1226.  
  1227.                Returns the byte from memory location SEG:address. 
  1228.                SEG is set via the DEF SEG instruction.
  1229.  
  1230.  
  1231.      PI
  1232.  
  1233.                Returns the value of PI = 3.14159
  1234.  
  1235.  
  1236.      POINT(row,col)
  1237.  
  1238.                Returns the value of the pixel at row,col.  If
  1239.                this function does not appear to work, try running
  1240.                FIX0D, to fix the ROM pixel read function.
  1241.  
  1242.  
  1243.      POS(exp)
  1244.  
  1245.                Returns the current cursor column.  Exp is a dummy
  1246.                expression.
  1247.  
  1248.  
  1249.      PROGLOC
  1250.  
  1251.                Returns the address of the BASIC program.
  1252.  
  1253.  
  1254.      RAD(exp)
  1255.  
  1256.                Convert degrees to radians.
  1257.  
  1258.  
  1259.      RAND(exp)
  1260.  
  1261.                This will return a number between 0 and exp-1. 
  1262.  
  1263.  
  1264.      REG(rn)
  1265.  
  1266.                Returns rn's value.  Allows for access to the
  1267.                8086's register set.  Values for rn are:
  1268.  
  1269.                     0 - Flags
  1270.                     1 - AX
  1271.                     2 - BX
  1272.                     3 - CX
  1273.                     4 - DX
  1274.                     5 - SI
  1275.                     6 - DI
  1276.  
  1277.  
  1278.      REVERSE$(x$)
  1279.  
  1280.                Return the reverse of the string x$.
  1281.  
  1282.  
  1283.      RIGHT$(x$,n)
  1284.  
  1285.                Returns the rightmost n characters from x$.
  1286.  
  1287.  
  1288.      RND
  1289.  
  1290.                This will return a number between 0 and 1.
  1291.  
  1292.  
  1293.      RTRIM$(n$)
  1294.  
  1295.                Strips any trailing spaces from the string.
  1296.  
  1297.  
  1298.      SCREEN
  1299.  
  1300.                Returns the current video mode.  See the command
  1301.                SCREEN for more information.
  1302.  
  1303.  
  1304.      SGN(exp)
  1305.  
  1306.                Returns the sign of exp.
  1307.  
  1308.                     -1   exp < 0
  1309.                      0   exp = 0
  1310.                      1   exp > 0
  1311.  
  1312.  
  1313.      SHIFT
  1314.  
  1315.                Returns the status of the shift keys.
  1316.  
  1317.                     Bit  Meaning
  1318.                     7    Insert On
  1319.                     6    Caps Lock On
  1320.                     5    Num Lock On
  1321.                     4    Scroll Lock On
  1322.                     3    Alt Key is down
  1323.                     2    Ctrl Key is down
  1324.                     1    Left Shift Key is down
  1325.                     0    Right Shift Key is down
  1326.  
  1327.  
  1328.      SIN(exp)
  1329.  
  1330.                Returns the sine of exp.
  1331.  
  1332.  
  1333.      SINH(exp)
  1334.  
  1335.                Returns the hyperbolic sine of exp.
  1336.  
  1337.  
  1338.      SPACE$(n)
  1339.  
  1340.                Returns a string of n spaces.
  1341.  
  1342.  
  1343.      SPC(n)
  1344.  
  1345.                Returns a string of n spaces.
  1346.  
  1347.  
  1348.      SQR(exp)
  1349.  
  1350.                Returns the Square Root of exp.
  1351.  
  1352.  
  1353.      STR$(n)
  1354.  
  1355.                Returns the string representation of n.
  1356.  
  1357.  
  1358.      STRING$(n,m)
  1359.  
  1360.                Returns a string composed of n characters.  m is
  1361.                the ASCII value of the characters. 
  1362.  
  1363.  
  1364.      TAB(n)
  1365.  
  1366.                Moves the cursor to the nth column.
  1367.  
  1368.  
  1369.      TAN(exp)
  1370.  
  1371.                Returns the tangent of exp.
  1372.  
  1373.  
  1374.      TANH(exp)
  1375.  
  1376.                Returns the hyperbolic tangent of exp.
  1377.  
  1378.  
  1379.      TIME$
  1380.  
  1381.                Returns the system time.
  1382.  
  1383.  
  1384.      TIMER
  1385.  
  1386.                Returns the number of seconds since midnight.
  1387.  
  1388.  
  1389.      TRUE
  1390.  
  1391.                Returns -1.
  1392.  
  1393.  
  1394.      UCASE$(x$)
  1395.  
  1396.                Returns the uppercase version of x$.
  1397.  
  1398.  
  1399.      VAL(x$)
  1400.  
  1401.                Returns the numeric value of x$.
  1402.  
  1403.  
  1404.      VARSEG(var)
  1405.                Returns the segment of the variable.
  1406.  
  1407.  
  1408.      VARPTR(var)
  1409.  
  1410.                Returns the offset of the variable.
  1411.  
  1412.  
  1413.      WKSREAD(filename, row, col)
  1414.  
  1415.                Returns the numeric contents of the cell at row,
  1416.                col from a worksheet file.  Default Extension is
  1417.                .WKS.  Row/Col start at 0,0.  Example B5 would be
  1418.                4,1.
  1419.  
  1420.  
  1421.      WKSREAD$(filename, row, col)
  1422.  
  1423.                Returns the string contents of the cell at row,
  1424.                col from a worksheet file.  Default Extension is
  1425.                .WKS.  Row/Col start at 0,0.  Example D10 would be
  1426.                9,3.
  1427.   
  1428.  
  1429.      WKSTYPE(filename, row, col)
  1430.  
  1431.                Returns the type of the cell at row, col from a
  1432.                worksheet file.  Default Extension is .WKS. 
  1433.                Row/Col start at 0,0.  Example AB2 would be 1,27.
  1434.  
  1435.                Values returned:
  1436.                     1    EOF       12   Blank
  1437.                     13   Integer   14   Real
  1438.                     15   Label     16   Formula Result (Real)
  1439.  
  1440.  
  1441. PORTFOLIO ONLY STATEMENTS
  1442.  
  1443.      The statements in this section are specific to the Atari
  1444.      Portfolio and will not run on a regular PC.  YOU CAN LOCK UP
  1445.      YOUR REGULAR PC IF YOU ATTEMPT TO USE THESE.  Starting with
  1446.      version 4.0, using these statements on a standard PC will
  1447.      generate an error message.
  1448.  
  1449.  
  1450.      ALARM
  1451.  
  1452.                This will beep the speaker, about once a second
  1453.                until the user presses a key.  The program will
  1454.                then continue with the next statement.
  1455.  
  1456.  
  1457.      BEEP
  1458.  
  1459.                This will cause a single beep from the speaker.
  1460.  
  1461.  
  1462.      BOX       row1, col1, row2, col2, type
  1463.  
  1464.                This will draw a box.  Row1 and Col1 specify the
  1465.                upper left corner position of the box, while Row2
  1466.                and Col2 specify the lower right corner.  Type is
  1467.                0 for single line box, and 1 for a double line
  1468.                box.
  1469.  
  1470.                Trying to draw a box larger than the screen (8x40)
  1471.                has unpredictable results.
  1472.  
  1473.  
  1474.      CLICK
  1475.  
  1476.                Make the key click sound.
  1477.  
  1478.  
  1479.      DIAL      string
  1480.  
  1481.                This will dial the "number" through the speaker. 
  1482.                Valid characters for tones are: 0 1 2 3 4 5 6 7 8
  1483.                9 A B C D * #.  The letters must be in uppercase.
  1484.  
  1485.  
  1486.      DISPLAY   exp
  1487.  
  1488.                Set the Portfolio screen to Normal, Static or
  1489.                Tracked.  0=Static, 1=Normal, 2=Tracked.  The mode
  1490.                is only effective while in PBASIC.  Using this
  1491.                statement might clear the screen depending on the
  1492.                position of the cursor.
  1493.  
  1494.  
  1495.      EDIT$(title$,x$)
  1496.  
  1497.                This function return a string after it has been
  1498.                edited by the user.  Title$ is the title placed on
  1499.                the editing box, while X$ is the string to be
  1500.                edited.  The text under the window is not saved. 
  1501.                The window located at the current cursor position.
  1502.  
  1503.  
  1504.      ERRWIN    row, col, "message"
  1505.  
  1506.                This will draw a box around the message and
  1507.                display it at the specified row, col.  It will
  1508.                then beep and wait for a keypress.  The text
  1509.                underneath the message is left untouched.
  1510.  
  1511.                Trying to place the message outside the screen
  1512.                (8x40) has unpredictable results.
  1513.  
  1514.  
  1515.      GETDISPLAY
  1516.  
  1517.                This function will return the current display
  1518.                mode.  See DISPLAY for details.
  1519.  
  1520.  
  1521.      INVERT
  1522.  
  1523.                Reverse the image on the graphics screen.
  1524.  
  1525.  
  1526.      MENU(row, col, display, top line, selected, elements,
  1527.           "Title", entries....)
  1528.  
  1529.                This will display a menu, allow a selection, and
  1530.                will return the item selected.  If value returned
  1531.                is -1, then the escape has been pressed.  If the
  1532.                value returned is > 255 then (value % 256) is the
  1533.                selected element, and (value \ 256) is the top
  1534.                line.  Elements are numbered from 0.
  1535.  
  1536.                Row and Col indicate the location of the menu. 
  1537.                Display is the number of elements to display at
  1538.                one time.  The maximum is 6.  Top Line is element
  1539.                at the top of the menu, and selected is the
  1540.                element that the cursor is placed on.  Elements is
  1541.                the number of menu entries plus the Title.  The
  1542.                title string is first, followed by each entry. 
  1543.                Each element can be a string or a string variable.
  1544.  
  1545.                Example:
  1546.  
  1547.                     mc = MENU(2,2,4,0,0,7,"Demo","A", "B", "C",
  1548.                     "D", "E", "F")
  1549.  
  1550.                If the user picks A, mc = 0, for B, mc = 1.  If
  1551.                the user picks F, mc = 517, which means the entry
  1552.                is 5, and the top line was 2.  This will allow
  1553.                selection from the menu from the same position the
  1554.                second time it is invoked.
  1555.  
  1556.                Starting with version 4.7, you can have more
  1557.                entries than elements specifies.  This allows for
  1558.                more flexible handling of the menus.  After
  1559.                element number of entries, the rest are ignored.
  1560.  
  1561.                Starting with version 4.9, if the number of
  1562.                elements is negative, this will tigger the array
  1563.                mode:
  1564.  
  1565.                     mc=menu(2,2,4,0,0,-7,a$(5))
  1566.  
  1567.                Where a$(5) will contain the "title" string,
  1568.                A$(6..11) will contain the elements.  This allows
  1569.                for a much more flexible addressing scheme.
  1570.  
  1571.  
  1572.      OFF
  1573.  
  1574.                This will turn the Portfolio off until the user
  1575.                presses a key.  The program will continue
  1576.                execution with the next statement.
  1577.  
  1578.  
  1579.      PGLOAD    filename
  1580.  
  1581.                Load a .PGC file into screen memory.
  1582.  
  1583.  
  1584.      PGSAVE    filename
  1585.  
  1586.                Save video memory to .PGC file.
  1587.  
  1588.  
  1589.      PGSHOW    filename, delay
  1590.  
  1591.                Display a .PGC file, and wait delay seconds.  If
  1592.                delay is 0, wait for keypress.
  1593.  
  1594.                
  1595.      PORT
  1596.  
  1597.                This function will return a -1 if running on a
  1598.                Portfolio, a 0 if not.  Handy if you want to run
  1599.                program on both machines without locking up the
  1600.                PC.  WARNING: There is no positive way to identify
  1601.                the Portfolio.  This functions checks to see if
  1602.                the Interrupt 61h vector is pointing to 0000:0000. 
  1603.                This is not normally used on the PC, but is on the
  1604.                Portfolio.  If you are running a TSR that takes
  1605.                over this vector, PORT will return 1.
  1606.  
  1607.  
  1608.      REFRESH
  1609.  
  1610.                Copy video memory to the LCD controller.  Needed
  1611.                for when you are doing direct write to screen
  1612.                memory.
  1613.  
  1614.      ROMVER
  1615.  
  1616.                This function will return the version number of
  1617.                the Portfolio rom's.
  1618.  
  1619.  
  1620.      SCRLOAD n$
  1621.  
  1622.                Copy the contents from n$ back to the screen.
  1623.  
  1624.  
  1625.      SCRSAVE n$
  1626.  
  1627.                Save the contents of the screen to n$.  Using
  1628.                SSIZE, set the size of the strings to at least 325
  1629.                since the screen requires 320 bytes to be saved. 
  1630.                No check is made to see if enough memory is
  1631.                available.
  1632.  
  1633.                Example:
  1634.  
  1635.                     SSIZE=325:n$="" : rem initialize n$
  1636.                     SCRSAVE n$ : rem save it
  1637.                     ....
  1638.                     SCRLOAD n$ : rem restore it
  1639.  
  1640.  
  1641.      SOUND     code, duration
  1642.  
  1643.                This will activate the tone generator.  Duration
  1644.                is the length of tone in 10 msec intervals.  Tone
  1645.                codes are displayed below.  These codes are taken
  1646.                from the Atari Portfolio Technical Reference
  1647.                Manual, copyrighted by the Atari Corporation.
  1648.  
  1649.                CODE      NOTE      Frequency (Hz)
  1650.  
  1651.                48        D#5       622.3
  1652.                49        E5        659.3
  1653.                50        F5        698.5
  1654.                51        F#5       740.0
  1655.                52        G5        784.0
  1656.                53        G#5       830.6
  1657.                54        A5        880.0
  1658.                55        A#5       932.3
  1659.                56        B5        987.8
  1660.                57        C6        1046.5
  1661.                58        C#6       1108.7
  1662.                41        D6        1174.7
  1663.                59        D#6       1244.5
  1664.                60        E6        1318.5
  1665.                61        F6        1396.9
  1666.                14        F#6       1480.0
  1667.                62        G6        1568.0
  1668.                44        G#6       1661.2
  1669.                63        A6        1760.0
  1670.                 4        A#6       1864.7
  1671.                 5        B6        1975.5
  1672.                37        C7        2093.0
  1673.                47        C#7       2217.5
  1674.                 6        D7        2349.3
  1675.                 7        D#7       2489.0
  1676.  
  1677.                Aside from these codes, other values will produce
  1678.                sounds as well.
  1679.  
  1680.  
  1681.      STATUS    exp
  1682.  
  1683.                This will enable or disable the Status line.  This
  1684.                is the line that you see when you use the <LOCK>
  1685.                key on the Portfolio.  0 for off, 1 for on.
  1686.  
  1687.  
  1688.      TICK      exp
  1689.  
  1690.                Sets the Clock tick speed.  0 is Normal, 1 tick
  1691.                every 128 seconds.  1 is Fast, 1 tick every
  1692.                second.  1 uses much more power.
  1693.  
  1694.  
  1695.      VCSRLIN
  1696.  
  1697.                Returns the current virtual cursor line.
  1698.  
  1699.  
  1700.      VLOCATE   row,col
  1701.  
  1702.                Move the virtual cursor to row, col.  This
  1703.                location will be at position 1,1 on the physical
  1704.                screen.
  1705.  
  1706.  
  1707.      VMOVE     dir, dis
  1708.  
  1709.                Move the screen in direction dir for dis number of
  1710.                lines.  Works only in Static and Tracked modes. 
  1711.                Same as using the ALT arrow keys.  Values for dir
  1712.                are 1=Up,2=Down,3=Left,4=Right.
  1713.  
  1714.  
  1715.      VPOS(exp)
  1716.  
  1717.                Returns the current virtual cursor column.  Exp is
  1718.                a dummy expression.
  1719.  
  1720.  
  1721.  
  1722. BREAKING OUT OF PROGRAMS
  1723.  
  1724.      It appears that if you use the CONTROL-C key to break out of
  1725.      a PBASIC program, it will lock up a few minutes later.  I
  1726.      have tried to trace this, but to no avail.  Chalk it up a
  1727.      difference between the PC and Portfolio.  To eliminate this
  1728.      problem, you can now use the ATARI key, ( /|\ ) by itself,
  1729.      to exit from a PBASIC program.  Press the key at any point. 
  1730.      As long as you hold down the key, the error message "BREAK
  1731.      in xx" will remain on the screen.  Release the key and you
  1732.      are returned to the MD/DOS prompt.  If you execute the
  1733.      program from the editor, you will be returned to the editor,
  1734.      with the cursor pointing to the last executed statement.
  1735.  
  1736.  
  1737. UPGRADE HISTORY
  1738.  
  1739.      Version 4.9    November 1, 1991
  1740.  
  1741.           Added Double Height Characters.  (cmode=32)
  1742.           Added Half Height Characters.  (cmode=64)
  1743.           Added Half Width Characters.  (cmode=128)
  1744.           Added OR bit for Characters.  (cmode=256)
  1745.           Added XOR bit for Characters.  (cmode=512)
  1746.           Modified PRINT EOL to match character size.
  1747.           Fixed LOCATE for Graphics Screen.
  1748.           Reset GLOCATE postion with SCREEN command.
  1749.           Fixed Two Dimensional Array Problem.
  1750.           Added array Accessing for MENU function.
  1751.           Added SHIFT (statement) to set SHIFT state.
  1752.  
  1753.  
  1754.      Version 4.8    October 5, 1991
  1755.  
  1756.           TAB and (,) should now be more accurate.
  1757.           LINE( now has a default color of 1.
  1758.           PRINT will now work on a graphics screen.
  1759.           Fixed SSIZE effect on CHR$, LPCHR$, STRING$.
  1760.           Speeded up CLS statement.
  1761.           Fixed INPUT$( function.
  1762.           Reset screen mode, if necessary, on exit.
  1763.           Added -P switch, to allow users to swap memory cards.
  1764.           New Functions: CHARPTR, CWD$, EXISTS, FILESIZE,
  1765.                FINDFILE$, FINDNEXT$
  1766.           New Statements: GLOCATE, GPRINT, CMODE
  1767.  
  1768.  
  1769.      Version 4.71   August 21, 1991  (Beta Testers Only)
  1770.  
  1771.           Fixed PRINT's " ..; ELSE " problem.
  1772.           Fixed MSD() offset by 1 error.
  1773.           Changes PGSHOW/PGLOAD/PGSAVE to Portfolio Only
  1774.  
  1775.  
  1776.      Version 4.7    August 14, 1991
  1777.  
  1778.           Fixed DMS and REG() functions.
  1779.           Improved TEST.BAS program.
  1780.           COMIN and COMOUT routines were modified to work on the
  1781.                classic "three-wire" connection.
  1782.           Replaced PBCODE.EXE with PBCOMP.EXE.
  1783.           Fixed WKSREAD$/WKSREAD switch.
  1784.           Fixed "Undefined Array" error detection.
  1785.           Modified parameters for MENU( to allow for more
  1786.                flexibility.
  1787.           Fixed Print error: day "/" month.
  1788.           Fixed clear screen on error.
  1789.           Maximum size of string is now 350 characters.  This
  1790.                changes the way SCRLOAD and SCRSAVE can operate.
  1791.           Fixed graphics LINE statement.
  1792.           Added optional length to MID$ function.
  1793.           Fixed MID$ function to return null string instead of
  1794.                error if starting position is past end of string.
  1795.           Fixed STR$ to return Microsoft format if NUMFMT="% g ".
  1796.           Fixed ELSE problem: if a then if b then x else y
  1797.                y would be executed if a was false.
  1798.           Added PBCOMP to allow for .BAS source code compression. 
  1799.                Autodetection and decompression on load.  Reduces
  1800.                source code by 60%
  1801.           Cleaned up the code for PRINT.
  1802.           Disabled -T parameter for compressed/encode programs.
  1803.           Added Multi-lined IF/THEN/ELSE/ENDIF.
  1804.           New Statements: EXITCMD, EXITCODE
  1805.           New Functions: INSTAT, ISALTR, ISRUN
  1806.  
  1807.           Disk Size      - 41342 bytes
  1808.           SPEED.BAS      - 21.9 seconds
  1809.           SIEVE.BAS      - 52.0 seconds
  1810.           TEST47.BAS     - 17.9 seconds
  1811.           TEST45.BAS     - 16.5 seconds
  1812.           
  1813.  
  1814.      Version 4.6    July 19, 1991
  1815.  
  1816.           Speeded up PGLOAD/PGSHOW routines.
  1817.           RESTORE now accepts variables.
  1818.           New Function: PROGLOC
  1819.  
  1820.           Disk Size      - 40855 bytes
  1821.           SPEED.BAS      - 21.9 seconds
  1822.           SIEVE.BAS      - 52.0 seconds
  1823.           TEST45.BAS     - 16.5 seconds
  1824.  
  1825.  
  1826.      Version 4.54   July 12, 1991 (Beta Testers Only)
  1827.  
  1828.           Added -E switch.  Allows for Portfolio emulation on a
  1829.                PC, requires I60 and I61 be loaded.
  1830.           Improved Memory Management for the RUN statement.
  1831.           Auto-detection of Serial or Parallel port for printing.
  1832.           New Statements: SSIZE
  1833.           New Portfolio Only: EDIT$
  1834.  
  1835.  
  1836.      Version 4.53   July 7, 1991 (Beta Testers Only)
  1837.      
  1838.           Fixed MID$ offset-by-one problem.
  1839.           Added optional length to MID$ statement.
  1840.           Fixed communication routines.
  1841.           New Statements: LINE (graphics)
  1842.           New Functions: ARG$, ARGC, CEIL, DOSVER, ERADR, ERMSG$,
  1843.                FREEFILE, PASSWORD$, REVERSE$, SCREEN, SHIFT
  1844.           New Portfolio Only: INVERT
  1845.  
  1846.  
  1847.      Version 4.52   June 23, 1991 (Beta Testers Only)
  1848.  
  1849.           Applied Patched to TC 2.0 to fix "%.0f" problem.
  1850.           Changed PORTFOLIO Recognition routine.  Is now
  1851.                compatible with HP95LX computer.
  1852.  
  1853.  
  1854.      Version 4.51   June 14, 1991 (Beta Testers Only)
  1855.  
  1856.           Modified INKEY$ to handle Function Keys.
  1857.           Added MID$ as a statement for string replacement.
  1858.           Modified tokenizer to allow Q and Q( to be separate
  1859.                variables.
  1860.  
  1861.  
  1862.      Version 4.5    May 17, 1991
  1863.  
  1864.           Added program encoding for security.  Use PBCODE to
  1865.                encode.  PBASIC will decode and execute.
  1866.           Much faster .PGC graphics support, thanks to Don
  1867.                Messerli.  Graphic screens can now be displayed at
  1868.                about 4 frames per second.
  1869.           Added Functions.
  1870.           Added COM port support.
  1871.           Line numbers must be between 1 and 65535.
  1872.           GOTO and GOSUB now support variables: GOTO X.
  1873.           Function PORT has been modified to return a -1 instead
  1874.                of 1.  This change allows the use of IF NOT PORT
  1875.                THEN...
  1876.           New Statements: COMOUT, COMSET
  1877.           New Functions: COMIN, COMSTAT
  1878.  
  1879.           Disk Size      - 38914 bytes
  1880.           SPEED.BAS      - 21.9 seconds
  1881.           SIEVE.BAS      - 52.4 seconds
  1882.           TEST45.BAS     - 16.4 seconds
  1883.  
  1884.  
  1885.      Version 4.12   April 19, 1991 (School Only)
  1886.  
  1887.           Fixed two dimensional array addressing.
  1888.           Fixed ON...GOSUB error.
  1889.           Fixed -0 error on multiplication.
  1890.           Fixed (') Remark problem.
  1891.           Fixed MID$ for values greater than length of string.
  1892.           Fixed RAND(x) for x <= 0.
  1893.  
  1894.  
  1895.      Version 4.11   March 3, 1991 (Atari Only)
  1896.  
  1897.           Added LPCHR$(x) to print unfiltered characters.
  1898.           Modified INPUT# to accept EOF as end of string/number.
  1899.           Fixed LPRINT newline.
  1900.  
  1901.  
  1902.      Version 4.1    February 13, 1991
  1903.  
  1904.           Now using PKLITE for compressions, saves about 1k.
  1905.           Added parameter to LOCATE statement to turn off cursor.
  1906.           Increased range of HEX$/OCT$/BIN$.
  1907.           Fixed ASC for characters greater than 127.
  1908.           Fixed FOR loop parameters: K=5:FOR K=1 to K+5 is now 1
  1909.                to 10 instead of 1 to 6.
  1910.           Fixed DMS and MSD for negative numbers.
  1911.           Fixed Error messages in EVAL function.
  1912.           Fixed DIM out of memory for strings.
  1913.  
  1914.  
  1915.      Version 4.01   February 7, 1991 (School Only)
  1916.  
  1917.           Added @location, to PRINT statements for Model 100
  1918.                compatibility.
  1919.           Reorganized command table to save about 1k.
  1920.           Fixed negative numbers in DATA statements problem.
  1921.           Modified the NEXT statement:  If no variable, top of
  1922.                stack is used.  If variable is given, stack is
  1923.                searched for match.  Allows for aborting FOR loops
  1924.                early.
  1925.           Fixed relational operators.  Return -1 instead of 1.
  1926.           Fixed symbol table overflow.  Fixed documentation - 130
  1927.                variables.
  1928.           Add additional error checking on file handling.
  1929.           Add range checking to the string operations.
  1930.           Fixed INPUT: long numbers entered as strings caused
  1931.                overflow errors.
  1932.           Fixed String Initialization problem.
  1933.  
  1934.  
  1935.      Version 4.0    February 1, 1991
  1936.  
  1937.           New Statements: USING, CLOSE, EOF, INPUT$, NUMFMT,
  1938.                OPEN, PRINT#, REPEAT, UNTIL,  WEND, WHILE, WRITE#
  1939.           New Functions: ACOS, AND, ASIN, COSH, DEG, DMS, EOF,
  1940.                EQV, IMP, LTRIM$, MSD, OR, RAD, RTRIM$, SINH, SPC,
  1941.                TAB, TANH, WKSREAD, WKSREAD$, WKSTYPE, XOR
  1942.           New Portfolio Only: MENU, SCRLOAD, SCRSAVE
  1943.           Sequential Files.
  1944.           Menus.
  1945.           Worksheet Importing Functions.
  1946.           Reorganized GetToken to increase speed.
  1947.           Reserved word lookup is now indexed binary search.
  1948.           Code was tighten and refined.
  1949.           Arrays can be used with FOR statements.
  1950.           Fixed error in .PGC compression routines.  To convert
  1951.                any old .PGC files to the correct format, use the
  1952.                following program:
  1953.  
  1954.                     10 INPUT "Filename? ";f$:IF f$ = "" THEN END
  1955.                     SCREEN 6:PGLOAD f$:PGSAVE f$:SCREEN 7:GOTO 10
  1956.  
  1957.           Changed PC error messages to interface with PBE.
  1958.           IF statements modified to allow for single expression
  1959.                evaluation.  Allows for IF EOF(1) THEN etc...  If
  1960.                the result is 0, it is false, anything else is
  1961.                true.
  1962.           Modified the FOR statement to work more like GWBASIC. 
  1963.                If the starting value to beyond the ending value,
  1964.                the loop is not executed.  This includes nested
  1965.                loops.
  1966.           The Atari key ( /|\ ) will now act as a break key.
  1967.           Reorganized the IF statement to handle strings better.
  1968.           Installed option to output numbers in GWBASIC style: 
  1969.                leading space or -, followed by space.  Can be set
  1970.                by NUMFMT="% g " at the beginning of the program.
  1971.           Eliminated recursive ON ERROR trapping.
  1972.           Fixed DIM problem with multiple/mixed arrays.
  1973.           Fixed TAN error.
  1974.           Added looping - WHILE/WEND, REPEAT/UNTIL.
  1975.           Added LEN to the documentation.
  1976.           Fixed CHAIN variable loss.
  1977.           Added additional math error traps.
  1978.           Fixed -0 problem.
  1979.           Fixed negative numbers in print statements.
  1980.  
  1981.           Disk Size      - 38539 bytes
  1982.           SPEED.BAS      - 19.4 seconds
  1983.           SIEVE.BAS      - 51.4 seconds
  1984.           TEST40.BAS     - 17.0 seconds
  1985.           TEST31.BAS     - 16.5 seconds
  1986.           TEST30.BAS     - 15.9 seconds
  1987.           TEST21.BAS     - 10.0 seconds
  1988.  
  1989.  
  1990.      Version 3.1a   January 12, 1991
  1991.  
  1992.           Minor bug : A$ = A$ + ...  A$ is lost.  Fixed.
  1993.  
  1994.  
  1995.      Version 3.1    January 5, 1991
  1996.  
  1997.           New Statements: BLOAD, BSAVE, CALL, CALL INTERRUPT,
  1998.                CHAIN, CHDIR, DECR, ERROR, EVAL, INCR, KILL,
  1999.                MKDIR, ON ERROR GOTO, PGLOAD, PGSAVE, PGSHOW,
  2000.                RESUME, RMDIR, RUN
  2001.           New Functions: BIN$, COMMAND$, ERL, ERR, FALSE, LCASE$,
  2002.                PI, TRUE, UPCASE$, VARSEG, VARPTR
  2003.           Corrected the spelling of Walter Daniel's name. :-}
  2004.           Added support for .PGC files.
  2005.           Fixed DATA wrap around problem.
  2006.           Fixed DIAL problem.
  2007.           Error message for Portfolio Only Statements on PC.
  2008.  
  2009.           Disk Size      - 35186 bytes
  2010.           SPEED.BAS      - 25.9 seconds
  2011.           SIEVE.BAS      - 79.5 seconds
  2012.           TEST31.BAS     - 21.0 seconds
  2013.           TEST30.BAS     - 20.5 seconds
  2014.           TEST21.BAS     - 13.0 seconds
  2015.  
  2016.  
  2017.      Version 3.0    November 25, 1990.
  2018.  
  2019.           Added sample programs.
  2020.           Complied with Turbo C, version 2.0.
  2021.           Added Help file for Portfolio Address Function.
  2022.           Two Dimensional Arrays.
  2023.           Expanded TEST.BAS to TEST30.BAS with strings.
  2024.           Disk Size      - 33123 bytes
  2025.           SPEED.BAS      - 27.4 seconds
  2026.           TEST30.BAS     - 21.5 seconds (corrected)
  2027.           TEST21.BAS     - 13.0 seconds (corrected)
  2028.           New Functions: PBVER
  2029.  
  2030.      Version 2.9    Beta Release - September 30, 1990.
  2031.  
  2032.           Added Strings.
  2033.           Modified READ, SWAP and DIAL to handle strings.
  2034.           Added STRING arrays.
  2035.           Modified IF and PRINT to work with string expressions.
  2036.           Fixed PRINT" problem. 
  2037.           Allow line numbers directly after THEN or ELSE.
  2038.           Now allows two dimensional arrays of any type.
  2039.           Converted to Turbo C++, Version 1.0.
  2040.           New Functions : ASC, DATE$, INSTR, INKEY$, VAL, LEFT$,
  2041.                MID$, RIGHT$, CHR$, HEX$, OCT$, SPACE$, STR$,
  2042.                STRING$, TIME$
  2043.  
  2044.  
  2045.      Version 2.2    Not Released.
  2046.  
  2047.           Added hashing feature to symbol table to speed up
  2048.                variable table access.  10% increase in TEST.
  2049.           Added automatic default extension of ".BAS"
  2050.  
  2051.  
  2052.      Version 2.1    August 4, 1990
  2053.  
  2054.           New Statements: DATA, READ, RESTORE
  2055.           New Functions : LOG
  2056.           TRON invoked from command line switch -T
  2057.           Adjusted the screen coordinates from 0,0 to 1,1 to
  2058.                match GWBASIC.  While this will cause some
  2059.                incompatibilities with previous versions of
  2060.                PBASIC, it will make it more compatible with
  2061.                GWBASIC.
  2062.           Added INP to the documentation.
  2063.           Added FRE to the documentation.
  2064.           Installed Binary search for command checking.  Speed
  2065.                increase about 40%.
  2066.           One letter variable names are not checked in command
  2067.                table.
  2068.           Fixed the load routine to allow for no CR/LF at the end
  2069.                of the file.
  2070.           Fixed FIX function.
  2071.           Fixed scientific constants.
  2072.           Fixed power (^) function.
  2073.  
  2074.           Disk Size      - 29649 bytes
  2075.           SPEED.BAS      - 30.9 seconds
  2076.           TEST21.BAS     - 12.9 seconds
  2077.  
  2078.  
  2079.      Version 2.0    July 27, 1990
  2080.  
  2081.           New Statements: LPRINT, PRINTER, FORMFEED, PRTSC, WAIT,
  2082.                OUT, DIM
  2083.           New Functions : LPOS, ATN, EXP, FIX, INT, COS, SIN,
  2084.                SQR, TAN, TIMER, \, INP, FRE
  2085.           New Portfolio Only : GETDISPLAY, DISPLAY, VLOCATE,
  2086.                VMOVE, VPOS, VCSRLIN, ROMVER, PORT
  2087.           200 variables, 8 significant characters.
  2088.           <ALT-R> TSR to invoke BASIC from inside editor.
  2089.           Program size limited to available memory.
  2090.           All variables are now SINGLE PRECISION FLOATING POINT.
  2091.           One Dimensional Floating Point Arrays.
  2092.           Fixed FOR/NEXT looping with a negative step.
  2093.           Fixed the use of FUNCTIONS in PRINT statements.
  2094.           Fixed EOF error on Portfolio: Lockup if no END
  2095.                statement.
  2096.           Added extensive printer support.
  2097.           DEFINT will now cause a syntax error.
  2098.           RND was changed to make it MS compatible.
  2099.           SWAP was make array compatible.
  2100.           Fixed ... else "string" problem.
  2101.           Added NEXT to the documentation.
  2102.  
  2103.  
  2104.      Version 1.1    July 21, 1990
  2105.  
  2106.           New Statements: DEF SEG, POKE
  2107.           New Functions : PEEK
  2108.           New Portfolio Only : REFRESH, TICK, CLICK, STATUS
  2109.           Automatically invoke Editor on Error.
  2110.           Fixed ALARM problem: keystroke was going into buffer.
  2111.           Fixed ON x GOTO/GOSUB problem: Offset line count by 1.
  2112.           Improved Error Detection.
  2113.           Allow REM in PRINT with preceding colon (:).
  2114.           Implement the quote (') as a substitute for REM.
  2115.           Fix PSET documentation to indicate ()'s.
  2116.           Screen mode changes, return to original on error.
  2117.           Allow for spaces as separator in PRINT.
  2118.  
  2119.  
  2120.      Version 1.0    July 14, 1990
  2121.  
  2122.           Initial release.
  2123.  
  2124.  
  2125. TECHNICAL NOTES
  2126.  
  2127.      PBASIC is about 4000 lines of code was written in Turbo C,
  2128.      version 2.0, compiled to an executable file just under 66k
  2129.      in size.  PBASIC was then compressed with PKLITE, version
  2130.      1.01, to further reduce the size to about 43k.
  2131.  
  2132.      PBASIC will run on a regular PC, providing you do not use
  2133.      any Portfolio specific statements.  If you have the
  2134.      Portfolio Emulation software (I60, I61), you can use all the
  2135.      features if you use the -E switch.  PBASIC will generate an
  2136.      error if you try to use a Portfolio only instruction on a
  2137.      PC.
  2138.  
  2139.      PBASIC was developed on a Gateway 2000, 33Mhz 386 PC with 4
  2140.      megabytes of memory.  It was tested on the Atari Portfolio,
  2141.      ROM version 1.052.
  2142.  
  2143.  
  2144. BATCH CONSIDERATIONS
  2145.  
  2146.      If you are running PBASIC as a batch file, you can access
  2147.      the ERRORLEVEL code generated upon exit.
  2148.  
  2149.                0 - Successful exit
  2150.                1 - Program aborted
  2151.                2 - STOP encountered
  2152.  
  2153.      This ERRORLEVEL value can be modified by using EXITCODE.
  2154.  
  2155.  
  2156. ERROR NUMBER AND MESSAGES
  2157.  
  2158.       1   NEXT without FOR
  2159.       2   Syntax Error
  2160.       3   RETURN without GOSUB
  2161.       4   Out of DATA
  2162.       5   Illegal Function Call
  2163.       6   Overflow
  2164.       7   Out of Memory
  2165.       8   Undefined Line Number
  2166.       9   Subscript Out of Range
  2167.      10   Duplicate Definition
  2168.      11   Division by Zero
  2169.      13   Type Mismatch
  2170.      14   Out of String Space
  2171.      15   String Too Long
  2172.      18   Undefined User Function
  2173.      19   No RESUME
  2174.      20   RESUME without Error
  2175.      22   Missing Operand
  2176.      30   WEND without WHILE
  2177.      31   Array Undefined
  2178.      32   Not A Variable
  2179.      33   Too Many Line Numbers
  2180.      34   Duplicate Line Number
  2181.      35   Too Many Nested FORs
  2182.      36   Too Many Nested GOSUBs
  2183.      37   Name/Line Number Too Long
  2184.      38   BREAK
  2185.      39   Portfolio Only
  2186.      51   Internal Error
  2187.      52   Bad File Number
  2188.      53   File Not Found
  2189.      54   Bad File Mode
  2190.      61   Disk Full
  2191.      73   Advanced Feature
  2192.      76   Path Not Found
  2193.  
  2194.  
  2195. FUTURE ENHANCEMENTS
  2196.  
  2197.      - Increase compatibility with Microsoft BASIC
  2198.      - Faster
  2199.  
  2200.  
  2201. UTILITIES
  2202.  
  2203.      SPB
  2204.  
  2205.           SPB is a program to Squeeze PBASIC source code.  This
  2206.           program will remove and unneeded spaces, line numbers
  2207.           and REMarks from the source code.  This will reduce
  2208.           (slightly) the source code, but it will still be
  2209.           readable by the editor.  This program will also help
  2210.           convert GWBASIC programs to PBASIC.
  2211.  
  2212.  
  2213.      PBCODE
  2214.  
  2215.           PBCODE was designed to encrypt PBASIC files.  This
  2216.           program has been replaced by PBCOMP, which will encrypt
  2217.           and compress programs at the same time.
  2218.  
  2219.  
  2220.      PBCOMP
  2221.  
  2222.           PBCOMP was designed to compress PBASIC files.  The
  2223.           compress ratio varies, from 60% to 40% depending on the
  2224.           program.  Once a file in compressed, there is no way to
  2225.           decompress it.  There is no difference in running the
  2226.           file.  PBASIC will automatically detect and decompress
  2227.           an encrypted file.
  2228.  
  2229.           This program is supplied to allow developers to write
  2230.           programs in PBASIC and distribute them without
  2231.           releasing the source code to the program.  It also
  2232.           allows users to have more programs on a RAMcard.
  2233.  
  2234.  
  2235. THE FILES
  2236.  
  2237.      PBASIC.EXE     The Interpreter.
  2238.      PBASIC.TXT     This file.
  2239.      PBASIC.ADR     Help file to be loaded into the Address book
  2240.                          on the Portfolio.
  2241.      PBCOMP.EXE     Compress PBASIC files for distribution.
  2242.      SPB.EXE        Remove spaces, REMarks, and unneeded line
  2243.                          numbers.
  2244.      ALTR.COM       TSR to execute PBASIC from editor.
  2245.      TEST47.BAS     A program to exercise the interpreter. 
  2246.                          Should not generate any errors.  It will
  2247.                          run on a PC or Portfolio.  Take a look
  2248.                          at it, it demos many of the features of
  2249.                          the Portfolio Only routines.
  2250.      C.BAT          Calculate Expression from DOS.  Invokes
  2251.                          PBASIC.EXE to display answer.
  2252.                     Example: C 123*(567+9845)/18
  2253.  
  2254.  
  2255.      Sample PBASIC programs
  2256.      MENU.BAS       A program launcher for all the demo programs.
  2257.      100DAYS.BAS    Calculate 100 days after a date.
  2258.      2CURVE.BAS     Graph Plot program.  Written by Rob Kunstadt.
  2259.      ADDTIME.BAS    Program to add up time in Minutes and
  2260.                          Seconds.  Written by Louis Shapiro.
  2261.      BAR.BAS        Bar Chart program.  Written by Rob Kunstadt.
  2262.      CHART.BAS      Chart hours worked.  Written by Rob Kunstadt.
  2263.      CIRCLE.BAS     Demo of Circle Drawing Subroutine.
  2264.      DAYS.BAS       Calc the number of days between two dates.
  2265.      ETCH.BAS       Simple Drawing Program now with PGC support.
  2266.      REV.BAS        Game of Reverse.
  2267.      RUNMAN.BAS     A program to demo the new graphics functions.
  2268.      TERMINAL.BAS   Simple Terminal Program.
  2269.      VADERS.BAS     Space Invaders program from Model 100 forum.
  2270.      QCHESS.BAS     Chess Program from the Model 100 forum.
  2271.      WKSPLOT.BAS    Plot .WKS ranges as BAR or XY graphs.
  2272.      WKSPLOT.WKS    Sample .WKS file for WKSPLOT.BAS.
  2273.  
  2274.      The MUSIC Files by John Fraser
  2275.      BACH1.BAS      BACH2.BAS      BETH2.BAS
  2276.      BDAY.BAS       KRIEGER.BAS    PETER1.BAS
  2277.      MUSIC.TXT      Notes from the author.
  2278.  
  2279.      Portfolio Graphic Files (Compressed) by Don Messerli
  2280.      BOMB.PGC       FUJI.PGC       PORTF.PGC
  2281.      USA.PGC        SPRIAL.PGC     GORBY.PGC
  2282.      PGDEMO.BAS     Sample program to demo PGC files.
  2283.  
  2284.      Utilities
  2285.      FIX0D.COM           TSR fix for Portfolio graphics rom.
  2286.      FIX0D.TXT 
  2287.  
  2288.  
  2289. ALSO AVAILABLE
  2290.  
  2291.      PBE.EXE        PBASIC Editor for PC's
  2292.      PBE.DOC        Full screen editor designed for PBASIC
  2293.                     development for the Portfolio.  Invoke PBASIC
  2294.                     from inside the editor.  Access FT to
  2295.                     transmit/receive files to/from the Portfolio.
  2296.  
  2297.  
  2298. ABOUT THE AUTHOR
  2299.  
  2300.      Mr. BJ Gleason is an Instructor at The American University
  2301.      in the Computer Science and Information Systems Department. 
  2302.      He has been programming for over a decade now.
  2303.  
  2304.      He is a monthly columnist for AtariUser Magazine, and writes
  2305.      a PBASIC programming column for RE:Port.
  2306.  
  2307.  
  2308. COMMENTS, BUGS AND IDEAS
  2309.  
  2310.      What features do you really need in PBASIC to make it more
  2311.      useful on the Portfolio?  If you would like to see some new
  2312.      features, contact me and I will try to accommodate you and
  2313.      release a new version.
  2314.  
  2315.  
  2316. ACKNOWLEDGEMENTS
  2317.  
  2318.      Thanks to all those Compuserve for their bug reports,
  2319.      suggestions and words of encouragement.  Without their
  2320.      feedback, version 4.9 would have never seen the light of
  2321.      day.  Keep those cards and letters coming!
  2322.  
  2323.      The author would also like to extend his thanks to Walter
  2324.      Daniel, for helping me track down the ever-elusive bugs, and
  2325.      putting up with a flaky copy of version 2.9.  Thanks also to
  2326.      Don Messerli, for his help implementing the graphic routines
  2327.      to support the .PGC graphics standard.  Finally, many thanks
  2328.      to Ron Luks, the sysop of the APORTFOLIO conference on
  2329.      Compuserve.
  2330.  
  2331.      Thanks also to all the students (Those bug stomping fools!)
  2332.      in my Programming Languages Course, Spring 1991, at the
  2333.      American University.
  2334.  
  2335.  
  2336. ADDRESS
  2337.  
  2338.      If you have an comments, suggestions or bug reports, you can
  2339.      write to the author at:
  2340.  
  2341.           BJ Gleason
  2342.           The American University
  2343.           CSIS  (Thin Air Labs)
  2344.           4400 Massachusetts Avenue, N.W.
  2345.           Washington, DC  20016
  2346.  
  2347.           Compuserve : 75300,2517
  2348.           EMAIL : bjgleas@auvm.american.edu
  2349.  
  2350.      
  2351.      This program and documentation can be copied and distributed
  2352.      freely.  It can not be sold or used for commercial purposes
  2353.      without permission.
  2354.  
  2355.      PBASIC version 4.9, Copyright 1991 by BJ Gleason.
  2356.  
  2357.      Portfolio, Atari, Microsoft, GWBASIC are trademarks of their
  2358.      respective companies.
  2359. ə