Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
MBASIC
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Features == === Language system === MBASIC is an [[BASIC interpreter|interpreter]]. Program source text was stored in memory in tokenized form, with BASIC keywords replaced by one-byte tokens which saved memory space and speeded execution. Any line prefixed with a line number was stored as program text; BASIC statements not prefixed with a line number were executed immediately as commands. Programs could be listed on the screen for editing, or saved to disk in either a [[data compression|compressed]] binary format or as plain [[ASCII]] text. Every source line was identified with a number, which could be used as the target of a [[GOTO]] or [[GOSUB]] transfer. Only line editing commands were provided.<ref>CP/M products providing full-screen editing support required their own installation routines to customize the software for the specific [[computer terminal]] used as the system console. No support was provided within CP/M to standardize terminal capabilities.</ref> It was often beneficial to save a program as plain text and edit it with a full featured editor. Program text, [[Variable (computer science)|variables]], [[disk buffer]]s and the CP/M operating system itself all had to share the 64 kilobyte address space of the [[Intel 8080|8080]] processor. Typically when first starting MBASIC there would be less than 32 kB memory available for programs and data, even on a machine equipped with a full 64 kilobytes of RAM. Comment lines, prefixed with the <code> REM </code> keyword or an apostrophe, could be placed in the program text but took up valuable memory space, which discouraged BASIC users from fully documenting their code. To allow larger and more complex programs to be run, later versions of MBASIC supported functions that allowed portions of program text to be read in and executed under program control (the "[[chain loading|<code> CHAIN </code>]]" and <code> MERGE </code> statements). No support for "shell" command execution was provided, though this functionality could be duplicated by a determined programmer. A particular advantage of MBASIC was the full-text error messages provided for syntax and run-time errors. MBASIC also had a "trace" function that displayed line numbers as they were executed. While this occupied the same screen space as normal program output, it was useful for detecting conditions such as [[endless loop]]s. === Files and input/output === Data could be read and stored to disk as either sequential files (delimited by the CP/M convention of [[carriage return|CR]]/[[line feed|LF]] at the end of each line) or else as fixed-record-length random access files, which, given a sufficiently determined programmer, could be used to perform database-type record manipulation. The [[Microsoft Binary Format]] for [[floating point]] numbers was proprietary to the implementation, which meant that data could only be interchanged with other programs using ASCII text representation or else with extensive programming to convert the binary format. === Variables and data types === MBASIC supported the following data types: * 8-bit character data, in strings of length 0 to 255 characters; * 16-bit [[integer]]s; * 32-bit [[floating point]] (single precision), equivalent to six decimal digits, with a two-digit exponent; * 64-bit floating point (double precision), equivalent to sixteen decimal digits, with a two-digit exponent. String operators included substring selection, concatenation, assignment, and testing for equality. Arrays of the above types were allowed with up to 7 dimensions, but no functions or operators worked on arrays; for example, there was no assignment of arrays. Unlike some other BASIC implementations of the time, MBASIC did not provide support for [[matrix (mathematics)|matrix]] operations, [[complex number]]s, or a [[binary-coded decimal|decimal (BCD)]] data type for financial calculations. All floating point operations were carried out in software since typical CP/M systems did not have [[floating-point unit|floating point hardware]]. The built-in mathematics functions ([[sine and cosine|sine, cosine]], [[tangent]], [[natural logarithm|natural log]], [[exponential function|exponential]], [[square root]]) only gave single precision results. A software [[pseudorandom number generator]] was provided; this relied on the user to key in a seed number to obtain a sequence of numbers useful for games and some simulations. MBASIC permitted but did not require the <code> LET </code> keyword for assignment statements. Early versions of BASIC on [[microcomputer]]s were infamous for one- or two-character variable names, which made the meanings of variables difficult to recall in complex programs. MBASIC version 5 allowed identifiers up to 40 characters long, which permitted programmers to give variables readable names. === Program flow control === Program flow control in MBASIC was controlled by <code> IF...THEN...ELSE... </code> conditional tests, <code> WHILE...WEND </code> loops, and <code> GOTO </code> and <code> GOSUB </code> instructions. No <code> CASE </code> statement was available, although an <code> ON...GOTO... </code>(computed GOTO) provided multi-way branches. Subroutines had no parameters and all variables were global. MBASIC did not make [[structured programming]] mandatory for programmers and it was easy to write [[spaghetti code]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)