mk90.basic
MBC-16 BASIC reference
The complete implemented integer dialect, without assuming factory-BASIC compatibility.
Compile and execute
mbc name.bas
exec name.mbxBoth the compiler and runtime execute on the MK90. The compiler produces MBX1 bytecode with resolved expressions and branches. The runtime is native PDP-11 code; it does not need the original source while running.
Language chapters
Statement summary
| Statement | Synopsis | Description |
|---|---|---|
| BEEP | BEEP | Play the standard short buzzer tone. |
| CLOSE | CLOSE | Close the currently open data file. |
| CLS | CLS | Clear the complete LCD framebuffer and text console. |
| DATA | DATA signed-integer [, signed-integer ...] | Embed numeric constants for sequential READ. |
| DIM | DIM array(upper-bound) | Allocate a zero-based integer array. |
| ELSE | ELSE | Begin the alternative branch of a structured IF. |
| END | END | Terminate the program and return to the shell. |
| ENDIF | ENDIF | Close the innermost structured IF. |
| FOR | FOR variable = start TO limit [STEP increment] | Start a counted integer loop. |
| GET | GET variable | Read one byte from the open INPUT file. |
| GOSUB | GOSUB line-number | Call a numbered subroutine. |
| GOTO | GOTO line-number | Continue execution at a numbered source line. |
| IF | IF expression THEN line-number | Select a numbered destination or a structured block. |
| INPUT | INPUT variable | Read one signed decimal integer from the keyboard. |
| LET | [LET] variable = expression | Assign an integer to one variable. |
| LINE | LINE x1, y1, x2, y2 | Draw a monochrome segment between two pixel coordinates. |
| LOCATE | LOCATE column, row | Set the text cursor position. |
| NEXT | NEXT variable | Advance and test the innermost active FOR loop. |
| OPEN | OPEN "path",INPUT | Open the program’s one regular data file. |
| PRESET | PRESET x, y | Turn off one LCD pixel. |
PRINT [item { separator item }] [separator] | Print literal text and integer expressions. | |
| PSET | PSET x, y | Turn on one LCD pixel. |
| PUT | PUT expression | Write one byte to the open OUTPUT file. |
| RANDOMIZE | RANDOMIZE expression | Set the pseudo-random generator seed. |
| READ | READ destination [, destination ...] | Read the next numeric DATA items. |
| REM | REM comment | Ignore the rest of a physical source line. |
| REPEAT | REPEAT | Start a loop whose body executes at least once. |
| RESTORE | RESTORE | Rewind READ to the first DATA item. |
| RETURN | RETURN | Resume after the most recent active GOSUB. |
| SOUND | SOUND divisor, cycles | Drive the buzzer with raw controller parameters. |
| STOP | STOP | Terminate the program and return to the shell. |
| UNTIL | UNTIL expression | Close a REPEAT loop and test its exit condition. |
| WAIT | WAIT ticks | Sleep cooperatively for an RTC-tick interval. |
| WEND | WEND | Close the innermost WHILE loop. |
| WHILE | WHILE expression | Repeat while a condition is nonzero. |
Expression-function summary
| Function / value | Syntax | Description |
|---|---|---|
| ABS | ABS(expression) | Absolute value in signed 16-bit arithmetic. |
| EOF | EOF | Test the open INPUT data file for end-of-file. |
| HOUR | HOUR | Read the RTC hour component. |
| INKEY | INKEY | Poll one translated keyboard event. |
| MINUTE | MINUTE | Read the RTC minute component. |
| RND | RND(limit) | Return a bounded pseudorandom integer. |
| SECOND | SECOND | Read the RTC second component. |
| TICKS | TICKS | Read the OS RTC tick counter. |
Dialect boundary
MBC-16 is our structured integer BASIC dialect. It provides signed 16-bit scalars and arrays, literal strings, nested control blocks and inline numeric data. It does not claim compatibility with the factory BASIC or a standard BASIC certification. Unsupported syntax is rejected rather than ignored. The factory FK table can insert words which this dialect does not implement.