Skip to content

Instantly share code, notes, and snippets.

@paulguy
Created October 7, 2023 01:34
Show Gist options
  • Save paulguy/fafe94419a9f48e8d8e9bce1aa4e7726 to your computer and use it in GitHub Desktop.
Save paulguy/fafe94419a9f48e8d8e9bce1aa4e7726 to your computer and use it in GitHub Desktop.
MK-90 BASIC Quick Reference
EDITING KEYS:
<- : move left
-> : move right
СУ + A : go to beginning of the line
СУ + B : go to previous word
СУ + E : clear line from cursor to end
СУ + F? : go to next word
СУ + X : go to end of the line
COMMANDS:
AUTO [start line],[step]
Auto-renumber lines starting at a specific point (or beginning of the program)
with a given step (or 10).
DELETE <start>,[end]
Delete a line or a range of lines from start to end.
EDIT <line>
Fetch a line to edit. See: EDITING KEYS
HELP <topic>
Get help on a topic, or * for help on all commands and functions
LIST <start>,[end]
List a line or lines from the program.
MEM
Get used and free(СВОБОДНО) memory in bytes.
INIT "[device:]"
Initialize a SMP/MPO cartridge (СМ0:/СМ1:). By default, the working
device.
SAVE "[device:]<file>"
Save program to named file on a named device, or to the working device.
NAME "<device:><old filename>" AS "<device:><new filename>"
Rename a file from old filename to new filename. Cannot be used to copy files
from device to device.
LOAD "[device:]<filename>"[,R]
Load a file from a device or the working device, if ",R" is appended, the
program is run immediately after loading.
KILL "[device:]<filename>"
Delete a file from a device or the working device.
DEV "[device:]"
Specify working device or СМ0:.
FILES "[device:][filename]"
List files or a file from a device or the working device.
RUM
Run the program. СУ + P to stop.
BASIC COMMANDS:
DEF FN <letter>(<arg>)=<expression>
Define a function named by a letter given 1 argument.
DIM <name>(<dimension 1>[,<dimension 2>])[,...]
Allocate memory assigned to name, name may be 1 or 2 characters long, any
dimension may be up to 255 and total size may be up to 1960. Multiple may be
given.
END
Indicate the end of the program.
FOR <name>=<start> TO <end> [STEP <step>]
NEXT <name>
Execute a loop between FOR and next with name starting at start, incrementing
until end, optionally by step.
GOSUB <line>
RETURN
Branch execution to line, returning to the next instruction after returning.
GOTO <line>
Continue execution at line, no return.
IF <boolean expression> <THEN <statement> | THEN <line> | GOTO <line>>
Evaluate a boolean expression (=, <, <=, >, >=, <>) and either evaluate a
statement, or continue execution at a line. As an odd quirk, variables with
the letter 'T' can't be used here.
INPUT <variable>[, ...]
Request user input in to a variable, multiple may be given.
LET <name>=<expression>
Evaluate an expression and assign its value to name.
PRINT ...
Print a number or text, items are separated by ";", or "," to format like a
table. An item may start with angle brackets containing a formatting command,
which may be one of S, Q, Y, Z, N or P.
S takes 2 arguments like <Sx,y> for width and height of the characters,
from 1-3.
Q takes 1 argument to indicate orientation: 0 - towards the right,
1 - downward, 2 - towards the left, 3 - upward.
Z takes 2 arguments like <Zx,y> for space between symbols and lines. Applies
until the end of the print statement.
N inverts text.
P makes text non-inverted.
DATA <value>[, ...]
READ <name>[, ...]
RESTORE
Provide data to be used by the program by reading it sequentially in to
variables. RESTORE to start at the first entry.
REM
Leave a remark/comment.
RANDOMIZE
Seed random number state.
CLS
Clear screen.
DRAW O<x>,<y>
Set the current position.
DRAW H<x>,<y>
Place a dot.
DRAW D<x1>,<y1>,<x2>,<y2>
Draw a line.
DRAW E<x>,<y>
Erase a dot.
DRAW I<x>,<y>[, ...]
Draw a line from the current position to a new position, and optionally
additional positions.
DRAW A<x1>,<y1>,<x2>,<y2>
Draw a box given 2 opposite corners.
DRAW X<direction>,<length of a division>,<divisions>
Draw an axis in one of 4 directions starting from the current position:
0 upward, 1 rightward, 2 downward, 3 leftward.
Each division will be marked and the distance between them can be given.
DRAW G<direction>,<width>,<height>[,<spacing>]
Draw hatching in a given direction: 0 - no hatching, 1 - horizontal,
2 - vertical
For a given width or height starting from the current position, with a given
spacing between each line
DRAW C<x>,<y>,<radius>
Draw a circle centered at x,y with a given radius.
DRAW M<hex octet>[...]
Draw 8 pixels starting from the current position, then advance the position 1
line, when the bottom of the screen is reached, advance to the top of the
screen 8 pixels over. The pixels drawn will be the binary representation of
the hex byte given.
LOCATE <x>,<y>
Set the cursor position in pixels.
STOP
Stop execution.
DIS
Restore command line? Mentions for use after using graphics commands.
WAOT <0-32536>
Delay some amount of time, maximum value is said to be about .1 milliseconds.
No idea what this is based on as this would require something like 325Mhz
timing precision...
PLAY <tone>,<length>
Play a tone, given as a number 0-40 for some length, I don't know what scale
either of these numbers are in.
BASIC FUNCTIONS:
SIN(x), COS(x) - Get sine/cosine of angle in radians.
ATAN(x) - Get arctangent of x.
LOG(x) - Get logarithm of x.
EXP(x) - Not sure, something about log e?
ABS(x) - Absolute value of x.
INT(x) - x converted to integer, always rounded down (negatives _away_ from 0)
INC - Code of pressed key.
SGN(x) - Sign of x, x < 0 : -1, x = 0 : 0, x > 0 : 1
SQR(x) - Square root of x.
RND(x) - Get a random number, the argument doesn't matter but must be given.
PI - pi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment