mk90.basic

MBC-16 BASIC reference

The complete implemented integer dialect, without assuming factory-BASIC compatibility.

Compile and execute

mbc name.bas
exec name.mbx

Both 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

StatementSynopsisDescription
BEEPBEEPPlay the standard short buzzer tone.
CLOSECLOSEClose the currently open data file.
CLSCLSClear the complete LCD framebuffer and text console.
DATADATA signed-integer [, signed-integer ...]Embed numeric constants for sequential READ.
DIMDIM array(upper-bound)Allocate a zero-based integer array.
ELSEELSEBegin the alternative branch of a structured IF.
ENDENDTerminate the program and return to the shell.
ENDIFENDIFClose the innermost structured IF.
FORFOR variable = start TO limit [STEP increment]Start a counted integer loop.
GETGET variableRead one byte from the open INPUT file.
GOSUBGOSUB line-numberCall a numbered subroutine.
GOTOGOTO line-numberContinue execution at a numbered source line.
IFIF expression THEN line-numberSelect a numbered destination or a structured block.
INPUTINPUT variableRead one signed decimal integer from the keyboard.
LET[LET] variable = expressionAssign an integer to one variable.
LINELINE x1, y1, x2, y2Draw a monochrome segment between two pixel coordinates.
LOCATELOCATE column, rowSet the text cursor position.
NEXTNEXT variableAdvance and test the innermost active FOR loop.
OPENOPEN "path",INPUTOpen the program’s one regular data file.
PRESETPRESET x, yTurn off one LCD pixel.
PRINTPRINT [item { separator item }] [separator]Print literal text and integer expressions.
PSETPSET x, yTurn on one LCD pixel.
PUTPUT expressionWrite one byte to the open OUTPUT file.
RANDOMIZERANDOMIZE expressionSet the pseudo-random generator seed.
READREAD destination [, destination ...]Read the next numeric DATA items.
REMREM commentIgnore the rest of a physical source line.
REPEATREPEATStart a loop whose body executes at least once.
RESTORERESTORERewind READ to the first DATA item.
RETURNRETURNResume after the most recent active GOSUB.
SOUNDSOUND divisor, cyclesDrive the buzzer with raw controller parameters.
STOPSTOPTerminate the program and return to the shell.
UNTILUNTIL expressionClose a REPEAT loop and test its exit condition.
WAITWAIT ticksSleep cooperatively for an RTC-tick interval.
WENDWENDClose the innermost WHILE loop.
WHILEWHILE expressionRepeat while a condition is nonzero.

Expression-function summary

Function / valueSyntaxDescription
ABSABS(expression)Absolute value in signed 16-bit arithmetic.
EOFEOFTest the open INPUT data file for end-of-file.
HOURHOURRead the RTC hour component.
INKEYINKEYPoll one translated keyboard event.
MINUTEMINUTERead the RTC minute component.
RNDRND(limit)Return a bounded pseudorandom integer.
SECONDSECONDRead the RTC second component.
TICKSTICKSRead 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.