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.
The language is written as a sequence of symbols. These are given below.
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.
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
The push symbol _| pushes the value on the top of the stack down one.
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
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 are represented by [<label>. A label is a two digit number. (e.g. [41)
Jumps and transfers are done by the ]<op><label> command. These are as follows.
The following are the editor keys. When a program is running, press ABORT to terminate it.
|TERM||Move back||Move back|
|MEM||Move forward||Move forward|
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.