=============================================================================

                        Bywater Software Announces
                        the First Public Release of


               Bywater BASIC Interpreter/Shell, version 1.11
               ---------------------------------------------

                    Copyright (c) 1992, Ted A. Campbell
                 for bwBASIC version 1.11, 8 November 1992



DESCRIPTION:

   The Bywater BASIC Interpreter (bwBASIC) implements a large
   superset of the ANSI Standard for Minimal BASIC (X3.60-1978)
   implemented in ANSI C, and offers a simple interactive environ-
   ment including some shell program facilities as an extension of
   BASIC. The interpreter has been compiled successfully on a range
   of ANSI C compilers on varying platforms with no alterations
   to source code necessary. 


OBTAINING THE SOURCE CODE:

   The source code for bwBASIC 1.10 will be posted to network news
   groups and is available immediately by anonymous ftp. To obtain
   the source code, ftp to site duke.cs.duke.edu, cd to /pub/bywater
   and get the appropriate files.  These are as follows:

   bwb110.zip  Source code in ZIP compressed format, with text lines
         concluded with CR-LF. This is the appropriate version
         for DOS-based computers.

   bwb110.tar.Z   Tar'd and compressed source code with text lines con-
         cluded with LF only.  This is the appropriate version
         for Unix-based computers.


COMMUNICATIONS:

   Ted A. Campbell
   Bywater Software
   P.O. Box 4023
   Duke Station
   Durham, NC  27706
   USA

   email:  tcamp@acpub.duke.edu

-----------------------------------------------------------------------------

               Bywater BASIC Interpreter/Shell, version 1.10
               ---------------------------------------------

                    Copyright (c) 1992, Ted A. Campbell
                 for bwBASIC version 1.10, 1 November 1992


CONTENTS:

   1. DESCRIPTION
   2. TERMS OF USE
   3. COMMANDS AND FUNCTIONS IMPLEMENTED
   4. SOME NOTES ON USAGE
   5. UNIMPLEMENTED COMMANDS AND FUNCTIONS
   6. SOME NOTES ON COMPILATION
   7. THE STORY OF BYWATER BASIC
   8. COMMUNICATIONS


1. DESCRIPTION

   The Bywater BASIC Interpreter (bwBASIC) implements a large
   superset of the ANSI Standard for Minimal BASIC (X3.60-1978)
   in ANSI C and offers shell program facilities as an extension
   of BASIC.

   The set of BASIC commands and functions implemented is fairly
   limited (see section three below), although more commands and
   functions are implemented than appear in the specification
   for Minimal BASIC. There are no commands that are terminal- or
   hardware specific. (Seriously -- CLS may work under bwBASIC
   on your DOS-based pc, but that is because bwBASIC shells
   out to DOS when it does not recognize CLS and executes CLS there.)

   The interpreter is slow.  Whenever faced with a choice between 
   conceptual clarity and speed, I have consistently chosen
   the former.  The interpreter is the simplest design available,
   and utilizes no system of intermediate code, which would speed
   up considerably its operation.  As it is, each line is interpreted
   afresh as the interpreter comes to it. 

   bwBASIC implements one feature not available in previous BASIC
   interpreters: a shell command can be entered interactively at the
   bwBASIC prompt, and the interpreter will execute it under a
   command shell.  For instance, the command "dir *.bas" can be
   entered in bwBASIC (under DOS, or "ls -l *.bas" under UNIX) and
   it will be executed as from the operating system command line.
   Shell commands can also be given on numbered lines in a bwBASIC
   program, so that bwBASIC can be used as a shell programming
   language. bwBASIC's implementation of the RMDIR, CHDIR, MKDIR,
   NAME, KILL, ENVIRON, and ENVIRON$() commands and functions
   offer further shell-processing capabilities.


