mk90.basic

Example programs

Complete listings for arithmetic, control flow, files, display and timing.

Using the examples

The HTML package includes five complete ASCII BAS files under examples/. They illustrate the supported dialect and may be compiled once present on a writable MKS2 volume. The manual archive itself is not an SMP filesystem image.

The boot ROM includes its own demo.bas, so the first trial needs no file-transfer utility. The current physical key mapping cannot produce every BASIC operator; see keyboard limitations. This release does not have a UART transfer command.

Count and beep

Download hello.bas

10 CLS
20 FOR I=1 TO 5
30 PRINT "MK90 ";I
40 BEEP
50 WAIT 8
60 NEXT I
70 END

Arithmetic and a subroutine

Download math.bas

10 A=2+3*4
20 B=-17/5
30 C=-17 MOD 5
40 PRINT A;",";B;",";C
50 GOSUB 80
60 PRINT A
70 END
80 A=A+1
90 RETURN

Write and read three bytes

Download files.bas

10 OPEN "letters",OUTPUT,3
20 PUT 65:PUT 66:PUT 67
30 CLOSE
40 OPEN "letters",INPUT
50 IF EOF THEN 90
60 GET A
70 PRINT A
80 GOTO 50
90 CLOSE
100 END

Graphics and the RTC

Download screen.bas

10 CLS
20 LINE 0,12,119,12
30 LOCATE 0,0
40 PRINT "TIME ";HOUR;":";MINUTE;":";SECOND
50 PSET 60,40
60 WAIT 16
70 PRESET 60,40
80 BEEP
90 END

Nested loops and conditional branching

Download loops.bas

10 A=0
20 FOR I=1 TO 3
30 FOR J=2 TO 1 STEP -1
40 A=A+I*J
50 NEXT J
60 NEXT I
70 IF A=18 THEN 100
80 PRINT "UNEXPECTED"
90 END
100 PRINT "TOTAL ";A
110 END

Expected results

ExampleResult
hello.basFive MK90 lines and five short beeps.
math.bas14,-3,-2 followed by 15.
files.basCreates/replaces letters with bytes 65, 66, 67; reads and prints them.
screen.basDraws a line, displays RTC components, briefly lights a pixel and beeps.
loops.basPrints TOTAL 18.