BWBASIC(1)

๐Ÿ’– BWBASIC(1) โ€” Bywater BASIC interpreter/shell ๐Ÿ’–

okay so bestie, welcome to the manual for bwbasic ๐Ÿ’… this is part 1 of 6, so we're just getting started. no cap, this is the Bywater BASIC interpreter/shell and it's giving vintage but make it shell-scripting. let's get into it.

โœจ NAME โœจ

bwbasic โ€” Bywater BASIC interpreter/shell

so like, the name is literally bwbasic and it's the Bywater BASIC interpreter/shell. iconic.

Bywater BASIC Interpreter/Shell, version 2.10


Copyright (c) 1993, Ted A. Campbell for bwBASIC version 2.10, 11 October 1993

๐Ÿ“‹ CONTENTS ๐Ÿ“‹

  1. DESCRIPTION โ€” what even is this
  2. TERMS OF USE โ€” the legal tea
  3. QUICK REFERENCE LIST OF COMMANDS AND FUNCTIONS โ€” the cheat sheet
  4. GENERAL NOTES ON USAGE โ€” how to actually use it
  5. EXPANDED REFERENCE FOR COMMANDS AND FUNCTIONS โ€” the deep dive
  6. PREDEFINED VARIABLES โ€” the built-in ones
  7. UNIMPLEMENTED COMMANDS AND FUNCTIONS and AGENDA FOR DEVELOPMENT โ€” the to-do list
  8. THE STORY OF BYWATER BASIC โ€” lore
  9. COMMUNICATIONS โ€” how to reach out

also the author wants to say thanks to Mr. David MacKenzie, who helped with the Unix installation and configuration for this version. we love a supportive bestie ๐Ÿซถ

1. โœจ DESCRIPTION โœจ

so the Bywater BASIC Interpreter (bwBASIC) is literally a large superset of the ANSI Standard for Minimal BASIC (X3.60-1978) and a significant subset of the ANSI Standard for Full BASIC (X3.113-1987) written in C. it also offers shell programming facilities as an extension of BASIC. bwBASIC seeks to be as portable as possible. no cap.

bwBASIC can be configured to emulate features, commands, and functions available on different types of BASIC interpreters; see the file INSTALL for further installation information. ๐Ÿ’…

the interpreter is fairly 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. so it's not fast, but it's clear. periodt.

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. slay.

2. ๐Ÿ“œ TERMS OF USE ๐Ÿ“œ

this version of Bywater BASIC is released under the terms of the GNU General Public License (GPL), which is distributed with this software in the file "COPYING". the GPL specifies the terms under which users may copy and use the software in this distribution.

a separate license is available for commercial distribution, for information on which you should contact the author. so if you wanna make money off it, hit him up.

3. โšก QUICK REFERENCE LIST OF COMMANDS AND FUNCTIONS โšก

be aware that many of these commands and functions will not be available unless you have set certain flags in the header files (see the expanded reference section below for dependencies). so don't come for me if something doesn't work.

here's the whole list, copied exactly so you don't miss a single one:

ABS( number )
ASC( string$ )
ATN( number )
CALL subroutine-name
CASE ELSE | IF partial-expression | constant
CHAIN [MERGE] file-name [, line-number] [, ALL]
CHDIR pathname
CHR$( number )
CINT( number )
CLEAR
CLOSE [[#]file-number]...
CLS
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...)]...
DO NUM|UNNUM
DO [WHILE expression]
EDIT
ELSE
ELSEIF
END IF | FUNCTION | SELECT | SUB
ENVIRON variable-string = string
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...]
FILES filespec$
FUNCTION
FOR counter = start TO finish [STEP increment]
GET [#] device-number [, record-number]
GOSUB line | label
GOTO line | label
HEX$( number )
IF expression THEN [statement [ELSE statement]]
INKEY$
INPUT [# device-number]|[;]["prompt string";]list of variables
INSTR( [start-position,] string-searched$, string-pattern$ )
INT( number )
KILL file-name
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 )
LOCATE line, column
LOF( device-number )
LOG( number )
LOOP [UNTIL expression]
LSET string-variable$ = expression
MERGE file-name
MID$( string$, start-position-in-string[, number-of-spaces ] )
MKD$( number )
MKDIR pathname
MKI$( number )
MKS$( number )
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]
QUIT
RANDOMIZE number
READ variable[, variable]...
REM string
RESTORE line
RETURN
RIGHT$( string$, number-of-spaces )
RMDIR pathname
RND( number )
RSET string-variable$ = expression
RUN [line][file-name]
SAVE file-name
SELECT CASE expression
SGN( number )
SIN( number )
SPACE$( number )
SPC( number )
SQR( number )
STOP
STR$( number )
STRING$( number, ascii-value|string$ )
SUB subroutine-name
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 ]....

that's a lot of commands, bestie. take a screenshot. ๐Ÿ“ธ

4. ๐Ÿ“ GENERAL NOTES ON USAGE ๐Ÿ“

4.a. Interactive Environment

an interactive environment is provided if the flag INTERACTIVE is defined as TRUE in bwbasic.h, 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 environment 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. one can use DO NUM and DO UNNUM to number or unnumber lines. see also the documentation below for the pseudo-command EDIT. so you do you.

4.b. Naming Conventions

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. so watch out.

variable names can use any alphabetic characters, the period and underscore characters and decimal digits (but not in the first position). they can be terminated with '#' or '!' to allow Microsoft-type names, even though the precision is irrelevant to bwBASIC. iykyk.

4.c. Numerical Constants

numerical constants may begin with a digit 0-9 (decimal), with the "&H" or "&h" (hexadecimal) or the "&o" or "&O" (octal). decimal numbers may terminated with 'E', 'e', 'D', or 'd' followed by an exponent number to denote exponential notation. decimal constants may also be terminated by the '#' or '!' to comply with Microsoft-style precision terminators, although the precision specified will be irrelevant to bwBASIC. so many ways to write a number, it's giving versatile.

4.d. Command-Line Execution

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". easy.

4.e. Program Storage

all programs are stored as ASCII text files. no binary nonsense here.

4.f. TRUE and FALSE

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). so if you're compiling it yourself, you can change the vibe.

4.g. Assignments

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. so don't try it. periodt.

4.h. Operators and Precedence

bwBASIC recognizes the following operators, with their level of precedence given (1 = highest):

   ^                 1       exponentiation
   *                 2       multiplication
   /                 2       division
                    3       integer division
   +                 5       addition
   -                 5       subtraction
   =                 6       equality or assignment
   MOD               4       modulus (remainder) arithmetic
   <>                7       inequality
   <                 8       less than
   >                 9       greater than
   <=                10      less than or equal to
   =<                10      less than or equal to
   >=                11      greater than or equal to
   =>                11      greater than or equal to
   NOT               12      negation
   AND               13      conjunction
   OR                14      disjunction
   XOR               15      exclusive or
   IMP               16      implication
   EQV               17      equivalence

note the missing operator on the integer division line? yeah, that's exactly how it is in the original. we keep it real. ๐Ÿ’…

4.h. Numerical Precision (NOT)

bwBASIC is out here working with numbers that have literally one level of precision, bestie. If the flag NUMBER_DOUBLE is set to TRUE in bwbasic.h, then the precision you get is whatever the C "double" data type gives you; otherwise (and this is the default, so like, assume this unless told otherwise) the precision is that of the C float type. And yeah, there are a bunch of points where commands (or pseudo-commands, the little posers ๐Ÿ’…) seem to recognize Microsoft-style precision distinctions โ€” but for the most part those are just work-around aliases so Microsoft-style programs can actually run. It's giving translator energy. ๐ŸŒˆ


โœจ 5. EXPANDED REFERENCE FOR COMMANDS AND FUNCTIONS โœจ

Okay so the "Dependencies" you're gonna see listed in all the reference material below? Those are the flags that have to be set to TRUE in bwbasic.h for that specific command or function to even get implemented. Here's the whole flag family, no cap:

  • (core) โ€” Commands and Functions in any implementation of bwBASIC; these are the ANSI Minimal BASIC core
  • INTERACTIVE โ€” Commands supporting the interactive programming environment
  • COMMON_CMDS โ€” Commands beyond ANSI Minimal BASIC which are common to Full ANSI BASIC and Microsoft BASICs
  • COMMON_FUNCS โ€” Functions beyond the ANSI Minimal BASIC core, but common to both ANSI Full BASIC and Microsoft-style BASIC varieties
  • UNIX_CMDS โ€” Commands which require Unix-style directory and environment routines not specified in C
  • STRUCT_CMDS โ€” Commands related to structured programming; all of these are part of the Full ANSI BASIC standard
  • ANSI_FUNCS โ€” Functions unique to ANSI Full BASIC
  • MS_CMDS โ€” Commands unique to Microsoft BASICs
  • MS_FUNCS โ€” Functions unique to Microsoft BASICs

Function: ABS( number )

  • Description: ABS returns the absolute value of the argument number. Slay, negativity removed. ๐Ÿ’–
  • Dependencies: (core)

Function: ASC( string$ )

  • Description: ASC returns the ASCII code for the first letter in the argument string$. Just the first one, bestie โ€” it's not reading the whole thing. ๐Ÿ‘‘
  • Dependencies: MS_FUNCS

Function: ATN( number )

  • Description: ATN returns the arctangent value of the argument number in radians. Math girlies rise up. ๐Ÿ“โœจ
  • Dependencies: (core)

Command: CALL subroutine-name

  • Description: CALL calls a named subroutine โ€” go peek at SUB and END SUB for the full lore. ๐ŸŽ€
  • Dependencies: STRUCT_CMDS

Command: CASE ELSE | IF partial-expression | constant

  • Description: CASE introduces an element of a SELECT CASE statement (see SELECT CASE). CASE IF introduces a conditional SELECT CASE element, and CASE ELSE introduces a default SELECT CASE element. It's the choose-your-own-adventure of BASIC. ๐Ÿฆ‹
  • Dependencies: STRUCT_CMDS

Command: CHAIN [MERGE] file-name [, line-number] [, ALL]

  • Description: CHAIN passes control to another BASIC program. Variables declared COMMON (q.v.) will be passed to the new program. Handing off the aux like a relay race. ๐Ÿƒโ€โ™€๏ธ๐Ÿ’จ
  • Dependencies: COMMON_CMDS

Command: CHDIR pathname$

  • Description: CHDIR changes the current directory to that indicated by the argument pathname$. Moving out, fr fr. ๐Ÿšชโœจ
  • Dependencies: UNIX_CMDS

Function: CHR$( number )

  • Description: CHR$ returns a one-character string with the character corresponding to the ASCII code indicated by argument number. The glow-up twin of ASC. ๐Ÿ’ซ
  • Dependencies: COMMON_FUNCS

Function: CINT( number )

  • Description: CINT returns the truncated integer for the argument number. All the decimals get politely escorted out. ๐Ÿ™ˆ
  • Dependencies: MS_FUNCS

Command: CLEAR

  • Description: CLEAR sets all numerical variables to 0, and all string variables to null. Fresh start, clean slate, main character reset arc. ๐ŸŒธ
  • Dependencies: COMMON_CMDS

