

ZX-CESIL 2

by John Miller

from ZX Computing Apr/May&Jun/Jul.1983



John Miller has taken a quick break from his A-levels to

prepare us a splendid implementation of the educational

computer language for your ZX Spectrum





Those people studying for 'O' level or 'CSE' Computer

Studies at school, more than likely have to learn the

language CESIL (Computer Education in Schools Interactive

Language) which supports 14 program statements as standard

and a handful of commands. The language I chose to implement

CESIL in was ZX Spectrum BASIC - with 48K RAM. (The use of a

ZX Printer is optional.)



Type in the program (carefully!) and then enter the command:



RUN 1



Two pages of introduction will be displayed, then you will

see the prompt:



Which mode (1 or 2)?



In reply, enter 1 or 2.



Mode 1 means output to screen only and mode 2 means output

to both screen and printer. The Spectrum's screen BORDER

state depends upon the current mode:



Green  for Mode 1

Yellow for Mode 2



When the message 'C?' is output, you are required to enter a

CESIL command:



COMMAND NOTES

beg - Execute the CESIL program.

cha - Change a CESIL line.

del - Delete a CESIL line.

lis - List the CESIL program.

new - Re-initiate program - same as stopping the program and entering RUN 1.

ter - Stop the interpreter - terminate.

*   - Start CESIL entry.



When using 'cha' or 'del', the first parameter is the line

to be edited (del followed by Enter followed by 5 followed

by Enter, will delete the fifth line).



When '?' is output, you are required to enter a CESIL line.

Labelled lines are l1 to l99 and store locations are

designated a1 to a99 (positive constants do not require

'+'). Please note that 'l' means 'label'.





Types of argument



a - The argument required is:

    (i) Space, any whole number between -32768 and +32768.

or (ii) Space, a ; any integer between 1 and 99.

eg. (i) loa -2

   (ii) add a5



b - The argument required is:

    Space, 'l' , any integer 1 to 99.

eg. jiz l10



c - The argument required is:

    Space, quote, any alpha-numeric text of length 1 to 22, close quote.

eg. pri "Hello there!"



d - The argument required is:

    Space, a, any number 1 to 99 (integer).

eg. sto a86



e - The argument required is:

    Any alpha numeric text of length 1 to 23.

eg. ; This is a comment



n - No argument required.



All instructions are standard, except 'kin', which is the

same as BASIC's INPUT number. The instruction 'in' is the

same as BASIC's READ. All arithmetic is calculated solely

using the accumulator.



In order to exit from CESIL 2 entry, enter:



%



As a line, you will then be asked to enter the data string

in the form:



n1,n2,n3,...nx, *

n1=item 1

n2=item2...

nx=last item

eg. 1,2,3,5,7,9, *

(Note the comma before the *)



For no data, just enter an asterisk. (Also, only the first

20 items will be accepted.)



To change the data for another RUN of the same program:



	PROMPT	ENTER

	C?	*

	?	%

	Data?   data string



Also, if after entering and executing a CESIL program, entry

mode is again initiated and the lines will be added to the

end of the previous lines. The number of program lines

available is 100 (that's my limit - not the Spectrum's).



To change the maximum number of lines, make the following

changes to the BASIC program (!! = the number instead of 100

- maximum value 255).



  20 ...: DIM p$ (!!,25): ...

1380 FOR x=1 TO !!

2030 FOR z=VAL i$ + 1 TO !!

3710 IF lastln<(!!+1) THEN GO TO 3750

4180 FOR c=1 TO !!



During CESIL2 execution or CESIL2 listing (lis), command

mode may be achieved by pressing the space key - as long as

it is unshifted!





Labelled lines



(i)	Labels - l1 to l9

The format is l, n, Space, Space,

instruction + argument.

	eg. l1  lin



[Presumably there should have been a section (ii) here,]

[with the syntax for labels l10 -l99, but it's missing ]

[from the magazine article.                       JimG.]



Also, arguments should be preceded by a single space, in

turn preceded by the instruction.



To SAVE the ZX-CESIL 2 program, type in the following:



SAVE "cesil" LINE 4450



The program, with all variables, uses approximately 18K.

With the screen, printer buffer, etc, this expands to 25.9K.





Errors



ZX-CESIL2 generates error messages for various user errors.

The possible error/report messages are:



(i)	Data all used.

(ii)	List complete.

(iii)	Illegal label error.

(iv)	Instruction does not exist.

(v)	Command as statement error.

(vi)	Illegal use of argument error.

(vii)	Space missing error.

(viii)	Label missing error.

(ix)	Illegal operand.

(x)	Number out of range error.

(xi)	Location missing.

(xii)	Invalid location.

(xiii)	Missing quote error.

(xiv)	Invalid text error.

(xv)	What?

(xvi)	Statement as command error.

(xvii)	No more program room.

(xviii)	Data invalid.

(xix)	First 20 items of data only accepted.

(xx)	No hal instruction.

(xxi)	Last line reached or hal executed.

(xxii)	Called label does not exist.

(xxiii) Arithmetic overflow.





= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

INSTRUCTION  PURPOSE           ARGUMENT TYPE



add          addition                a

div          division                a

hal          halt execution          n

in           input from data         n

jin          jump if negative        b

jiz          jump if zero            b

jum          jump                    b

kin          input from keyboard     n

lin          start new line          n

loa          load a number           a

mul          multiplication          a

out          output                  n

pri          print                   c

sto          store                   d

sub          subtraction             a

;            comments                e



= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =





--

Another Fine Product transcribed by:

Jim Grimwood (jimg@globalnet.co.uk), Weardale, England

--