2. TERMS OF USE:

   The bwBASIC source code and executables produced from it can be
   used subject to the following statement which is included in
   the header to all the source code files:

        All U.S. and international copyrights are claimed by the
        author. The author grants permission to use this code
        and software based on it under the following conditions:
        (a) in general, the code and software based upon it may be
        used by individuals and by non-profit organizations; (b) it
        may also be utilized by governmental agencies in any country,
        with the exception of military agencies; (c) the code and/or
        software based upon it may not be sold for a profit without
        an explicit and specific permission from the author, except
        that a minimal fee may be charged for media on which it is
        copied, and for copying and handling; (d) the code must be
        distributed in the form in which it has been released by the
        author; and (e) the code and software based upon it may not
        be used for illegal activities.


3. BASIC COMMANDS AND FUNCTIONS IMPLEMENTED:

   See further down inside this Manual for the details.


4. SOME NOTES ON USAGE:

   An interactive environment is provided, so that a line with a
   line number can be entered at the bwBASIC prompt and it will be
   added to the program in memory.

   Line numbers are not strictly required, but are useful if the
   interactive enviroment is used for programming.  For longer
   program entry one might prefer to use an ASCII text editor, and
   in this case lines can be entered without numbers. In this case,
   however, one will not be able to alter the numberless lines
   within the interactive environment.

   Command names and function names are not case sensitive,
   so that "Run" and "RUN" and "run" are equivalent and "abs()"
   and "ABS()" and "Abs()" are equivalent. HOWEVER: variable
   names ARE case sensitive in bwbASIC, so that "d$" and "D$"
   are different variables.  This differs from some BASIC
   implementations where variable names are not case sensitive.

   A filename can be specified on the command line and will be
   LOADed and RUN immediately, so that the command line

      bwbasic prog.bas

   will load and execute "prog.bas".

   All programs are stored as ASCII text files.

   TRUE is defined as -1 and FALSE is defined as 0 in the default
   distribution of bwBASIC. These definitions can be changed by
   those compiling bwBASIC (see file BWBASIC.H).

   Assignment must be made to variables.  This differs from some
   implementations of BASIC where assignment can be made to a
   function.  Implication: "INSTR( 3, x$, y$ ) = z$" will not
   work under bwBASIC.

   Notes on the implementation of specific commands:

   CVI(), CVD(), CVS(), MKI$(), MKD$(), MKS$(): These functions
   are implemented, but are dependent on a) the sizes for integer,
   float, and double values on particular systems, and b) how
   particular versions of C store these numerical values. The
   implication is that data files created using these functions
   on a DOS-based microcomputer may not be translated correctly
   by bwBASIC running on a Unix-based computer.  Similarly, data
   files created by bwBASIC compiled by one version of C may not be
   readable by bwBASIC compiled by another version of C (even under
   the same operating system). So be careful with these.

   ENVIRON:  The ENVIRON command requires BASIC strings on either
   side of the equals sign.  Thus: 

      environ "PATH" = "/usr/bin"

   It might be noted that this differs from the implementation
   of ENVIRON in some versions of BASIC, but bwBASIC's ENVIRON
   allows BASIC variables to be used on either side of the equals
   sign.  Note that the function ENVIRON$() is different from the
   command, and be aware of the fact that in some operating systems
   an environment variable set within a program will not be passed
   to its parent shell.

   ERR: Note that if PROG_ERRORS has been defined when bwBASIC is
   compiled, the ERR variable will not be set correctly upon
   errors.  It only works when standard error messages are used.

   FOR and NEXT:  In this implementation of bwBASIC, a NEXT
   statement must appear in the first position in a program
   line; it cannot appear in a line segment beyond a colon.

   INPUT: bwBASIC cannot support the optional feature of INPUT
   that suppresses the carriage-return and line-feed at the end
   of the input.  This is because ANSI C does not provide for any
   means of input other than CR-LF-terminated strings.