Command: CLOSE [[#]file-number]...

  • Description: CLOSE closes the file indicated by file-number (see OPEN). Say bye bestie ๐Ÿ‘‹
  • Dependencies: COMMON_CMDS

Command: CLS

  • Description: CLS clears the display screen (IBM and compatibles only as of version 2.10). Not everyone gets this privilege, sorry. ๐Ÿ’€
  • Dependencies: IMP_IQC and IMP_CMDLOC

Command: CMDS

  • Description: CMDS is a debugging command that prints a list of all implemented bwBASIC commands. It's the receipts printer. ๐Ÿงพ
  • Dependencies: DEBUG

Command: COMMON variable [, variable...]

  • Description: COMMON designates variables to be passed to a CHAINed program (see CHAIN). Gotta tag your friends before the switch-up. ๐Ÿซถ
  • Dependencies: COMMON_CMDS

Function: COS( number )

  • Description: COS returns the cosine of the argument number in radians. Trigonometry stays undefeated. ๐ŸŒˆ
  • Dependencies: (core)

Function: CSNG( number )

  • Description: CSNG is a pseudo-function that has no effect under bwBASIC. It replicates a Microsoft-type command that would convert the number to single-precision. It's cosplaying as a real function, and we let it. ๐Ÿ’…
  • Dependencies: MS_FUNCS

Function: CVD( string$ )

  • Description: CVD converts the argument string$ into a bwBASIC number (precision is irrelevant in bwBASIC since bwBASIC numbers have only one precision). โœจ

Implementation-Specific Notes:

CVD(), CVI(), CVS(), MKI$(), MKD$(), MKS$(): These functions are implemented, but they 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.

๐Ÿšจ Okay this one is the real warning, bestie. This is not a vibe โ€” this is a portability landmine. Files made on one system/compiler might just not read right on another. Be careful, fr fr.
  • Dependencies: MS_FUNCS

Function: CVI( string$ )

  • Description: CVI converts the argument string$ into a bwBASIC number (precision is irrelevant in bwBASIC since bwBASIC numbers have only one precision; see also the note on CVD). ๐Ÿ“
  • Dependencies: MS_FUNCS

Function: CVS( string$ )

  • Description: CVI converts the argument string$ into a bwBASIC number (precision is irrelevant in bwBASIC since bwBASIC numbers have only one precision; see also the note on CVD). ๐Ÿ“
  • Dependencies: MS_FUNCS

Command: DATA constant[,constant]...

  • Description: DATA stores numerical and string constants to be accessed by READ (q.v.). It's the little stash you come back for later. ๐ŸŽ€
  • Dependencies: (core)

Function: DATE$

  • Description: DATE$ returns the current date based on the computer's internal clock as a string in the form "YYYY-MM-DD". As implemented under bwBASIC, DATE$ cannot be used for assignment (i.e., to set the system date). Read-only, bestie. You can look, you cannot touch. ๐Ÿ‘€
  • Note: bwBASIC presently (v2.10) does not allow assignment to a function.
  • Dependencies: COMMON_FUNCS

Command: DEF FNname(arg...)] = expression

  • Description: DEF defines a user-written function. This function corresponds to Microsoft-type implementation, although in bwBASIC DEF is a working equivalent of FUNCTION. DIY queen behavior. ๐Ÿ‘‘
  • Dependencies: (core)

Command: DEFDBL letter[-letter](, letter[-letter])...

  • Description: DEFDBL declares variables with single-letter names as numerical variables (precision is irrelevant in bwBASIC). ๐Ÿ’œ
  • Dependencies: MS_CMDS

Command: DEFINT letter[-letter](, letter[-letter])...

  • Description: DEFINT declares variables with single-letter names as numerical variables (precision is irrelevant in bwBASIC). ๐Ÿ’œ
  • Dependencies: MS_CMDS

Command: DEFSNG letter[-letter](, letter[-letter])...

  • Description: DEFSNG declares variables with single-letter names as numerical variables (precision is irrelevant in bwBASIC). ๐Ÿ’œ
  • Dependencies: MS_CMDS

Command: DEFSTR letter[-letter](, letter[-letter])...

  • Description: DEFSTR declares variables with single-letter names as string variables. String girlies, this one's for you. ๐ŸŽ€
  • Dependencies: MS_CMDS

Command: DELETE line[-line]

  • Description: DELETE deletes program lines indicated by the argument(s). If you want to use DELETE for non-numbered programs, first use DO NUM, then DELETE, then DO UNNUM. It's a whole ritual, but it works. โœจ
  • Dependencies: INTERACTIVE

Command: DIM variable(elements...)[variable(elements...)]...

  • Description: DIM specifies variables that have more than one element in a single dimension, i.e., arrayed variables. โœจ
  • Note: As implemented under bwBASIC, DIM accepts only parentheses as delimiters for variable fields. (Some BASICs allow the use of square brackets.)
  • Dependencies: (core)

Command: DO NUM|UNNUM

Description time, bestie ๐Ÿ’– so DO NUM numbers all the lines in a program. The first line gets the number 10, and then every line after it gets numbered consecutively in multiples of 10 โœจ. And DO UNNUM? That one strips all the line numbers right back out of a program. Iconic little duo tbh.

NOTE, and this part matters: these functions do nothing to line numbers, like, for example, following a GOSUB or GOTO statement. So no, they are not a replacement for RENUM (which exists in some systems, but not in bwBASIC ๐Ÿ™ˆ). What they are good for: you can develop unnumbered programs by entering new lines with numbers, then running DO UNNUM to remove the line numbers. And together with LOAD and SAVE (q.v.) you can legitimately use bwBASIC as a primitive text editor. slay ๐Ÿ’…

Dependencies: INTERACTIVE


Command: DO [WHILE expression]

DO implements a whole bunch of forms of program loops ๐ŸŒ€. DO...LOOP just loops, periodt โ€” the only way out is via EXIT. DO WHILE...LOOP loops while expression is true (this is equivalent to the older WHILE-WEND loop, which bwBASIC also implements, iykyk). And DO...LOOP UNTIL loops until the expression following UNTIL is true โœจ.

Dependencies: STRUCT_CMDS


Command: EDIT

EDIT is a pseudo-command ๐Ÿซถ โ€” it calls the text editor specified in the variable BWB.EDITOR$ so you can edit the program that's in memory. After the call to the text editor, the (edited) program gets reloaded into memory. Heads up: you normally have to specify a valid path and filename in BWB.EDITOR$ before this command is even useful. No path, no vibes ๐Ÿ’€.

Dependencies: COMMON_CMDS


Command: ELSE

ELSE introduces a default condition in a multi-line IF statement. That's the whole job ๐ŸŒธ.

Dependencies: STRUCT_CMDS


Command: ELSEIF

ELSEIF introduces a secondary condition in a multi-line IF statement. Main character energy, second-place position ๐Ÿ’œ.

Dependencies: STRUCT_CMDS


Command: END IF | FUNCTION | SELECT | SUB

Okay so this one's a four-for-one deal โœจ:

  • END IF ends a multi-line IF statement.
  • END FUNCTION ends a multi-line function definition.
  • END SELECT ends a SELECT CASE statement.
  • END SUB ends a multi-line subroutine definition.

Dependencies: STRUCT_CMDS


Command: ENVIRON variable-string$ = string$

ENVIRON sets the environment variable identified by variable-string$ to string$ ๐ŸŒˆ.

Little note, bestie: this differs from the implementation of ENVIRON in some versions of BASIC, but bwBASIC's ENVIRON lets BASIC variables be used on either side of the equals sign. Also, the function ENVIRON$() is a different thing from this command, don't mix them up ๐Ÿ™ˆ. And be aware that in some operating systems, an environment variable set within a program will not be passed to its parent shell. So don't come crying to me when your shell can't see it ๐Ÿ’€.

Dependencies: UNIX_CMDS


Function: ENVIRON$( variable-string$ )

ENVIRON$ returns the environment variable associated with the name variable-string$. It's the getter to ENVIRON's setter, we love a matching set ๐ŸŽ€.

Dependencies: MS_FUNCS


Function: EOF( device-number )

EOF returns TRUE (-1) if the device associated with device-number is at the end-of-file, otherwise it returns FALSE (0) ๐Ÿฆ‹.

Dependencies: MS_FUNCS


Command: ERASE variable[, variable]...

ERASE eliminates arrayed variables from a program. bye bye arrays ๐Ÿ‘‹โœจ.

Dependencies: COMMON_CMDS


Function: ERL

ERL returns the line number of the most recent error ๐Ÿ“.

Dependencies: MS_FUNCS


Function: ERR

ERR returns the error number of the most recent error ๐Ÿ”ฅ.

Careful though: 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. So like, it works, but only in that one situation, fr fr.

Dependencies: MS_FUNCS


Command: ERROR number

ERROR simulates an error โ€” as in, it displays the message appropriate for that error ๐Ÿ’…. This command is helpful in writing ON ERROR GOSUB routines that can identify a few errors for special treatment and then ERROR ERR (i.e., default handling) for all the others. Chef's kiss error handling honestly ๐Ÿ‘‘.

Dependencies: COMMON_CMDS


Command: EXIT [FOR]

EXIT by itself exits from a DO...LOOP loop; EXIT FOR exits from a FOR...NEXT loop. The escape hatch of your dreams ๐Ÿšชโœจ.

Dependencies: STRUCT_CMDS


Function: EXP( number )

EXP returns the exponential value of number. Math girlies rise ๐ŸŒธ.

Dependencies: (core)


Command: FIELD [#] device-number, number AS string-variable$ [, number AS string-variable$...]

FIELD allocates space in a random file buffer for the device indicated by device-number, allocating number bytes and assigning the bytes at this position to the variable string-variable$ ๐Ÿงš.

Dependencies: COMMON_CMDS


Command: FILES filespec$

FILES is a pseudocommand that invokes the directory program specified in the variable BWB.FILES$ with the argument filespec$ ๐Ÿ“‚. Normally, you gotta set this variable before FILES can be used. For example, for PC-type computers:

BWB.FILES$ = "DIR"

will work. And for Unix machines:

BWB.FILES$ = "ls -l"

etc. Set your variable, get your listing, live your best life ๐Ÿซถ.

Dependencies: COMMON_CMDS


Command: FNCS

Okay ngl, the page literally says: CMDS is a debugging command that prints a list of all pre-defined bwBASIC functions ๐Ÿ’€. That's what it says, I'm just the messenger. It's a debugging command that prints a list of all pre-defined bwBASIC functions โœจ.

Dependencies: DEBUG


Command: FUNCTION

FUNCTION introduces a function definition, normally ending with END FUNCTION ๐ŸŽ€. In bwBASIC, FUNCTION and DEF are working equivalents, so either one can be used with single-line function definitions or with multi-line definitions terminated by END FUNCTION. Two names, one vibe, we love efficiency ๐Ÿ’œ.

Dependencies: STRUCT_CMDS


Command: FOR counter = start TO finish [STEP increment]

FOR initiates a FOR-NEXT loop with the variable counter initially set to start and incrementing in increment steps (default is 1) until counter equals finish ๐Ÿ”. Classic. Timeless. Iconic.

Dependencies: (core)


Command: GET [#] device-number [, record-number]

GET reads the next record from a random-access file or device into the buffer associated with that file ๐Ÿ“ฅ. If record-number is specified, the GET command reads the specified record instead. Your choice, bestie.

Dependencies: COMMON_CMDS


Command: GOSUB line | label

GOSUB initiates a subroutine call to the line (or label) specified โœจ. The subroutine must end with RETURN. No RETURN, no coming back, and that's on periodt ๐Ÿ’….

Dependencies: (core), but STRUCT_CMDS for labels


Command: GOTO line | label

GOTO branches program execution to the specified line (or label). Teleportation but make it BASIC ๐ŸŒˆ.

Dependencies: (core), but STRUCT_CMDS for labels


Function: HEX$( number )

HEX$ returns a string giving the hexadecimal (base 16) value for the number ๐Ÿ”ขโœจ.

Dependencies: MS_FUNCS


Command: IF expression THEN [statement [ELSE statement]]

IF evaluates expression and performs the THEN statement if it is true, or (optionally) the ELSE statement if it is FALSE ๐Ÿฆ‹. And if STRUCT_CMDS is set to TRUE, bwBASIC allows multi-line IF statements with ELSE and ELSEIF cases, ending with END IF. So you can go as multi-line as your heart desires ๐Ÿ’–.

Dependencies: (core), STRUCT_CMDS for multi-line IF statements


Function: INKEY$

INKEY$ reads the status of the keyboard, and a single keypress, if available โŒจ๏ธ. If a keypress is not available, then INKEY$ immediately returns a null string ("") โ€” it does not wait around for you, it has places to be ๐Ÿ’…. Currently (v2.10) implemented in bwx_iqc.c only. So, like, very specific situation, iykyk.

Dependencies: IMP_IQC and IMP_CMDLOC


Command: INPUT [# device-number]|[;]["prompt string";]list of variables

INPUT allows input from the terminal or a device specified by device-number ๐ŸŽ€. If it's the terminal, the "prompt string" is output, and input is assigned to the appropriate variables specified. Cute, right?

But heads up: bwBASIC does not support the optional feature of INPUT that suppresses the carriage-return and line-feed at the end of the input. Why? Because C alone does not provide for any means of input other than CR-LF-terminated strings. That's just the situation, bestie, we don't make the rules ๐Ÿ˜ญ.

Dependencies: (core)


Function: INSTR( [start-position,] string-searched$, string-pattern$ )

INSTR hands you back the exact position where string-pattern$ shows up inside string-searched$, and it starts its little scavenger hunt from start-position. ๐Ÿ”

As implemented in bwBASIC, INSTR cannot be used for assignments.

Note: bwBASIC presently (v2.10) does not allow assignment to a function. bestie you literally cannot do it, don't try ๐Ÿ’€
  • Dependencies: MS_FUNCS

โœจ Function: INT( number )

INT gives you the largest integer that's less than or equal to the argument number. So it rounds down, floor-style, no cap. ๐ŸงŠ

NOTE this is not a "truncated" integer function โ€” if that's the vibe you want, go look at CINT instead. They are not the same girl, do not confuse them.
  • Dependencies: (core)

๐Ÿ’€ Command: KILL file-name$

KILL deletes the file you name in file-name$. It's giving ruthless. Gone. Deleted. No recycle bin. ๐Ÿ—‘๏ธ

  • Dependencies: UNIX_CMDS

๐ŸŽ€ Function: LEFT$( string$, number-of-spaces )

LEFT$ returns a substring of string$ that's number-of-spaces long, taken from the left (aka the beginning) of the string. So you're grabbing the front bit. โœ‚๏ธ

As implemented under bwBASIC, it cannot be used for assignment.

  • Dependencies: MS_FUNCS

๐ŸŒธ Function: LEN( string$ )

LEN returns the length of string$ โ€” in bytes, bestie, bytes specifically. ๐Ÿ“

  • Dependencies: COMMON_FUNCS

๐Ÿ’œ Command: LET variable = expression

LET variable = expression

LET assigns the value of expression to the variable. Simple, iconic, foundational. โœจ

As currently implemented, bwBASIC supports implied LET statements โ€” like X = 4.5678 right at the start of a line or line segment โ€” but it does not support assignment to multiple variables. So x, y, z = 3.141596 is a no. Sorry to that one. ๐Ÿ˜ญ

  • Dependencies: (core)

๐Ÿฆ‹ Command: LINE INPUT [[#] device-number,]["prompt string";] string-variable$

LINE INPUT [[#] device-number,]["prompt string";] string-variable$

LINE INPUT reads an entire line from the keyboard, a file, or a device, and drops it into string-variable$. โŒจ๏ธ

If the input is coming from the keyboard (stdin), then "prompt string" gets printed first so you know what you're being asked for. ๐Ÿซถ

And here's the difference from INPUT, which matters: LINE INPUT reads a whole line โ€” it does not stop early for comma-delimited data items. The line is the line, periodt. ๐Ÿšซ

  • Dependencies: COMMON_CMDS

โญ Command: LIST line[-line]

LIST lists program lines exactly as specified in its argument. Give it a range, get a range. ๐Ÿ“œ

  • Dependencies: INTERACTIVE

๐ŸŒˆ Command: LOAD file-name

LOAD loads an ASCII BASIC program into memory. ๐Ÿง โœจ

  • Dependencies: INTERACTIVE

๐Ÿ”ฅ Function: LOC( device-number )

LOC returns the next record that the GET or PUT statements are gonna use. It's the little peek at "where are we now." ๐Ÿ‘€

  • Dependencies: MS_FUNCS

๐Ÿงš Command: LOCATE line, column

LOCATE moves the cursor to a specified line and column. ๐Ÿ“

Currently (v2.10) implemented in bwx_iqc.c only.

  • Dependencies: IMP_IQC and IMP_CMDLOC

๐Ÿ“ Function: LOF( device-number )

LOF returns the length of a file in bytes โ€” the file being the one specified by device-number. ๐Ÿ“

  • Dependencies: MS_FUNCS

๐Ÿ‘‘ Function: LOG( number )

LOG returns the natural logarithm of the argument number. Math girlies rise ๐Ÿงฎ๐Ÿ’…

  • Dependencies: (core)

๐Ÿ’ซ Command: LOOP [UNTIL expression]

LOOP terminates a program loop โ€” go see DO for the whole situation. ๐Ÿ”

  • Dependencies: STRUCT_CMDS

๐Ÿ’– Command: LSET string-variable$ = expression

LSET string-variable$ = expression

LSET transfers data from expression over to the left-hand side of a string variable, or to a random access buffer field. ๐Ÿ“ฅ

  • Dependencies: COMMON_CMDS

๐Ÿซถ Command: MERGE file-name

MERGE adds program lines from file-name to the program already sitting in memory. ๐Ÿงฉ

Here's the tea: unlike LOAD, it does not clear the program currently in memory. Your existing code stays. That's the whole point.

  • Dependencies: COMMON_CMDS

๐ŸŽ€ Function: MID$( string$, start-position-in-string[, number-of-spaces ] )

MID$ returns a substring of string$, starting at start-position-in-string and continuing for number-of-spaces bytes. โœ‚๏ธโœจ

  • Dependencies: MS_FUNCS

๐ŸŒŸ Command: MKDIR pathname$

MKDIR creates a new directory path, exactly as specified by pathname$. New folder unlocked ๐Ÿ”“๐Ÿ“

  • Dependencies: UNIX_CMDS

๐Ÿ’… Function: MKD$( number )

Okay so MKD$, MKI$, and MKS$ are all equivalent in bwBASIC โ€” they're literally the same girl in three outfits. ๐Ÿ‘ฏ

They convert the numerical value number into a string that can be stored in a more compressed form in a file (especially for random file access, iykyk).

And since bwBASIC does not recognize differences in precision, these commands are effectively equivalent. So don't stress about which one you pick. ๐Ÿ˜Œ

  • Dependencies: MS_FUNCS

๐ŸŒธ Function: MKI$( number )

Equivalent to MKD$ (q.v.). Same thing, different name. ๐Ÿชž

  • Dependencies: MS_FUNCS

๐Ÿฆ‹ Function: MKS$( number )

Equivalent to MKD$ (q.v.). Yes, also the same. ๐Ÿ’ซ

  • Dependencies: MS_FUNCS

๐Ÿ”ฅ Command: NAME old-file-name AS new-file-name

NAME old-file-name AS new-file-name

NAME renames an existing file โ€” old-file-name becomes new-file-name. Glow-up complete. ๐Ÿ’ซ

  • Dependencies: UNIX_CMDS

๐Ÿ’€ Command: NEW

NEW deletes the program in memory and clears all the variables. Total reset. Everything gone. It's giving scorched earth. ๐Ÿ”ฅ๐Ÿšซ

  • Dependencies: INTERACTIVE

โญ Command: NEXT [counter-variable]

NEXT comes at the end of a FOR-NEXT loop โ€” go check FOR for the full picture. ๐Ÿ”

  • Dependencies: (core)

๐ŸŒˆ Function: OCT$( number )

OCT$ returns a string giving the octal (base 8) representation of number. Eight fingers energy. ๐Ÿ™

  • Dependencies: MS_FUNCS

๐Ÿงš Command: ON variable GOTO|GOSUB line[,line,line,...]

ON variable GOTO|GOSUB line[,line,line,...]

ON either branches (GOTO) or calls a subroutine (GOSUB) based on the rounded value of variable. ๐ŸŽฏ

So: if it's 1, the first line is called; if it's 2, the second line is called; etc. Pick-a-path but make it BASIC.

  • Dependencies: (core)

๐Ÿ“ Command: ON ERROR GOSUB line|label

ON ERROR sets up an error handling subroutine. When things go sideways, you've got a plan. ๐Ÿšจ

See also ERROR.

  • Dependencies: COMMON_CMDS, STRUCT_CMDS for labels

๐Ÿ‘‘ Command: OPEN

OPEN "O"|"I"|"R", [#]device-number, file-name [,record length]
     file-name FOR INPUT|OUTPUT|APPEND AS [#]device-number [LEN = record-length]

OPEN allocates random access memory so you can access a disk file or other device. ๐Ÿ’พโœจ

Important: two quite different forms of the OPEN statement are supported. Don't mix them up bestie.

In the first form:

  • "O" denotes sequential output
  • "I" denotes sequential input
  • "R" denotes random-access input and output
Note: those letters must be encased in quotation marks. Like, actually. "O" not O. ๐Ÿ’…

Once OPEN, any number of operations can be performed on a device โ€” go see WRITE #, INPUT #, PRINT #, etc.

  • Dependencies: COMMON_CMDS

๐ŸŽ€ Command: OPTION BASE number

OPTION BASE sets the lowest value for array subscripts โ€” either 0 or 1. Pick your lane. ๐Ÿ›ฃ๏ธ

  • Dependencies: (core)

๐Ÿ’œ Function: POS

POS returns the current cursor position in the line. ๐Ÿ“

  • Dependencies: COMMON_FUNCS

โœจ Command: PRINT [# device-number,][USING format-string$;] expressions...

PRINT [# device-number,][USING format-string$;] expressions...

PRINT outputs text to the screen, or to a file/device specified by device-number. ๐Ÿ–จ๏ธ

In the current implementation of bwBASIC, expressions to be printed must be separated by:

  • the comma โ€” tabbed output
  • the semicolon โ€” immediate sequential output
  • the plus sign โ€” immediate sequential output by string concatenation
Heads up: expressions separated by blanks or tabs are not supported. Sorry, no vibe-spacing your way through this one. ๐Ÿ˜ญ

If USING is specified, a bunch of formatting marks may appear in the format string: ๐ŸŽจ

  • ! โ€” prints the first character of a string
  • \ โ€” prints 2+x characters of a string, where x = the number of spaces between the backslashes
  • & โ€” variable-length string field
  • # โ€” represents a single digit in output format for a number
  • . โ€” decimal point in a number
  • + โ€” sign of a number (will output + or -)
  • - โ€” trailing minus after a number
  • ** โ€” fill leading spaces with asterisks
  • $$ โ€” output dollar sign in front of a number
  • ^^ โ€” output number in exponential format
  • _ โ€” output next character literally

As currently implemented, the exponential format will be that used by the C compiler. ๐Ÿ…ฒ

  • Dependencies: (core), COMMON_FUNCS for USING

๐ŸŒŸ Command: PUT [#] device-number [, record-number]

PUT [#] device-number [, record-number]

PUT outputs either the next available record or the record specified by record-number, to the file or device denoted by device-number. ๐Ÿ“ค

  • Dependencies: COMMON_CMDS

๐Ÿ’… Command: QUIT

(hold that thought bestie, the tea on QUIT is coming right upโ€ฆ)

โœจ Command: QUIT

okay so QUIT is literally just a synonym for SYSTEM โ€” same girl, different name ๐Ÿ’… when you're in the INTERACTIVE environment, she dips out of the program and hands you back to the operating system (or to whatever program called her in the first place).

  • Dependencies: INTERACTIVE

๐ŸŽฒ Command: RANDOMIZE number

RANDOMIZE seeds the random number generator (peep RND for the whole vibe ๐Ÿ‘€). Under bwBASIC you can hand her a 'number' seed straight from the TIMER function (q.v.) and she'll take it, no questions asked.

  • Dependencies: (core)

๐Ÿ“– Command: READ variable[, variable]...

READ pulls values out of DATA statements and drops them into the named variables, one by one, slay โœจ and here's the thing bestie โ€” the variable types in a READ statement must match the data types in the DATA statements as they are occurred. No mismatches, fr fr. See also DATA and RESTORE.

  • Dependencies: (core)

๐Ÿ’ฌ Command: REM string

REM is how you leave little notes to yourself inside a program ๐ŸŽ€ the way it's currently implemented, the entire line following REM gets ignored by the interpreter. So even if MULTISEG_LINES is set, a REM line will not be able to find a segment delimiter (":") followed by another line segment with a command. And heads up: bwBASIC does not currently implement the Microsoft-style use of the single quotation mark to denote remarks. not me hoping for it tho ๐Ÿ˜ญ

  • Dependencies: (core)

โช Command: RESTORE line

RESTORE resets the line and position counters for DATA and READ statements back to the top of the program file โ€” or to the beginning of the line you specified. (Currently this must be a line number.)

  • Dependencies: (core)

โ†ฉ๏ธ Command: RETURN

RETURN wraps up a subroutine that got called by GOSUB. cute and simple, we love her ๐Ÿซถ

  • Dependencies: (core)

โœ‚๏ธ Function: RIGHT$( string$, number-of-spaces )

RIGHT$ returns a substring of string$ with number-of-spaces taken from the right (the end) of the string. As implemented under bwBASIC, it cannot be used for assignment โ€” read only, bestie, no take-backs ๐Ÿ’€

  • Dependencies: MS_FUNCS

๐Ÿ—‘๏ธ Command: RMDIR pathname

RMDIR deletes the directory path indicated by pathname. gone, bye, no notes โœจ

  • Dependencies: UNIX_CMDS

๐ŸŽฐ Function: RND( number )

RND returns a pseudo-random number. The 'number' value is ignored by bwBASIC if you supply one (so don't stress about it, she does her own thing). The RANDOMIZE command (q.v.) reseeds the random-number generator.

  • Dependencies: (core)

โžก๏ธ Command: RSET string-variable$ = expression

RSET transfers data from expression over to the right-hand side of a string variable or a random access buffer field. right-aligning, main character energy ๐Ÿ‘‘

  • Dependencies: COMMON_CMDS

๐Ÿƒ Command: RUN [line][file-name$]

RUN executes the program in memory. If you supply a file-name$, that specified file gets loaded into memory and executed instead. And if you supply a line number, execution begins at that line. chef's kiss, let's gooo ๐Ÿ”ฅ

  • Dependencies: INTERACTIVE

๐Ÿ’พ Command: SAVE file-name$

SAVE writes the program in memory out to file-name$. Heads up: bwBASIC only saves files in ASCII format โ€” that's the only flavor on the menu ๐Ÿ“

  • Dependencies: INTERACTIVE

๐ŸŽฏ Command: SELECT CASE expression

SELECT CASE kicks off a multi-line conditional selection statement. The expression you hand to SELECT CASE gets evaluated by the CASE statements that follow, and the whole thing wraps up with an END SELECT statement.

As currently implemented, CASE statements may be followed by string values, but in this case only simple comparisons (equals, not equals) can be performed. so keep it basic, bestie ๐Ÿ’…

  • Dependencies: STRUCT_CMDS

โž• Function: SGN( number )

SGN returns the sign of the argument number: +1 for positive numbers, 0 for 0, and -1 for negative numbers. she's just out here judging numbers, respectfully ๐ŸŒˆ

  • Dependencies: (core)

๐ŸŒŠ Function: SIN( number )

SIN returns the sine of the argument number, in radians. trig girlies rise ๐Ÿ™ˆ

  • Dependencies: (core)

โฃ Function: SPACE$( number )

SPACE$ returns a string of blank spaces number bytes long. silence, but make it intentional โœจ

  • Dependencies: MS_FUNCS

โฃ Function: SPC( number )

SPC returns a string of blank spaces number bytes long. yes she's basically SPACE$'s twin, they're both iconic ๐Ÿ’–

  • Dependencies: MS_FUNCS

๐Ÿงฎ Function: SQR( number )

SQR returns the square root of the argument number. math ate, no cap ๐Ÿ“

  • Dependencies: (core)

๐Ÿ›‘ Command: STOP

STOP interrupts program execution. As implemented under bwBASIC, STOP issues a SIGINT signal โ€” so yeah, she's serious about it ๐Ÿ˜ญ

  • Dependencies: (core)

๐Ÿ”ข Function: STR$( number )

STR$ returns a string giving the decimal (base 10) representation of the argument number. numbers to letters, the transformation we deserve ๐Ÿ’…

  • Dependencies: COMMON_FUNCS

๐Ÿ” Function: STRING$( number, ascii-value|string$ )

STRING$ returns a string number bytes long, consisting of either the first character of string$ or the character answering to the ASCII value ascii-value. pick your fighter, both valid ๐ŸŽ€

  • Dependencies: MS_FUNCS

๐Ÿงฉ Command: SUB subroutine-name

SUB introduces a named, multi-line subroutine. You call it with a CALL statement, and it wraps up with an END SUB statement. organized queen behavior ๐Ÿ‘‘

  • Dependencies: STRUCT_CMDS

๐Ÿ”„ Command: SWAP variable, variable

SWAP swaps the values of two variables. The two variables must be of the same type (either numerical or string) โ€” no mixing, bestie, that's the rule ๐Ÿšซ

  • Dependencies: COMMON_CMDS

๐Ÿšช Command: SYSTEM

SYSTEM exits from bwBASIC to the calling program or (more usually) straight to the operating system. she's leaving, and honestly, she earned it ๐Ÿฆ‹

  • Dependencies: INTERACTIVE

๐Ÿ“ Function: TAB( number )

TAB outputs spaces until the column indicated by number has been reached. lining things up like the perfectionist she is โœจ

  • Dependencies: (core)

๐Ÿ“ Function: TAN( number )

TAN returns the tangent of the argument number, in radians. more trig, we stay fed ๐ŸŒธ

  • Dependencies: (core)

๐Ÿ• Function: TIME$

TIME$ returns the current time based on the computer's internal clock, as a string in the form "HH-MM-SS". As implemented under bwBASIC, TIME$ cannot be used for assignment (i.e., to set the system time) โ€” she tells time, she doesn't take orders ๐Ÿ’…

Note: bwBASIC presently (v2.10) does not allow assignment to a function.
  • Dependencies: COMMON_FUNCS

โฑ๏ธ Function: TIMER

TIMER returns the time in the system clock in seconds elapsed since midnight. perfect for seeding stuff, iykyk ๐ŸŽฐ

  • Dependencies: MS_FUNCS

๐Ÿ”‡ Command: TROFF

TROFF turns off the trace facility; see TRON. we're done snooping, periodt ๐Ÿ’€

  • Dependencies: COMMON_CMDS

๐Ÿ”Š Command: TRON

TRON turns on the trace facility. This facility prints each line number in square brackets as the program is executed, which is genuinely so useful in debugging programs with line numbers ๐Ÿ‘€ To debug an unnumbered program with TRON, call DO NUM first โ€” but remember to call DO UNNUM before you save the program later. don't forget bestie, I'm begging ๐Ÿ™ˆ

  • Dependencies: COMMON_CMDS

๐Ÿ”ค Function: VAL( string$ )

VAL returns the numerical value of string$. string to number pipeline, immaculate ๐Ÿ’œ

  • Dependencies: COMMON_FUNCS

๐Ÿ” Command: VARS

VARS is a debugging command which prints a list of all variables defined that have global scope. peek behind the curtain, queen ๐ŸŽ€

  • Dependencies: DEBUG

๐Ÿ”š Command: WEND

WEND concludes a WHILE-WEND loop; see WHILE. the end, literally ๐Ÿ’…

  • Dependencies: COMMON_CMDS

๐Ÿ” Command: WHILE expression

WHILE initiates a WHILE-WEND loop. The loop ends with WEND, and execution reiterates through the loop as long as the expression is TRUE (-1). keep going until it's not, that's the whole vibe โœจ

  • Dependencies: COMMON_CMDS

๐Ÿ“ Command: WIDTH [# device-number,] number

WIDTH sets screen or device output to number columns. device-number specifies the device or file for output. formatting her own little world ๐ŸŒˆ

  • Dependencies: COMMON_CMDS

โœ๏ธ Command: WRITE [# device-number,] element [, element ]....

WRITE outputs variables to the screen, or to a file or device specified by device-number. Commas are inserted between the expressions output, and strings are enclosed in quotation marks. tidy, predictable, iconic ๐Ÿ’–

  • Dependencies: COMMON_CMDS

๐Ÿ’– 6. PREDEFINED VARIABLES ๐Ÿ’–

okay so bwBASIC comes with four preset variables already in the bag, no setup needed:

  • BWB.EDITOR$
  • BWB.FILES$
  • BWB.PROMPT$
  • BWB.IMPLEMENTATION$

The commands EDIT and FILES are pseudo-commands โ€” they literally just launch shell programs whose names live inside BWB.EDITOR$ and BWB.FILES$. The default values for these two can be changed in bwbasic.h (look for DEF_EDITOR and DEF_FILES), or you can change them on the fly yourself. cute idea the page suggests: initialize them in "profile.bas" for specific implementations. like, BWB.FILES$ could be defined as "ls -l" on Unix systems, or "dir" on DOS systems. โœจ

The preset variable BWB.PROMPT$ sets the prompt string for bwBASIC. again, the suggestion is that you set up your own prompt in a "profile.bas" so it gets initialized every single time bwBASIC starts. and note โ€” you can add special characters to the prompt string, like this:

BWB.PROMPT$ = "Ok"+CHR$(10)

that gives you an "Ok" prompt followed by a linefeed. iconic. ๐Ÿ’…

The preset variable BWB.IMPLEMENTATION$ returns "TTY" for the bwx_tty implementation, and returns "IQC" for the IBM PC or Compatibles with QuickC (bwx_iqc) implementation. this is lowkey useful for figuring out which commands and functions โ€” specifically CLS, LOCATE, and INKEY$ โ€” might actually be available to you. ๐Ÿ‘‘


๐Ÿฆ‹ 7. UNIMPLEMENTED COMMANDS AND FUNCTIONS, and AGENDA FOR DEVELOPMENT ๐Ÿฆ‹

ngl, there are some things that aren't implemented that have been part of standard BASICs for SO long that their absence is gonna seem surprising. but in every single case, implementing them would require operating-system-specific functions or terminal-specific functions that just can't be universally provided. some specific examples:

  • CLOAD โ€” relies on CP/M or MSDOS conventions for binary executable files. ๐Ÿ’€
  • CONT โ€” see RESUME below (programmer ignorance?).
  • DEF USR โ€” relies on CP/M or MSDOS conventions for binary executable files.
  • FRE() โ€” the ability to report how much free memory is remaining is system-specific, because memory allocation and access patterns vary. so that ability isn't present in ANSI or earlier versions of C, and this function is not available in bwBASIC.
  • INPUT$() โ€” 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 C alone.
  • LLIST โ€” see LPRINT below.
  • LPOS โ€” see LPRINT below.
  • LPRINT โ€” and LLIST, etc., require access to a printer device, and that 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 the author is 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. instead, bwBASIC uses DO NUM and DO UNNUM.
  • RESUME โ€” is this possible under C? if so, the author simply has 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.

There are other commands, functions, and implementation details that the author is working on, and which are on the agenda list for future versions of bwBASIC. these agenda include:

  • PARACT โ€” i.e., the ability to execute PARallel ACTions. this is described in ANSI BASIC, although the author has not seen it implemented before. it will offer a rough, non-preemptive form of multitasking within the scope of a BASIC program. programmers will note points at which there are already hooks for PARACT in bwBASIC.
  • XMEM โ€” PC-type computers need to be able to use extended memory. if we could use extended memory for program lines, variables, and function definitions, we could write much longer programs. this would entail, however, a fairly serious rewriting of the program to utilize memory handles for these storage features instead of direct memory pointers.
  • Windows โ€” the addition of memory handles in addition to the non-preemptive execution of program lines (in a crude form, already present) will make it possible to develop implementations for Windows and perhaps for other graphical user interfaces. but what form should this take? the author presently has in mind a BASIC that would run in the background, appearing only as an icon in the GUI space, with pop-up editors and output windows. thus, the interpreted language would serve a purpose something like 'cron' (a task scheduler) under Unix systems. you may have some reflections that would help with this. ๐Ÿซถ
  • Graphics โ€” here we face fairly critical differences in different styles and implementations of graphics, e.g., between GWBASIC, ANSI BASIC, VisualBASIC, etc. but it's possible that Graphics commands and functions could be added. these would all be implementation-specific.

The ANSI Standard for full BASIC does not specify which particular commands or functions must be implemented, and in fact the standard is very robust. perhaps no implementation of BASIC would ever include all of the items, but some ANSI commands and functions which remain unimplemented are:

  • ACCESS
  • ANGLE
  • AREA
  • ARITHMETIC
  • ARRAY
  • ASK
  • BSTR
  • BVAL
  • CEIL
  • CELLS
  • CLIP
  • COLLATE
  • CONNECT
  • COSH
  • DATUM
  • DEBUG
  • DECIMAL
  • DECLARE
  • DEGREES
  • DEVICE
  • DISCONNECT
  • DISPLAY
  • DOT
  • DRAW
  • ERASE
  • EVENT
  • EXCEPTION
  • GRAPH
  • HANDLER
  • IMAGE
  • KEY
  • LCASE
  • LINES
  • LOG10
  • LOG2
  • MAT
  • MIX
  • MULTIPOINT
  • OUTIN
  • OUTPUT
  • PARACT
  • PICTURE
  • PIXEL
  • PLOT
  • POINTS
  • RADIANS
  • RECEIVE
  • RENUMBER
  • REWRITE
  • ROTATE
  • ROUND
  • SEIZE
  • SEND
  • SHIFT
  • SINH
  • TANH
  • TIMEOUT
  • TRACE
  • TRANSFORM
  • TRUNCATE
  • UBOUND
  • UCASE
  • VIEWPORT
  • WAIT
  • VIEWPORT
  • ZONEWIDTH

(yes, VIEWPORT is in there twice. we don't make the rules bestie, we just keep the list exactly as it is ๐Ÿ’œ)


๐ŸŒธ 8. THE STORY OF BYWATER BASIC ๐ŸŒธ

okay this part is genuinely the most main character backstory ever and you're not ready. this program was originally begun in 1982 by the author's 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 even though the author's grandfather (Lockwood Spell) had bought an IBM PC with 256k of RAM, grandmother would not use it โ€” paraphrasing George Herbert to the effect that "He who cannot in 64k program, cannot in 512k." ๐Ÿ˜ค absolute icon behavior.

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. so, the author reckons, 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. ๐Ÿ˜ญ

the author 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. it has been revised slightly prior to this release. and you should know, though โ€” as the author says it โ€” that "I myself am an historian, not a programmer." periodt. ๐Ÿ’–


๐ŸŽ€ 9. COMMUNICATIONS ๐ŸŽ€

wanna slide into the inbox? here's the deets:

  • email: tcamp@delphi.com

and that's the whole page bestie, you made it to the end ๐Ÿฅณ this was BWBASIC(1), dated October 11, 1993 โ€” so go forth, write some BASIC, set your BWB.PROMPT$ to something cute, and remember: she who cannot in 64k program, cannot in 512k. ๐Ÿ’…โœจ๐Ÿฆ‹