EXOS 2.1 Editor Driver Specification

7. Special Function Calls

7.1 Setting Margin Positions

The margin positions can be set by the user or the applications program by using a function key. However a more general way for the applications program to set the margin postitions is provided as a special function call. The parameters for this call are:

    Parameters :  A channel number (1..255)
                  B @@MARG (=24) (special function code)
                  D new right margin column
                  E new left margin column

    Returns    :  A status
                  D right margin column
                  E left margin column

The column numbers can be from 1 up to the width of the video page, with the usual restrictions on valid margin settings. There are two special values which can be given for the new left and right margin parameters. If either of them is 0FFh then the current cursor column will be used for that margin. If either of them is zero then that margin setting will be unchanged. Thus the current margin settings can be read without affecting them, simply by setting both D and E to zero.

7.2 Loading and Saving Document Files

Two special function calls are provided for loading and saving document files. The format of saved documents fits in with the standard EXOS file module format which is described in the EXOS kernel specification. The module type for editor document files is $$EDIT (=8) and the module header contains no other information

The simplest of the two functions is saving. The call must specify a channel number down which the document is to be saved and this channel must be opened before making the call. The editor will write a suitable module header followed by the data of the document. It does not write out an end of file header at the end, since the application program may want to create a multi­module file.

The details of this special function call are:

    Parameters :  A editor channel number (1..255)
                  B channel number to write to (1..255)

    Returns    :  A status

Loading is slightly more complex. Before making the special function call, the file to load from must have been opened, and a file header with type $$EDIT must have been read in. The editor is then called, giving the channel number to load from. It first clears all the text out of the editor buffer and then loads the new document in from the file. It loads line by line and checks that each line is valid before going on to the next. If it finds an invalid line or the buffer becomes full then it stops loading and returns an error (.EDINV or .EDBUF). All previous lines in the buffer will be valid. The cursor will be left at the start of the document

    Parameters :  A editor channel number (1..255)
                  B channel number to load from (1..255)

    Returns    :  A status

Note: in the scheme for special function calls register B indicates the kind of special function. Which in this case should be @@CHSV (=25) and @@CHLD (=26) respectively. So to me it seems that the channel to write to or read from must be specified by some other register. Now exactly which register this is is anyone's guess. Please Tell me if you know.

A saved document contains the characters of the text and also information about paragraph structure, the left margin position for each line, and the colour of each line. Thus if a document is saved and loaded into an editor channel with the same sized buffer and video page, then it will reload exactly as it was before being saved.

Information about editor options and so on is not saved with the file so any tab settings, current margin settings and so on will have to be set up again when the file is loaded.

A document can be loaded into a different sized editor channel but may have to have some lines adjusted if their left margin setting is invalid. Also it may not all fit into the buffer if the new buffer is smaller.

Next Chapter: Error Handling.

David Bouman. (dsbouma@cs.vu.nl)