5. UNIMPLEMENTED COMMANDS AND FUNCTIONS

   There are a few items not implemented that have been so long
   a part of standard BASICs that their absence will seem surprising.
   In each case, though, their implementation would require opera-
   ting-system-specific functions or terminal-specific functions
   that ANSI C cannot provide. Some specific examples:

   CALL         In some versions of BASIC, CALL is used to call a
                machine language subroutine, but machine language
                routines are highly system-specific.  In other
                BASICs (conforming to the more complete ANSI
                definition of BASIC), CALL is used to call a
                named subroutine.  Although it's possible that
                bwBASIC could develop as a numberless BASIC
                with named subroutine calls, these features
                are not implemented in this earliest released
                version.

   CLOAD        See CALL above (machine language subroutines).

   CONT         See RESUME below (programmer ignorance?).

   DEF USR      See CALL above (machine language subroutines).

   EDIT         EDIT would be especially nice, but requires some
                specific knowledge of how particular computers
                handle interaction between the screen and the
                keyboard.  This knowledge isn't available within
                the bounds of ANSI C alone ("innerhalb die Grenzen
                der reinen Vernunft," with apologies to Immanuel
                Kant).

   FRE()        The ability to report the amount of free memory
                remaining is system-specific due to varying patterns
                of memory allocation and access; consequently this
                ability is not present in ANSI C and this function
                is not available in bwBASIC.

   FILES        The FILES command requires a list of files conforming
                to a specifier; ANSI C does not provide this. When
                COMMAND_SHELL is defined as TRUE, users might want
                to issue operating-system commands such as "DIR"
                (DOS) or "ls -l" (Unix) to get a list of files.

   INKEY$       This function requires a keyboard scan to indicate
                whether a key is pending. Although this facility
                is easily available on microcomputers (it is part
                of the minimal CP/M Operating System), it is not
                easily available on some more complex systems. 
                Consequently, it's not part of the C standard and
                bwBASIC has not implemented INKEY$.

   INPUT$()     Similar to INKEY$ above, ANSI C by itself is not
                able to read unechoed keyboard input, and can read
                keyboard input only after a Carriage-Return has
                been entered. 

   INP          Calls to hardware ports, like machine-language
                routines, are highly system-specific and cannot
                be implemented in ANSI C alone.

   LLIST        See LPRINT below.

   LPOS         See LPRINT below.

   LPRINT       and LLIST, etc., require access to a printer device,
                and this varies from one system to another. Users
                might try OPENing the printer device on their own
                operating system (e.g., "/dev/lp" on Unix systems,
                or "PRN" under DOS) and see if printing can be done
                from bwBASIC in this way.

   NULL         In this case, I am convinced that NULL is no longer
                necessary, since very few printers now require NULLs
                at the end of lines.

   OUT          See INP above (calls to hardware ports).

   PEEK()       PEEK and POKE enabled earlier BASICs to address
                particular memory locations. Although bwBASIC
                could possibly implement this command (POKE) and
                this function (PEEK()), the limitation would be
                highly limited by the different systems for
                memory access in different systems.

   POKE         see PEEK() above.

   RENUM        Since unnumbered lines can be entered and
                executed under bwBASIC, it would not be
                possible to implement a RENUM routine.

   RESUME       Is this possible under ANSI C? If so, I
                simply have failed to figure it out yet.
                Mea culpa (but not maxima).

   USR          See CALL and DEF USR above (machine language
                subroutines).

   VARPTR       See PEEK and POKE above.

   WAIT         See INP and OUT above.

                
6. SOME NOTES ON COMPILATION

   bwBASIC is written in ANSI C and takes advantage of some of the
   enhancements of ANSI C over the older K&R standard.  The program
   expects to find standard ANSI C include files (such as ).
   Because there is nothing terminal- or hardware-specific about it,
   I should hope that it would compile correctly under any ANSI C
   compiler, but you may have to construct your own makefile.

   Two makefiles are currently provided: "makefile.qcl" will compile
   the program utilizing the Microsoft QuickC (tm) line-oriented 
   compiler on DOS-based p.c.'s, and "makefile.gcc" will compile 
   the program utilizing the ANSI option of Gnu C++. I have also 
   compiled the program utilizing Borland's Turbo C++ (tm) on DOS-
   based machines.

   No alterations to flags are necessary for varied environments,
   but the beginning of file  allows the user to set
   some debugging flags and to control some program defaults.
   The file  has a number of language-specific message
   sets that can be controlled by setting the appropriate language
   flag.


7. THE STORY OF BYWATER BASIC

   This program was originally begun in 1982 by my grandmother, Mrs.
   Verda Spell of Beaumont, TX.  She was writing the program using
   an ANSI C compiler on an Osborne I CP/M computer and although my
   grandfather (Lockwood Spell) had bought an IBM PC with 256k of
   RAM my grandmother would not use it, paraphrasing George Herbert
   to the effect that "He who cannot in 64k program, cannot in 512k."
   She had used Microsoft BASIC and although she had nothing against
   it she said repeatedly that she didn't understand why Digital
   Research didn't "sue the socks off of Microsoft" for version 1.0
   of MSDOS and so I reckon that she hoped to undercut Microsoft's
   entire market and eventually build a new software empire on
   the North End of Beaumont. Her programming efforts were cut
   tragically short when she was thrown from a Beaumont to Port
   Arthur commuter train in the summer of 1986. I found the source
   code to bwBASIC on a single-density Osborne diskette in her knitting
   bag and eventually managed to have it all copied over to a PC
   diskette. I have revised it slightly prior to this release. You
   should know, though, that I myself am an historian, not a programmer.

   
8. COMMUNICATIONS:

   Ted A. Campbell
   Bywater Software
   P.O. Box 4023
   Duke Station
   Durham, NC  27706
   USA

   email:  tcamp@acpub.duke.edu

=============================================================================

                         Addendum, B.Walker, G0LCU.
                         --------------------------

