Designed and written by Paul Robson 1998
This is loosely based on the 'M5' interpreter published for the Nascom 1 microcomputer. It is a language built up from symbols with RPN arithmetic. The aim is to provide an editor and interpreter for the MK14 computer on the basic machine with the 1.5k RAM modification. The MK14 implementation includes both an editor and an interpreter.
The SC5 machine has a 3 word data stack and a 2 word subroutine stack. The data stack is not pushed automatically, values are simply overwritten - there is a command to push a value on the stack. The only other operations which 'move' the stack are the arithmetic operations. Overflowed data from both stacks are lost.
There are 16 variables. numbered 0-9 and A-Z. Data values are stored here and on the stack in BCD mod 10,000 (0000..9999). The version in the library has space for 768 characters of program.
Language Functionality
The language is written as a sequence of symbols. These are given below.
Constant
A numeric constant 0..9 (standard symbols) shifts the value on the top of the stack right 4 bits and puts the constant in the LSB. Thus a sequence of digits places that constant on the stack top. If the previous character was not interpreted as a "constant" then the tos is zeroed first.
Variables
There are two variable manipulation functions for the 16 variables called 0-9 and A-Z. These are u and ubar (a u with the top segment lit). uA puts the contents of variable A on the top of stack , ubarA puts the contents of the tos into variable A
Push
The push symbol _| pushes the value on the top of the stack down one.
Arithmetic
Arithmetic operations operate on the two top items on the stack, and pop the top one off. Four are provided (+,-,*,/). Doing an add or subtract sets an internal 'carry' value which is 1 when Add overflows or subtract doesn't.
Calculating A+1 in SC5 would be done as uA_|1+ (Get A , push , 1 , add). To store the result in A again add ubar A
Input/Output
There are two I/O functions Input (?) and Print (P). Both act on the top stack value. To resume a program after input or print, press GO. To exit at this point, press ABORT.
Labels
Labels are represented by [<label>. A label is a two digit number. (e.g. [41)
Jumps
Jumps and transfers are done by the ]<op><label> command. These are as follows.
Editor Keys
The following are the editor keys. When a program is running, press ABORT to terminate it.
| Key | Normal | Shifted |
| 0 | 0 | u (Load) |
| 1 | 1 | ubar (Store) |
| 2 | 2 | _| (Push) |
| 3 | 3 | + |
| 4 | 4 | - |
| 5 | 5 | * |
| 6 | 6 | / |
| 7 | 7 | ? (Input) |
| 8 | 8 | P (Print) |
| 9 | 9 | [ (Label) |
| A | A | ] (Transfer) |
| B | B | unused |
| C | C | unused |
| D | D | unused |
| E | E | unused |
| F | F | Space |
| TERM | Move back | Move back |
| MEM | Move forward | Move forward |
| GO | Shift | Cancel Shift |
| ABORT | Run | Rune |
On the display shift is indicated by a high bar - (opposed to a low bar _) - when there was an error in the program the letter E will be displayed and the error point is near the right of the display.