after make
sudo make install
addgui will put bwbasic.desktop in users Desktop
DO NOT run as sudo make addgui use
make addgui
fixed typos in Makefile
fixed typo bwbasic.sh
changed dest to /usr/local/bin
The fread()/fwrite() "stream" familiy of functions were doing unexpected
things. This could be limited to GNU libC. At any rate that is the most
common libC on the Linux platform used by most SBCs and this caused errors
while having conversations with I2C devices.
I creates a set of macros to handle the reads and writes for BINARY mode
I/O, thinking that the bare UNIX I/O may not be implemented on some
platforms. This has yet to be tested. Those other platforms would likely
not have a problem with the random seek because you can't open I/O devices
with ordinary file commands.
Macros:
- BREAD(F, V): read()s binary data from file descriptor in FILE *F into V.
- BWRITE(F, V): write()s binary data V to file descriptor in FILE *F.
- BREADS(F, V): read()s binary data from file descriptor in FILE *F into
V->Buffer.
- BWRITES(F, V): write()s binary data V-Buffer to file descriptor in FILE *F.
The BREADS/BWRITES handle writing the "Buffer" from a bwBASIC Variant. This
is used for reading and writing strings, hence the trailing S.
A test macro CMDEBUG was added to produce more diagnostic info. This will
likely go away.
This fixes an issue with colors in the COLOR command on ANSI terminals. The
first 8 color codes are in one range of numbers and the second are in a
second range. bwx_COLOR expected all 16 colors to be contiguous.
Also the code was cleaned up to use escapes where appropriate and to use
better primitive functions where available.
*WARN* we've seen this fail. See remark in renum.c.
We spent quite a lot of time fixing many things and renum now seems
able to renumber standard bwBASIC programs. bwBASIC allows for many
things that weren't available in the HP BASIC, which is where the
original renumber program came from.
If you stash line numbers in variables or calculate them you will have
to renumber those your self! :-)
* Implements most of the following BASIC dialects:
OPTION VERSION "BYWATER" ' Bywater BASIC 3
OPTION VERSION "BYWATER-2" ' Bywater BASIC 2
OPTION VERSION "CALL/360" ' SBC CALL/360 Mainframe BASIC
OPTION VERSION "CBASIC-II" ' CBASIC-II for CP/M
OPTION VERSION "DARTMOUTH" ' Dartmouth DTSS BASIC
OPTION VERSION "ECMA-55" ' ANSI Minimal BASIC
OPTION VERSION "ECMA-116" ' ANSI Full BASIC
OPTION VERSION "GCOS" ' GE 600 Mainframe BASIC
OPTION VERSION "HAARDT" ' bas 2.4 by Michael Haardt
OPTION VERSION "HANDBOOK1" ' The BASIC Handbook, 1st Edition
OPTION VERSION "HANDBOOK2" ' The BASIC Handbook, 2nd Edition
OPTION VERSION "HEATH" ' Heath Benton Harbor BASIC
OPTION VERSION "MARK-I" ' GE 265 Mainframe BASIC
OPTION VERSION "MARK-II" ' GE 435 Mainframe BASIC
OPTION VERSION "MBASIC" ' Microsoft BASIC-80 for Xenix
OPTION VERSION "PDP-8" ' DEC PDP-8 BASIC
OPTION VERSION "PDP-11" ' DEC PDP-11 BASIC
OPTION VERSION "RBASIC" ' Micronics RBASIC for 6809 FLEX
OPTION VERSION "RSTS-11" ' DEC RSTS-11 BASIC-PLUS
OPTION VERSION "SYSTEM/360" ' IBM System/360 Mainframe BASIC
OPTION VERSION "SYSTEM/370" ' IBM System/370 Mainframe BASIC
OPTION VERSION "TRS-80" ' TRS-80 Model I/III/4 LBASIC
OPTION VERSION "VINTAGE" ' Vintage BASIC 1.0.1
OPTION VERSION "XBASIC" ' TSC XBASIC for 6800 FLEX
* CONST variable [, ...] = value
Assigns the value to variable.
Any later assignment to the variable causus a VARIABLE NOT DECLARED error.
* DIM now supports lower and upper bounds.
OPTION BASE 1
DIM X( 9 ) ' lower bound is 1
DIM Y( 5 TO 9 ) ' lower bound is 5
* DIM now supports virtual variables.
OPTION BASE 1
OPEN "VIRTUAL.DAT" FOR VIRTUAL AS # 3 ' virtual data file
DIM # 3, A( 1000 ) ' array is virtual
LET A( 1000 ) = 0 ' value is written to the file
LET X = A( 1000 ) ' value is read from the file
CLOSE # 3 ' array is no longer valid
* ERROR 27, "Bad DATA"
Occurs when the READ command detects garbage in a DATA command.
* INPUT LINE
Same as LINE INPUT.
* MAT now supports lower and upper bounds.
OPTION BASE 1
MAT X( 9 ) = ZER ' lower bound is 1
MAT Y( 5 TO 9 ) = ZER ' lower bound is 5
MAT X = ZER( 9 ) ' lower bound is 1
MAT Y - ZER( 5 TO 9 ) ' lower bound is 5
* MAXLEN()
Returns the maximum string length.
* OPTION DIGITS integer
Sets the number of significant digits for PRINT.
Setting the value to zero restores the default.
* OPTION EDIT string$
Sets the program name used by the EDIT command.
Setting this to "" disables EDIT command.
* OPTION FILES string$
Sets the program name used by the FILES command.
Setting this to "" disables FILES command.
* OPTION PROMPT string$
Sets the prompt.
* OPTION PUNCT AT char$
Sets the PRINT AT character, commonly "@".
Setting this to "" disables PRINT AT.
Setting this to a non-punctuation character is not supported.
* OPTION PUNCT BYTE char$
Sets the BYTE type suffix, commonly "~".
Setting this to "" disables BYTE suffix.
Setting this to a non-punctuation character is not supported.
* OPTION PUNCT COMMENT char$
Sets the trailing COMMENT character, commonly "'".
Setting this to "" disables trailing comments.
Setting this to a non-punctuation character is not supported.
* OPTION PUNCT CURRENCY char$
Sets the CURRENCY type suffix, commonly "@".
Setting this to "" disables CURRENCY suffix.
Setting this to a non-punctuation character is not supported.
* OPTION PUNCT DOUBLE char$
Sets the DOUBLE type suffix, commonly "#".
Setting this to "" disables DOUBLE suffix.
Setting this to a non-punctuation character is not supported.
* OPTION PUNCT FILENUM char$
Sets the FILE NUMBER prefix, commonly "#".
Setting this to "" disables the FILE NUMBER prefix.
Setting this to a non-punctuation character is not supported.
* OPTION PUNCT IMAGE char$
Sets the shortcut IMAGE character, commonly ":".
Setting this to "" disables the shortcut IMAGE character.
Setting this to a non-punctuation character is not supported.
* OPTION PUNCT INPUT char$
Sets the shortcut INPUT character, commonly "!".
Setting this to "" disables the shortcut INPUT character.
Setting this to a non-punctuation character is not supported.
* OPTION PUNCT INTEGER char$
Sets the INTEGER type suffix, commonly "%".
Setting this to "" disables INTEGER suffix.
Setting this to a non-punctuation character is not supported.
* OPTION PUNCT LONG char$
Sets the LONG type suffix, commonly "&".
Setting this to "" disables LONG suffix.
Setting this to a non-punctuation character is not supported.
* OPTION PUNCT LPAREN char$
Sets the LEFT PARENTHESIS character, commonly "(".
Setting this to a non-punctuation character is not supported.
* OPTION PUNCT PRINT char$
Sets the shortcut PRINT character, commonly "?".
Setting this to "" disables the shortcut PRINT character.
Setting this to a non-punctuation character is not supported.
* OPTION PUNCT QUOTE char$
Sets the QUOTE character, commonly """".
Setting this to a non-punctuation character is not supported.
* OPTION PUNCT RPAREN char$
Sets the RIGHT PARENTHESIS character, commonly ")".
Setting this to a non-punctuation character is not supported.
* OPTION PUNCT SINGLE char$
Sets the SINGLE type suffix, commonly "!".
Setting this to "" disables SINGLE suffix.
Setting this to a non-punctuation character is not supported.
* OPTION PUNCT STATEMENT char$
Sets the shortcut STATEMENT seperator character, commonly ":".
Setting this to "" disables the STATEMENT seperator.
Setting this to a non-punctuation character is not supported.
* OPTION PUNCT STRING char$
Sets the STRING type suffix, commonly "$".
Setting this to "" disables STRING suffix.
Setting this to a non-punctuation character is not supported.
* OPTION RECLEN integer
Sets the default record length for RANDOM files, commonly 128.
Setting thisto zero means there is no default RANDOM record
length, so the record length must be specified in the OPEN
statement.
With OPTION RECLEN 128:
OPEN "FILE.DAT" FOR RANDOM AS #3
is considered to be the same as
OPEN "FILE.DAT" FOR RANDOM AS #3 LEN 128
With OPTION RECLEN 0:
OPEN "FILE.DAT" FOR RANDOM AS #3
causes an error.
* OPTION RENUM string$
Sets the program name used by the RENUM command.
Setting this to "" disables RENUM command.
* OPTION SCALE integer
Sets the number of digits to round after the decimal point for PRINT.
Setting the value to zero disables rounding.
* OPTION USING DIGIT
* OPTION USING COMMA
* OPTION USING PERIOD
* OPTION USING PLUS
* OPTION USING MINUS
* OPTION USING EXRAD
* OPTION USING DOLLAR
* OPTION USING FILLER
* OPTION USING LITERAL
* OPTION USING FIRST
* OPTION USING ALL
* OPTION USING LENGTH
Sets the characters recognized by PRINT USING.
Setting these to a non-punctuation character is not supported.
* OPTION VERSION now requires a string instead of a literal.
Some version names have changed.
* OPTION VERSION "PDP-8"
Added LPT, PTP, PTR, TTY, TTY IN and TTY OUT commands.
Added GET() and PUT() functions.
* OPTION VERSION "CALL/360"
* OPTION VERSION "SYSTEM/360"
* OPTION VERSION "SYSTEM/370"
Added alphabet extenders. $ is a string variable.
* OPTION ZONE integer
Sets the PRINT zone width.
Setting the value to zero restores the default.
* REPEAT - UNTIL added
REPEAT
...
EXIT REPEAT
...
UNTIL expression ' exits when expression != 0
* SPC( X ) and TAB( X )
No longer use control codes.
* UNTIL - UEND removed (to add REPEAT - UNTIL)
Here is a work-around for existin code using UNTIL-UEND:
UNITL expression -->> WHILE NOT expression
... ...
EXIT UNTIL -->> EXIT WHILE
... ...
UEND -->> WEND
* from Howard Wulf, AF5NE
Editor's Note: In the official release *ALL* of the test and sample
BASIC programs were removed and packaged in a separate "test" ZIP. I
have extracted those in to the bwbtest folder where most of the
tests were living in previous packages. I've also improved (I hope)
the EOL handling.
- ChipMaster
* Implements most of the following BASIC dialects:
OPTION VERSION DARTMOUTH ' Dartmouth DTSS BASIC
OPTION VERSION MARK-I ' GE 265 Mainframe BASIC
OPTION VERSION MARK-II ' GE 435 Mainframe BASIC
OPTION VERSION SYSTEM-360 ' IBM System/360 BASIC
OPTION VERSION SYSTEM-370 ' IBM System/370 BASIC
OPTION VERSION CBASIC-II ' CBASIC-II for CP/M
OPTION VERSION ECMA-55 ' ANSI Minimal BASIC
OPTION VERSION HANDBOOK1 ' The BASIC Handbook, 1st Edition
OPTION VERSION HANDBOOK2 ' The BASIC Handbook, 2nd Edition
OPTION VERSION TRS-80 ' TRS-80 Model I/III/4 LBASIC
OPTION VERSION BASIC-80 ' Microsoft BASIC-80 for Xenix
OPTION VERSION ECMA-116 ' ANSI Full BASIC
* from Howard Wulf, AF5NE
Editor Note: There appears to be a lot of output artifacts left in this commit
but its included verbatim, as delivered in the official source tar ball for
historical accuracy. - ChipMaster
Patch level 2 release by Jon B. Volkoff,
11 October 1997
LIST OF PATCHES TO 2.20:
bwb_cmd.c
Fixed calling stack level logic in RETURN statement to prevent erroneous
"RETURN without GOSUB" messages.
bwb_cnd.c
bwb_stc.c
Changed continuation condition for WHILE, ELSEIF, and LOOP UNTIL
to be != FALSE, not == TRUE. More in line with common commercial
BASIC implementations.
bwb_mth.c
Fixed initialization in VAL function so that old results are not later
returned as values.
bwb_var.c
Added parenthesis level checking to dim_getparams. Using multi-level
expressions as array subscripts was causing the program to bomb.
bwx_iqc.c
bwx_tty.c
bwb_mes.h
Added second copyright notice.
bwb_dio.c
bwb_str.c
Added support for strings longer than 255 characters.
bwb_prn.c
Disabled tab expansion and print width checks when not printing to a file.
bwb_inp.c
Fixed LINE INPUT file reads to accommodate strings of length MAXSTRINGSIZE.
bwx_ncu.h
bwx_ncu.c
New files. Code for UNIX ncurses interface, compliments of L.C. Benschop,
Eindhoven, The Netherlands.
Makefile.ncu
New files. Sample makefile for ncurses implementation.
bwbasic.h
Revised defines for MININTSIZE and MAXINTSIZE from 16-bit to 32-bit limits.
Revised define for MAXSTRINGSIZE from 255 to 5000 characters.
Changed string length from unsigned char to unsigned int to support strings
longer than 255 characters.
Added support for new ncurses package.
Revised VERSION define to reflect above changes.
To implement these patches simply replace the old versions of the above source
files with the new ones and remake bwbasic.
Patch level 1 release by Jon B. Volkoff,
15 March 1996
LIST OF PATCHES TO 2.20:
bwb_cnd.c
Moved init routine for bwb_while so that it would be initialized regardless
of expression value, not just if TRUE. This was causing some segmentation
faults in WHILE-WEND loops.
bwb_elx.c
Plugged gaping memory leak. Temp variable space for expression evaluation
was being allocated but not freed when done (oops!).
bwb_fnc.c
Added check for NULL return from getenv to prevent segmentation faults.
bwbasic.h
Revised VERSION define to reflect above changes.
To implement these patches simply replace the old versions of the above source
files with the new ones and remake bwbasic.