Pico BASIC Interpreter for MK14

Written by J.G. Seal, originally published in Computing Today April 1980 . Download from here

BASIC on an MK14, you must be joking ! Well here it is in all its glory to show you the way.

I bought an MK14 kit at the beginning of 1979. After assembly it worked first time, and I went on to spend many happy hours familiarising myself with the programming code. I am a teacher, and it rapidly became clear to me that here was a machine that had great possibilities as an aid to the teaching of computing, in its early stages, but that there were three major problems which would have to be overcome :-

  1. The Keyboard was very inefficient
  2. The display was much too small, especially as I wished to demonstrate what was happening to a group of pupils. However, I did not want to go to the expense of a VDU display system.
  3. The available RAM was inadequate for something which it seemed to me would make the computer even more useful - the implementation of a High level number processing language

As a first step towards overcoming these problems, I replaced the keyboard with a set of small push switches (Maplin Ref FF87U) the pins of which fitted exactly the holes in the PCB. However, I still got double bounce errors, and only overcame these when I removed from each switch the snap washer which gave it its "click effect".

Next, I replaced the miniature LED display strip with a display made up on a piece of Veroboard from eight 0.3 inch LED digits. This gave a readout which is easily viewed by several people at once.

Finally, I installed 1.5k of additional RAM, addressed as indicated in the Mk14 instructions. The voltage regulator on he Mk14 proved able to supply this extra RAM, and also a tape interface module, but required a heatsink.

Language Development

I then turned my attention to the development of the high level language. None of the existing forms of BASIC would go into the memory I had available. This consisted of a total of 2k but some of this was dedicated to the Mk14 Monitor, and I wanted some for a data store. From what was left I had to find working space, program storage space, and space for the interpreter. It was clear that a compromise between all these demands was going to be difficult to work out.

I decided to attempt to devise a very simple subset of BASIC and to call this micro-micro subset PICO BASIC. In this language the four basic arithmetic rules + - * / would be essential. The four BASIC instructions which seemed to me to be most necessary were INPUT, PRINT, GOTO and an IF. And I wanted to be able to store and read data. It was clear that with a hexadecimal keyboard I would have to use single keys for each instruction, and would have to implement some form of upper and lower case system.

I decided from the beginning to aim at an integer arithmetic and had hoped to cater for both negative and positive numbers. But as the system developed this had to go and PICO now operates four-digit positive arithmetic (mod 10,000). However, it is surprising how much useful computing can in fact be done within this limitation.

Description of the Language

The MK14 Keyboard is used as indicated in the table. Some of the keys are relabelled for convenience in use. The PICO interpreter is entered from tape as shown in the memory maps.

The overall memory map is shown here. Pico Basic requires memory between 0200 and 07FF.

Map of Available RAM

Address Contents
0FF7-0FFF Monitor Variables
0FAA-0FF6 Serial Data File
0F50-0FA9 Interpreter Part C
0F12-0F4F PICO variables
0F00-0F11 Monitor Variables
0B00-0BFF Interpreter part B
0600-07FF Program Store
0200-05FF Interpreter Part A

The 512 bytes of PICO program store allow the running of programs up to 56 lines. The serial data file will hold 77 2-digit numbers, or with a small change in the interpreter, 38 4-digit numbers.

General Form of PICO Statements

n n x x x x x x x x

  1. Line number nn in the range 01 to 99, two digits essential. Lines may be entered in any order, but will be executed in line number order.
  2. Instruction x...x up to 8 characters. If more than 8 characters are entered, the line aborts and must be re-entered , starting with the line number.

Entering PICO Programs

  1. Address 021E
  2. Press RUN - display is ? followed by 7 blanks, indicating readiness to accept program line.
  3. Enter program line. If an error is made, press RUN and start line again.
  4. Press LINE - display indicates readiness for next line
  5. After entering last program line press END - display is RUN indicating readiness to run. To run program press RUN.

Execution of Programs

Statements are executed in the order of their line numbers, regardless of the order in which they were entered. If two or more lines have the same line number , only the last entered is executed. A line can thus in effect be overwritten, and it may in effect be deleted by entering the line number on its own.

Error Detection and Correction

Error detection is written into the interpreter. When the computer attempts to execute at run time a line containing an error in syntax, the run halts and ? is displayed. The number of the line which caused the halt can be discovered by the following procedure :-

  1. Return to monitor - press X
  2. Address 0E1A - the two most right digits show the required line number.

To see what is in that line number

  1. Address 0F1D and enter the line number at that address
  2. Address 0339 and press RUN - display is RUN plus a set of symbols (related to the segment code for the line number)
  3. Press RUN, the required line is displayed.

To alter the line, proceed as follows. If now alteration is required, jump to step 5. below.

  1. Press RUN - display is ?
  2. Enter revised line, including line number.
  3. Press LINE.
  4. Press END - display is RUN plus the symbols, which serve to remind of the necessity to reset 0F1D to zero.
  5. Press X
  6. Address 0F1D and enter zero (or enter another line as above)
  7. Address 0339
  8. Press RUN

If it is desired to alter aline without the necessity of seeing it first, follow these steps.

  1. Address 0339 and press RUN
  2. Press INPUT
  3. Proceed as from 3) in the section "Entering PICO programs"

PICO Keyboard

The MK14 keyboard is remapped as follows.

Key Lower Case Upper Case (shifted)
0-9 0-9 v0-v9
A + GO
B - IF
C * (displays as .) LD (Read Data)
D / PR
E = IN
F Shift (Displays as ^) ID (Write Data)
TERM END END (end of program,prepare run)
MEM LINE LINE (end of line,store in program)
ABORT X X (return to monitor)
GO RUN RUN (Run Program)

PICO Statements

INPUT (e.g. 01Inv4)

To enter this press 0 1 [SHIFT] INPUT [SHIFT] 4

At run time this statement produces the display v4=? and the run halts to await entry of a number. If more than 4 digits are entered, only the last four are retained.

After the number has been entered, press RUN to resume execution of the program. The number will be stored in variable v4, one of 10 available variables which are designated v0 to v9.

PRINT (e.g. 02Prv5)

To enter this press 0 2 [SHIFT] PRINT [SHIFT] 5

At run time this statement produces the display v5=xxxx, the number stored in v5. Leading zeroes are suppressed. Press RUN to continue execution.

GOTO (e.g. GO06)

This causes the program to jump immediately to line 06. If the destination line number does not exist in the program execution will jump to the first one above it, or, failing that to the start of the program.

IF (e.g. IFv5v608)

As the last two characters are entered, the line number disappears of the left of the display. This statement is equivalent to the normal BASIC Statement

IF V5 >= V6 THEN 08

It causes execution to move immediately to line 08 if the number in v5 is greater than or equal to the number in v5. If v5 is less than v5 execution continues at the next higher line number above 04. By reversing the positions of v5 and v6 the effect v5<=v6 is obtained. This is the most useful single conditional jump statement.

ASSIGN CONSTANT (e.g. 05v7=xxxx)

This causes the number xxxx to be stored in v7

ASSIGN VARIABLE (e.g. 06v8=v7)

This causes the contents of v7 to be also stored at v8


The four functions add, subtract, multiply and divide may be invoked but unlike conventional BASICs only one calculation may take per program line. In the example below f stands for any one of the four functions.


This is the general form, and a & b stand for numbers of variables. A maximum of 5 display digits is available for afb. When both a and b are variables these are fully used

e.g. (07)v1=v1+v2

When a or b is a variable and the other is a number, the number may not have more than 2 digits.

e.g. (07)v1=v2-23

When both a and b are numbers, the total number of their digits may not exceed 4. When it is desired to use larger numbers they must first be assigned to variables.

Notes on the calculations

  1. Answer are given moe 10,000. Thus 11,340 would be shown as 1,340 and -2 is 9998
  2. Multiplication is effected by repeated addition without shifts, and 27x932 takes longer than 932x27.
  3. The answer to a division gives the integer part of the quotient - the answer is truncated, not rounded.

Input & Load Data

A serial data file for up to 77 2-digit numbers is available. A modification of the interpreter will change this to 38 4-digit numbers if required. During each program run the numbers are normally accessed in order from the beginning of the file using these statements.

e.g. 08Idv9 and 09Ldv6

The first statement causes the two right hand digits of the number in v9 (the whole number if the four digit file is in use) to be stored at the next file location. The second causes the contents of the next file location to be stored at v6.

The number of the file location to be next accessed is held in 0 in hexadecimal. It is incremented by 1 after each access. By storing a decimal number from 00 to 49 in v0, 50 of the file locations can be directly accessed at any point in a program. By treating the two figures of this number as array subscripts it is possible to implement a 5 x 10 array.

Data may be entered during one program run and retrieved at a later date by a different program, providing that the computer has not been switched off. It can also , of course, be transferred to tape for permanent storage.

Notes on Programming

  1. When the program linefile is full (contains 56 lines) any attempt to enter a further line produces the display F.
  2. The 56 includes any lines which have been repeated to correct errors or to vary the program.
  3. A routine to display any number of decimal places resulting from a division is included among the sample programs.
  4. There are 10 variables denoted v0 to v9. v0 doubles as data file address store.
  5. At the start of every run these variables are zeroed.

Sample Programs


This simple program displays successive multiples of a chosen number.

Note the closed loop with the print statement in it. In conventional BASIC this would produce an endless succession of multiples which could only be halted by breaking into the program run. In PICO the run halts each time the PRINT statement is reached, to be resumed by pressing RUN. But as in normal BASIC the only way to get out of the loop is by returning to the monitor.


This loop is used to enter data into the serial data file.


This program includes the use of a stop value (rogue value) at the end of the data to get out of the load loop


The first run produces the integer part of the answer. Each successive press of RUN produces one decimal place of the answer.


The integer part of the square root of a given number is produced by the usual iterative method.

Interpreter Listing

There follows a listing of the interpreter. It is highly probable that by careful consideration of each section of the interpreter it will be possible to prune it and thus release extra memory for the inclusion of desirable refinements such as a simplified way of displaying any line of the program in store.

The listing is not given here, of course. The PICO Basic Interpreter , in TASM format with comments expanded, and a .HEX file to run with it are available on the software page

Go back