A LIST OF BASIC COMMANDS AND FUNCTIONS IMPLEMENTED in bwBASIC:-
---------------------------------------------------------------

   ABS( number )
   ASC( string$ )
   ATN( number )
   ( *** BEEP == PRINT CHR$(7); REM ONLY IN CLASSIC AMIGA MODE! *** )
   CHAIN [MERGE] file-name [, line-number] [, ALL]
   CHR$( number )
   CINT( number )
   CLEAR
   CLOSE [[#]file-number]...
   ( *** CLS == PRINT CHR$(12); REM ONLY IN CLASSIC AMIGA MODE! *** )
   COMMON variable [, variable...]
   COS( number )
   CSNG( number )
   CVD( string$ )
   CVI( string$ )
   CVS( string$ )
   DATA constant[,constant]...
   DATE$
   DEF FNname(arg...)] = expression
   DEFDBL letter[-letter](, letter[-letter])...
   DEFINT letter[-letter](, letter[-letter])...
   DEFSNG letter[-letter](, letter[-letter])...
   DEFSTR letter[-letter](, letter[-letter])...
   DELETE line[-line]
   DIM variable(elements...)[variable(elements...)]...
   END
   ENVIRON$( variable-string )
   EOF( device-number )
   ERASE variable[, variable]...
   ERL
   ERR
   ERROR number
   EXP( number )
   FIELD [#] device-number, number AS string-variable
         [, number AS string-variable...]
   FOR counter = start TO finish [STEP increment]
   GET [#] device-number [, record-number]
   GOSUB line
   GOTO line
   HEX$( number )
   IF expression THEN statement [ELSE statement]
   INPUT [# device-number]|[;]["prompt string";]list of variables
   INSTR( [start-position,] string-searched$, string-pattern$ )
   INT( number )
   LEFT$( string$, number-of-spaces )
   LEN( string$ )
   LET variable = expression
   LINE INPUT [[#] device-number,]["prompt string";] string-variable$
   LIST line[-line]
   LOAD file-name
   LOC( device-number )
   LOG( number )
   LSET string-variable$ = expression
   MERGE file-name
   MID$( string$, start-position-in-string[, number-of-spaces ] )
   MKD$( double-value# )
   MKI$( integer-value% )
   MKS$( single-value! )
   NAME old-file-name AS new-file-name
   NEW
   NEXT counter
   OCT$( number )
   ON variable GOTO|GOSUB line[,line,line,...]
   ON ERROR GOSUB line
   OPEN O|I|R, [#]device-number, file-name [,record length]
        file-name FOR INPUT|OUTPUT|APPEND AS [#]device-number
        [LEN = record-length]
   OPTION BASE number
   POS
   PRINT [# device-number,][USING format-string$;] expressions...
   PUT [#] device-number [, record-number]
   RANDOMIZE number
   READ variable[, variable]...
   REM string
   RESTORE line
   RETURN
   RIGHT$( string$, number-of-spaces )
   RND( number )
   RSET string-variable$ = expression
   RUN [line][file-name]
   SAVE file-name
   SGN( number )
   SIN( number )
   SPACE$( number )
   SPC( number )
   SQR( number )
   STOP
   STR$( number )
   STRING$( number, ascii-value|string$ )
   SWAP variable, variable
   SYSTEM
   TAB( number )
   TAN( number )
   TIME$
   TIMER
   TROFF
   TRON
   VAL( string$ )
   WEND
   WHILE expression
   WIDTH [# device-number,] number
   WRITE [# device-number,] element [, element ].... 

   If UNIX_CMDS is set to TRUE when the program is compiled,
   then the following commands and function will be available:

   CHDIR pathname
   ENVIRON variable-string = string
   KILL file-name
   LOF( device-number )
   MKDIR pathname
   RMDIR pathname

-----------------------------------------------------------------------------

General Information:-
---------------------

Ted A. Campbell's 'bwBASIC111' for the AMIGA family can be found here:-

  http://aminet.net/package/docs/help/BWBasic111_Manual  ; A500+ and above.

  http://aminet.net/package/dev/lang/bwb111              ; i386-AROS.

  http://aminet.net/package/dev/lang/PPCbwb111           ; PPC-POWERUP.

This needs ~ixemul.library~ available from AMINET here:-

  http://aminet.net/package/util/libs/ixemul-48.0

If you start the interpreter, you can pass a name of a sourcefile on the
command-line which it will immediately run. On the command line one can
enter BASIC-expressions directly, or precede them with line-numbers to form
a program.

IF, you are lucky then you are able to run any program from the command
prompt, so long as you point to it; this is a listing of the default SYS:C
drawer or C: Volume!
To do so you WILL need to install the *NIX ADE package from AMINET for it to
work however:

 http://aminet.net/package/dev/gcc/ADE

Once ADE is installed, running and set up, an example of calling 'Type' from
the SYS:C drawer and an ADE binary file inside the ByWater BASIC 1.11 prompt
through the two '*.jpg' images.
They show how to use run the Type command from the SYS:C drawer inside
bwBASIC 1.11 executed from the ADE *NIX emulator...

 This is the listing of the AMIGAOS 1.3x C: Volume:
 --------------------------------------------------

 AddBuffers     Delete      EndSkip   Info     NewShell  Search    Version
 Ask            Dir         Eval      Install  Path      SetClock  Wait
 Assign         DiskChange  Execute   Join     Prompt    SetDate   Which
 Avail          DiskDoctor  Failat    Lab      Protect   SetEnv    Why
 Binddrivers    Echo        Fault     List     Quit      SetPatch
 Break          Ed          FF        LoadWB   Relabel   Skip
 CD             Edit        FileNote  Lock     RemRAD    Sort
 ChangeTaskPri  Else        GetEnv    Makedir  Rename    Stack
 Copy           EndCLI      IconX     Mount    Resident  Status
 Date           EndIf       If        NewCLI   Run       Type

 This is the listing of the AMIGAOS 3.0x C: Volume:
 --------------------------------------------------

 AddBuffers    ConClip    Ed       Install MakeDir  RequestChoice SetPatch
 AddDataTypes  Copy       Edit     IPrefs  MakeLink RequestFile   Sort
 Assign        CPU        Eval     Join    Mount    Search        Status
 Avail         Date       Execute  List    Protect  SetClock      Type
 BindDrivers   Delete     Filenote LoadWB  Relabel  SetDate       Version
 Break         Dir        IconX    Lock    RemRAD   SetFont       Wait
 ChangeTaskPri DiskChange Info     MagTape Rename   SetKeyboard   Which

=============================================================================

An arbitrary length Discrete Fourier Transform program in bwBASIC:-
-------------------------------------------------------------------

10 REM DFT_bwBASIC.bas
20 REM Author:- B.Walker, G0LCU, issued as CC0, Public Domain.
30 REM http://aminet.net/package/dev/src/DFT_IDFT_DWT_FFT
40 REM This is AMIGA Bywater Basic specific.
50 REM *******************************************
60 REM N are the array sizes; e$ is the escape character.
70 N=8
80 e$=CHR$(27)
90 REM *******************************************
100 REM Clear the screen.
110 PRINT e$;"c";
120 REM ******************************************
130 REM Discrete Fourier Transform in bwBASIC.
140 REM Set up the arrays.
150 DIM R(N)
160 DIM I(N)
170 REM Input REAL array.
180 R(0)=1.0
190 R(1)=1.0
200 R(2)=1.0
210 R(3)=1.0
220 R(4)=0.0
230 R(5)=0.0
240 R(6)=0.0
250 R(7)=0.0
260 REM Input IMAGINARY array.
270 I(0)=0.0
280 I(1)=0.0
290 I(2)=0.0
300 I(3)=0.0
310 I(4)=0.0
320 I(5)=0.0
330 I(6)=0.0
340 I(7)=0.0
350 REM Output REAL array.
360 DIM r(N)
370 REM Output IMAGINARY array.
380 DIM i(N)
390 REM ******************************************
400 REM Display the input arrays.
410 PRINT ""
420 PRINT "     Display REAL  and  IMAGINARY input pairs:-"
430 FOR n=0 TO (N-1) STEP 1
440 	PRINT "",R(n),"	";I(n)
450 NEXT n
460 REM ******************************************
470 PRINT ""
480 PRINT "     Calculating COMPLEX REAL and IMAGINARY pairs..."
490 REM Call the DFT routine.
500 GOSUB 790
510 REM ******************************************
520 REM Finally print out the ABSOLUTE values.
530 PRINT ""
540 PRINT "     And finally the absolute values of the COMPLEX pairs:-"
550 PRINT ""
560 FOR n=0 TO (N-1) STEP 1
570	a=(r(n)*r(n))+(i(n)*i(n))
580	PRINT USING "##.#####";SQR(a);
590 NEXT n
600 PRINT ""
610 REM ******************************************
620 REM Exit the program.
630 SYSTEM
640 REM ******************************************
650 REM
660 REM ****** Discrete Fourier Transform. *******
670 REM K is an integer _pointer_ to each r() and i() arrays.
680 REM E is an integer _pointer_ to each ELEMENT in the R() snd I() arrays.
690 REM N is the length of the arrays.
700 REM P is the constant pi.
710 REM R() is the REAL input array.
720 REM I() is the IMAGINARY input array.
730 REM S is SUMREAL.
740 REM s is SUMIMAG.
750 REM A is the ANGLE in radians.
760 REM r() is the REAl output array.
770 REM i() is the IMAGINARY output array.
780 REM *************** DFT start. ***************
790 P=3.1415927
800 FOR K=0 TO (N-1) STEP 1
810	S=0.0
820	s=0.0
830		FOR E=0 TO (N-1) STEP 1
840			A=(2.0*P*E*K)/(N)
850			S=S+(R(E)*COS(A))+(I(E)*SIN(A))
860			s=s-(R(E)*SIN(A))+(I(E)*COS(A))
870		NEXT E
880	r(K)=S
890	i(K)=s
900 NEXT K
910 RETURN
920 REM **************** DFT end. ****************
930 REM
940 REM Compare with these absolute values...
950 REM 4.00000 2.61313 0.00000 1.08239 0.00000 1.08239 0.00000 2.61313
960 REM
970 REM ******************************************

=============================================================================

  MINIMUM Requirements Are:-
  --------------------------

  Any text, '.txt', reader and any image, '.jpg', displayer...
  A means to unzip a '.zip' file...

-----------------------------------------------------------------------------

    Barry Walker, G0LCU.
    wisecracker.bazza@gmail.com

-----------------------------------------------------------------------------

    A very useful HardWare related site, (C) Anthony Hoffman, for
    modifications, schematics, repairs and the like is:-

                          http://amiga.serveftp.net/

=============================================================================

Enjoy...

Bazza...

