MBASIC: Difference between revisions

Content deleted Content added
m more specific category
mNo edit summary
Line 2:
 
== Environment ==
 
MBASIC version 5 required a CP/M system with at least 28 kB of [[random access memory]] (RAM) and at least one diskette drive.
 
Line 15 ⟶ 14:
Program text, variables, disk buffers and the CP/M operating system itself all had to share the 64 kilobyte address space of the 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 ===
Line 36 ⟶ 34:
=== 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]].
 
 
== PEEKs, POKEs, and user functions ==
 
No discussion of BASICs on the 8-bit computers of the late '70s and early '80s would be complete without mentioning the importance of the [[PEEK and POKE]] functions for directly reading and writing to memory. Since these systems typically had no [[memory protection]], this allowed a programmer to access portions of the operating system, or functions that would not otherwise be available. Of course this also provided unlimited opportunities for user programs to hang the system. For example, a CP/M programmer might use a <code> POKE </code> function to allow BASIC to switch the console device to the serial port, if the system [[BIOS]] supported this. For machines with real-time clocks, a set of <code>PEEK</code> instructions might have been used to access the time.
 
Line 47 ⟶ 43:
 
== Successors to MBASIC ==
 
Microsoft also sold a CP/M BASIC [[compiler]] (known as BASCOM) which used a similar source language to MBASIC. A program debugged under MBASIC could be compiled with BASCOM. Since program text was no longer in memory and the run-time elements of the compiler were smaller than the interpreter, more memory was available for user data. Speed of program execution increased by 8 to 10 fold.
 
Line 53 ⟶ 48:
 
== Importance of MBASIC ==
 
MBASIC was an important tool during the era of 8-bit CP/M computers. Skilled users could write routines in MBASIC to automate tasks that in modern-day systems would be performed by powerful application program commands or scripting languages. Exchange of useful MBASIC programs was a common function of computer [[users' group]]s. Keying in long BASIC listings from a magazine article was one way of "bootstrapping" software into a new CP/M system. At least one compiler for a high-level language was written in MBASIC, and many small games and utility programs ranging from a few lines to a few thousand lines of code were written.
 
Line 60 ⟶ 54:
 
== References ==
{{Reflist}}
 
{{Refbegin}}
<references/>
 
* Thom Hogan and Mike Iannamico, ''Osborne 1 User's Reference Guide'',(1982) Osborne Computer Corporation
* David A. Lien, ''The BASIC Handbook'', 2nd Edition Encyclopedia of the BASIC Computer Language",(1981), Compusoft Publishing
* ''BASIC 80 Reference Manual'', Microsoft Corporation, no date
{{Refend}}
 
[[Category:CP/M software]]