Home » Archimedes archive » Archimedes World » AW-1994-06-Disc2.adf » Disk2Jun94 » !AWJune94/Goodies/Zap/!Zap/Docs/E-Entry

!AWJune94/Goodies/Zap/!Zap/Docs/E-Entry

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Archimedes World » AW-1994-06-Disc2.adf » Disk2Jun94
Filename: !AWJune94/Goodies/Zap/!Zap/Docs/E-Entry
Read OK:
File size: 70CC bytes
Load address: 0000
Exec address: 0000
File contents
*************************************************************************
* >E-Entry	Documents the format of a mode entry point table	*
*************************************************************************

The offsets in the entry point table are given names beginning 'e_'. The
E-Library program will define the offsets for you.

You must fill in the first 8 entries of this table. The rest of the entries
you may leave as 0 (or more simply, set the table length in the 8th word to
32 bytes). The idea of the mode table, is that you specify a BASE mode. For
all the entry points (from the 9th onwards) that are off the end of your
table, or that you have left as 0, the base mode will be called instead.

Hence, the simplest Zap extension mode would just set the base mode as 0 (ie,
TEXT) and leave the rest as 0. You will then get a clone of the text mode.

In general the following register conventions are used:

	R2	Current column in characters (see E-Windows)
	R3	Current line in characters (see E-Windows)
	R8	Window block pointer / 0 to change the default config
	R9	File block pointer / 0 to change the default config
	R10	Cursor block pointer
	R11	Your extension mode workspace (private word)
	R12	Zaps workspace (private word)

In general the entry points have entry and exit conditions:

	\E R0-R10=parameters R11=your workspace
	   R12=Zap's workspace R13=FD stack R14=return addr
	\X You must save R1-R11 (unless otherwise mentioned).
	   You may corrupt R0 and flags.
	   Set V flag and put R0=error block pointer on an error.

See the E-ZapCalls file for more details on my entry/exit syntax.

All offsets given in the table below must be from the start of the module.
Hence the table is relocatable. Zap finds the start address of your module
via the first table entry (e_module). It uses this and an OS_Module call to
determine the address of your workspace (to pass in R11). All strings should
be 0 terminated.

Entry points for arbitrary modes may be called using Zap_CallMode,
Zap_CallGivenMode or Zap_BaseMode. If none of these will do, then use
Zap_ReadMode to find the table entry linked points and the address of the
mode's workspace and the entry point can be called directly.

Each mode has a word of workspace reserved in the window block (pointed to
by R8) for each file. A mode is responsible for storing the current options
in their mode word when the user changes mode (see e_start/e_end). There
are Zap calls provided to make this easier for you. If you need more than
one word of workspace then the mode word can store the pointer to a block of
workspace if you set a flag in e_mode. See E-Windows (w_mode0...) and E-Vars
(opt_mode0...).

The entry points
================

e_module
This gives the table offset from the module start so that the module start
may be calculated by Zap. Ie, module start = address of table start - this
offset.

e_title
Offset of the mode title string to be used in the 'Mode' menu. It should be
at most 7 chars long. (eg 'BASIC')

e_author
Offset of the author name string (eg 'Dominic Symes').

e_basemode
Gives the mode on which to base null entry points. Current modes are: 0=Text
1=byte 2=word 3=ascii 4=hex 5=basic 6=bastxt 7=cmode 11=throwback
12=taskwindow. Needless to say, if you wish to clone the BASIC mode, you'd
better be sure that the Zap_Basic module initialised before yours!

e_mode
Gives the mode number you would like to be in bits b0-b7. Bits 8-31 contain
flags as follows:
	b8	Set to receive RAW keyboard input. All key presses are sent
		to e_char. Zap key codes greater than &FF are sent as a
		zero byte followed by the low byte.
	b9	Set to get taskwindow style keyboard input passed to e_chars.
		This differs from normal e_chars entry in that:
		1) Delete is passed on as &7F instead of calling e_delete
		2) Characters &20-&FF are passed on regardless of mapping
		3) If not in COPY mode then the cursor keys are passed on
		   as a 0 byte followed by bottom 8 bits of the wimp's code.
		   Similarly TAB.
		4) Return and Escape are passed on as &0D and &1B.
		This is subject to changes - contact me.
	b10	Set to indicate that you use a mode word in a window block
		(eg w_moden) to point to a block of data. See E-Windows
		for the format this block must take.
	b31	Set to overwrite any mode already using this mode number.
	Others bits are reserved and should be set to 0.
	If b31 is not set then you are allocated the next free mode if the
	one you wanted is being used.

e_init
Called at various points when Zap is starting up/dying or wants to give your
mode a chance to intercept an operation. Note that Zap will automatically
kill your module on dying unless you tell it otherwise. You should use reason
code 2 to claim any buffers from Zap. I am at liberty to add extra reason
codes so please return with all registers unaltered if you receive an
unrecognised code.
    \E R1=reason code (and other registers may hold values dependent on it)
    \X Save R1-R11 as usual unless otherwise stated below.
 The reason codes are:
 R1=0 => Zap is quitting and about to kill your module.
	 Return R0=-1 to stop this (eg if you've more than one mode).
 R1=1 => Zap has just started but not set up its heap yet.
 	 R0=the mode number assigned to your mode.
 	 You should note the mode number that has actually been assigned to
 	 you and store it in your module somewhere. This is not guaranteed
 	 to be the one you asked for.
 R1=2 => Zap has started and set up its heap. On this call you should check
	 your mode word opt_moden to see if it's zero. If so then you should
	 initialise it to a sensible default value. (See E-Vars) You should
	 also use this call to claim any buffers you need.
 R1=3 => Zap is deleting a file with your mode number in f_cmode. R9=file
	 block on entry. See E-File.
 R1=4 => Zap is saving a file with your mode number in f_cmode. R8/R9=the
	 window being saved. Return R1=-1 if you wish to abort the save
	 (and handle it yourself). If you return R1=-1 then return R0=0 if
	 the save is safe (file can now be deleted) or -1 if unsafe (entered
	 data transfer protocol for example).
 R1=5 => Zap wants to delete a file your mode number in f_cmode, but it
 	 has the 'altered' flag set. Return R1=-1 to override and allow the
 	 file to be killed anyway.
 R1=6 => Zap is creating the colours submenu and wants to know what you
 	 call colours >=9. Return in R1 pointer to a double zero terminated
 	 list of zero terminated entries giving the names of the colours
 	 starting from 9. Eg "REMs",0,"Strings",0,0. (Or leave R1 as 6
 	 if this call is not supported).

e_menu
Offset of submenu in Zap's format / 0 for none. This menu comes off the
'Mode' menu. See the file E-Menu for details of the menu format.

e_len
Total length of the table data (>=32). (So that only entry points within the
table are called and for forward compatibility). If zap finds an entry point
is off the end of the table then it will call the corresponding base mode
entry point.

If any of the following offsets are 0 then the corresponding offset for the
basemode is called.

e_postload
Called after a file is loaded and has had a window opened for it in your
mode. It is also called after a file in your mode has been saved. It enables
the file contents to be slightly altered before editing. (eg BASIC encrypts
the line numbers and BASTXT detokenises the program). You may alter the data
directly (ie, you needn't use Zap_Command).
	\E R8/R9
	
e_presave
Called before the file is saved. It enables file contents to be slightly
altered, undoing the effect of e_postload. (eg BASTXT retokenises the program
prior to saving). As above, you may alter the data directly.
	\E R8/R9

e_loading
This is called when a file is loaded off disc for dropping into a window. The
file data is in a heap block. This enables you to change it before insertion
takes place (eg BASTXT detokenises the file). You are only called if the file
type of the file is claimed by your mode (in the 'keys' file).
	\E R2=data length R3=data address
	\X You may change the data, making it larger if necessary
	   provided that you enlarge the heap block R3. Return
	   updated R2 and R3.

e_start
Called when a window enters your mode (eg via Zap_NewMode). You should
restore the current w_flags and w_format options, and any other options you
may have saved in your private word w_moden or block pointed to by w_moden.
The call Zap_RestoreModeWord should be made as this restores the options kept
track of by Zap using Zap_ModeData.
	\E R8/R9=window mode is being changed in OR 0 if the mode on the
		 options menu is being changed and you should restore the
		 default options, of for example opt_flags and opt_format.

e_end
Called when a window leaves your mode (eg via Zap_NewMode). This is similar
to e_start except that you should save the current mode dependent
options from w_format, w_flags. The call Zap_SaveModeWord should be made as
this saves the options kept track of by Zap using Zap_ModeData. Again, if
R8=0 then this all applies to the options menu and opt_flags,opt_format.
	\E R8/R9=window / 0 for iconbar menu

e_width
Called when a window is (re)created to find out the width of the work area in
characters (excluding margin). You should read this either from your mode
word or block, or using Zap_ModeData variable number 0 where Zap reserves
space for a width value for you. If you support auto width and the auto width
flag is set (see E-Flags) then you should work this width out from the file.
Once you have calculated the width, it is advisable to store it in w_bpl, a
variable reserved for this purpose.
	\E R8/R9
	\X R0=width of work area in characters (excluding margin)

e_linecol
Converts a column offset on screen to file offset. This is called by
Zap_FindOffset and other subs. The start offset of the physical line on which
the column lies has been calculated (usually by e_clnoff).
	\E R0=file offset of physical line start
	   R1=column offset on screen (exc margin) R8/R9
	\X R0=file offset of nearest character on the left
		
e_lineoff
Convert file offset to column on screen. This performs the inverse function
to e_linecol. It is usually called by Zap_OffLineCol. Again the offset of the
start of the physical line has been calculated (usually by e_clnphy). This
call should also return the caret width for this mode.
	\E R0=file offset of physical line start
	   R1=file offset (to convert to a column) R8/R9
	\X R0=column offset on screen (exc margin)
	   R1=caret width (in characters - usually 1).

The next 3 subs do the main body of work of converting between screen display
lines and file offsets. A physical line means the actual offset in lines from
the top of the file when displayed - that is the actual 'y' coordinate.
Counting starts at 0. Logical lines can be interpreted however the mode
wishes. In text mode, a logical line is ended by a return (as opposed to the
display wrapping). These are given as offsets from 0 as the first line. It is
important that these routines are OPTIMISED as much as possible.

e_clnlog
Converts a logical line number to a file offset/physical line. This is not as
important as the other two. It is mainly used by the 'GOTO' box (F5). Ie,
user asks to go to logical line (eg basic line) 500 and Zap wants to know the
file offset of this.
	\E R0=logical line number R8/R9
	\X R0=file offset of line start
	   R1=physical line number

e_clnphy
This converts a physical line number to a file offset. This is the most
important of the 3 as it is called when updating a window. For example the
wimp asks zap to redraw a rectangle. The top of the rectangle is at physical
line 100 say. Zap needs to know the file offset of this line to call
e_redrawline. It uses this call. Do NOT start counting from the start of the
file, as the window being updated may be near the end. Instead, use the start
of the w_txt cache as a reference. Ie, use the variables w_cline, w_coff,
w_clogl as your start reference.
	\E R0=physical line number R8/R9
	\X R0=file offset of line start
	   R1=logical line number

e_clnoff
Converts a file offset to a line number and offset. This call is used by
Zap_OffLineCol and when a window is first opened. It should find out which
physical line a file offset lies on. If the file offset is equal to the file
length then it should return the line of an 'imaginary' last character. This
is called when a window is initially opened to work out the w_height value.
As with e_clnphy you should use the cache reference point as a starting
point.
	\E R0=file offset R8/R9
	\X R0=physical line number
	   R1=file offset of physical line start
	   R2=logical line number

e_nextline
This is called during a Zap_DoCommand operation. It is designed to work out
the first line on screen which can be shifted down, following an insertion/
deletion, without being redrawn. On entry you are told the first character
which occurs after the altered region and the amount by which its offset will
change due to the alteration. You must return the file offset of the first
line which may be shifted on the screen without being redrawn. (Usually the
first logical line with start offset > R0). In the case where there is no
such line, return the end of file offset and the physical line containing
this 'imaginary' character offset (as for e_clnoff).
 See also e_prevline. e_prevline is called first, and the file block is
set up as for e_prevline.
	\E R0=file offset of first 'shiftable' character
	   R1=signed change in file offset of this character R8/R9
	\X R0=file offset of first 'shiftable' line
	   R1=physical line number of this line #
	   You must preserve the split offset and split size of the file.
	   
e_minus
This is called when the user presses the left arrow key to work out the next
cursor position. The buffering is done for you.
	\E R0=physical line start file offset
	   R1=cursor file offset
	   R2=cursor column (exc margin) R8/R9
	   R10=cursor caret block
	\X If R2>=0 then R1,R2 given new cursor position on the
	   same physical line.
	   If R2=-1 then R1=new file offset of cursor.
	   If R2=-2 then you have moved the cursor yourself.
	   If R2=-3 then R0,R1=new x,y for cursor.

e_plus		Perform cursor right (\E & \X as for e_minus)
e_sminus	Perform cursor back a word (\E & \X as for e_minus)
e_splus		Perform cursor forward a word (\E & \X as for e_minus)
e_cminus	Move cursor to line start (\E & \X as for e_minus)
e_cplus		Move cursor to line end (\E & \X as for e_minus)

e_redrawline
This is called when your mode is required to redraw one (physical) line of
the display - it is also here that you can specify the colour of each
character. You are passed:
 1) As input:
    The physical line start (calculated via e_clnphy - or the previous call
    to this sub). This is not passed as a file offset, but as an actual
    ADDRESS in the file buffer (in R7). Recalling the split nature of the
    buffer (see E-File) the text may not be continuous. R10 is set to the
    end of this section of the split so the file is continuous up to R10.
    R5=R7-the offset of the character - I call this the apparent buffer start
    (where the start would be if the file were continuous).
 2) For output:
    The address of a buffer (in R6) in which to write the characters to
    appear on the line (one byte per character). This buffer has been
    cleared to spaces beforehand so you only need to write the non-space
    characters. Line numbers have been dealt with. You told Zap the width
    the buffer should be when your e_width entry point was called.
 3) Colours:
    As far as this call is concerned there are 16 colours numbered 0-15
    available. These bear no resemblance to wimp colour numbers, but are
    'internal' Zap colour numbers. Their actual physical appearance is chosen
    by the user from the colours menu - and can be selected from a
    palette. Colours 0-8 have a standard interpretation but colours 9-15
    can be used as the mode sees fit. Eg, colour 9 may be used for IF
    statements in a language editor for example. The standard colours are
    	0=Background colour 1 (default background colour + off end of text)
    	1=Background colour 2 (this should be used under text)
    	2=Standard foreground colour
    	3/4=selection bac/foreground 5/6=cursor bac/foreground
    	7=line numbers 8=control characters.
    Let n be the value stored in R8,#w_txtw. Then the foreground colour of
    the cached character stored at R6 is stored at R6+n and the background
    colour at R6+2*n. These are initially cleared to bytes '2' and '0'
    respectively - you should overwrite these bytes to change the colour.
    Text mode puts colour 1 (background colour 2) under actual text and you
    should do the same. See e_init for how to change the colours menu.
 4) Other comments:
    On exit you should update several registers to the start of the next
    physical line. e_clnphy is only called for the first line in a group.
    For a simple example of how to write this redraw code, see the code for
    mode 3 (ascii mode).
	\E R4=w_format (read from R8,#w_format)
	   R5=apparent buffer start (R7-offset of char in file)
	      (so it is either f_ptr or f_ptr+f_splits)
	   R6=address of cache line to draw line in (already blanked)
	   R7=address of start of (source) line (R5+file offset of line).
	   R8/R9
	   R10=address of end of this section of the buffer.
	       (so when you reach R10 you increase R5 and R7 by f_splits if
	       at the end of the first half or stop if at the file end).
	   R11=logical line number (for you to update for cache reference
	       and printing in the left hand column).
	\X R0-R4,R6,R10 may be corrupted
	   R5,R7,R11 must be updated to the start of the next physical line
	�  R8-R9,R12 must be preserved

e_redrawlnum
This is called when the user wishes logical line numbers to be displayed on
the left. You must decide whether the given physical line file offset it at
the start of a logical line. This is called while redrawing the line numbers.
	\E R7=file offset of start of physical line
	   R11=proposed logical line number (as calculated by e_clnphy)
	   R8/R9
	\X CC if R7 is at the start of a logical line (so print it)
	   CS if the line number column should be left blank
	   You may corrupt R0-R4. You may also change R11 as BASIC does
	   but this is not advised as the w_clogl will get out of sync.
	   BASIC ignores the w_clogl as the line number is stored in the
	   file.

e_char
This is called when the user types a string of ascii chars via the CHAR
command. The characters have been concatenated for you. You should perform
the relevant insertions/deletions via Zap_Command.
	\E R4=w_flags
	   R5=number of bytes typed
	   R6=w_format
	   R7=address of typed data
	   R8-R10=input caret (ie this points to the block car_cursor or
	          car_input depending on the caret mode and where typed
	          text should go).
	\X You may corrupt R0-R11

e_delete
This is called when the user executes the commands DELETE or DELETENEXT. A
sequence of deletes is concatenated for you. You should use Zap_Command to
delete the text. Try and support the line edit mode.
	\E R5=number of times pressed
	   R6=w_format
	   R7=0 for DELETE/1 for DELETENEXT
	   R8-R10=input caret
	\X You may corrupt R0-R11

e_tab
This is called when the user executes the command TAB. As usual, repetitions
are concatenated. Use Zap_Command to perform the function.
	\E R1=number of times pressed
	   R8-R10=input caret
	\X You may corrupt R0-R11

e_return	Called when RETURN executed (\E \X as for e_tab)
e_renumber	Called when RENUMBER executed (\E \X as for e_tab)
e_saveandrun	Called when SAVEANDRUN executed (\E \X as for e_tab)

The next 4 subs are used by the various delete line calls. They each have
	\E R0=current file offset in a line R8/R9
	\X R0=new file offset (see below)
This is how the subs are called:

DELLINE		Deletes from lineprev to linenext offsets.
DELTOEND	Deletes from current offset to lineend unless this is empty
		when it calls JOINLINE (as in emacs ctrl K)
DELTOSTART	Deletes from linestart to current offset unless empty.

e_linestart	Called to find the lines first character.
e_lineend	Called to find the lines last character.
e_linenext	Called to find the lines actual end (eg after &0A)
e_lineprev	Called to find the lines actual start (eg for basic lines)

e_copy
Called when user wishes to copy characters via the COPY key. Is is called for
finding the characters to copy and for inserting the copied characters.
Reason code is in R0. When reading characters you must update the cursor
yourself. Note the source window may be in a different mode to the
destination window!
		\E R0=1 => Fetch characters
		   R1=number of times copy pressed (number of chars to get)
		   R8-R10=copy cursor (car_cursor)
		\X R3=pointer to buffer containing characters to 'type'
		   R2=number of characters to 'type'
		   Copy cursor updated to new position
		OR
		\E R0=2 => Write copied characters
		   R2=number of chars to type
		   R3=pointer to the chars
		   R8-R10=input cursor (car_input)
		\X R0=0 means you've done it all yourself
		   R0=1 means please enter it for me via Zap_Command
		   R0=2 means please enter it for me by calling my e_chars

e_joinline	This is called when Joinline pressed (\E \X as for e_tab)
e_splitline	This is called when Splitline pressed (\E \X as for e_tab)

e_aligncaret
This is called before any commands are executed on a window in your mode.
It serves two purposes. The first is to align the input caret offset to a
sensible position (eg word align in word mode, put after line numbers in
basic). The second is to reset any counters you may have. For example, the
hex mode entry uses a counter to tell how many nibbles have been inserted in
a word. This is cleared on e_aligncaret with the old value being saved. Then
if the command 'insert 9' is executed it can retrieve and restore the saved
value. If any other command is executed (eg LEFT) then the counter will
remain reset.
	\E R8-R10=caret
	\X Input caret offset [R10,#c_off] can be updated.

e_command
This entry point is called whenever anyone issues a Zap_Command call, or
equivalent, to try and alter a file in a window in your mode. The easiest way
to deal with this is to pass the call onto Zap_DoCommand which will perform
the alteration. However, if you support wordwrap, you may wish to 'fiddle'
the data, or even perform additional operations.
	\E As for Zap_Command

e_compile	This is called when Compile pressed	(\E \X as for e_tab)
The mode should save the file to disc and then try to compile/run it.

e_formattext	This is called when Formattext pressed	(\E \X as for e_tab)
The mode should try and format the current paragraph for its particular
language.

e_run		This is called when Run pressed		(\E \X as for e_tab)
The mode should try and run the program without saving it. Revert to
e_compile code if there is no difference.

e_runandquit	This is called when Runandquit pressed	(\E \X as for e_tab)
This should act as e_run but add a -quit option if possible.

e_basic		This is called when Basic pressed	(\E \X as for e_tab)
This should drop the file into the command line state of the current
language.

e_search
This handles string searches in your mode. R1 gives the reason code. It gives
you a chance to 'doctor' the string. Eg, BASIC may tokenise it. It is also
called to check a match is at a valid offset. Eg, BASIC checks it isn't in a
line number.
	\E R1=0 => Starting a search
	   R0=search string after macros replaced (in a heap block).
	\X R0=possibly new search string.
	OR
	\E R1=1 => Found a match
	   R10=match offset
	   R9=file.
	\X Return R0<0 if the offset invalid.

e_replace
This is called when the user wishes to perform a search and replace. The
replacement string has been calculated for you and it is your job to insert
it. Your default action should be to call Zap_ReplaceArea.
	\E R1=file offset (of match)
	   R2=length (of match)
	   R3=replacement data
	   R4=replacement length. R8/R9

e_selection
This handles region selections/saving. You should check the validity of the
selected area, confining it to lines/paragraphs if you wish.
	\E R0=reason code R8/R9=window
	   R0=0 => starting selection
	   	R10=proposed start caret. You can use the variable car_mode
	   	to find out if the selection is mouse or keyboard (E-Vars).
	   R0=1 => updating selection size
	   	R10=new selection block (car_selection)
	    	You may alter the contents of the selection block.
	   R0=2 => saving selection
	   	R3=data address (a heap block)
	   	R2=data len
           	R4=proposed filetype
	        You may change these provided R3 remains a heap block.
	        (eg BASIC will tokenise it).

e_click
This is called when the user clicks on your window. Default action should be
to call Zap_DefaultClick which will handle R1=0,1 and ignore the rest. Clicks
are registered to any depth so you should modulo the click number with the
number of useful actions you support so they cycle round. Drags are also
passed to you. If the user drags straight away (ie after 1 click) then you
will be sent R1=0. If the user drags after a double click then you will
be sent R1=2 and b3 of R4 will be set. After treble click R1=3 etc.
	\E R1=click depth (0=simple drag 1=single click 2=double click etc)
	   R2=x column (including margin)
	   R3=y row of click in work area characters
	   R4=buttons   b0=adjust pressed
	   		b1=undefined (menus are dealt with by Zap)
	   		b2=select pressed
	   		b3=drag after two or more clicks (given in R1)
	   		b4-b31=reserved
	   R8/R9=window clicked on

e_message
This entry point is called when an unrecognised wimp message is received by
zap. The message is broadcast to all modes. Please IGNORE (ie return) unless
you understand the message number!!
	\E R0=your mode number
	   R1=message block (as sent by wimp)
	   R2=message number (ie R1!16)
	   R3=message type (17 or 19) as returned in R0 by wimp.

e_setwidth
This entry point is used by the SETWIDTH command (Ctrl W) and the 'width'
menu option on the display menu. It is called to read the currently
configured width for this mode (of a window or the default according to R8),
or in order to set the currently configured width. You should access this
width by looking at your mode word w_moden if that's where you keep it, or
using Zap_ModeData if you keep it in the place provided by Zap (this is the
default action of the text mode entry point). Following this call, the editor
window in question will be recreated automatically and your e_width entry
point will be called to calculate the actual display width as usual.
	\E R0=new width user wants or -1 to read the current width
	   R8-R9=window/0 if it is the default width being changed.
	\X R0=current width if it was -1 on entry.

e_listfns
This is called when the command LISTFNS is pressed. \E \X as for e_tab. The
mode should open a throwback buffer with a list of function definitions in.
(eg Use Zap_Search).

e_prevline
This entry point is used in conjunction with e_nextline to find the area on
the screen which needs to be updated after an insertion/deletion. It tells
you in R0 the first file offset being changed and you must tell it the first
file offset (<=R0) to start updating the screen from. Usually you will just
leave R0 unchanged but in the case of a mode using colours - where changing a
character later on in the line may affect earlier colours - you may want to
set this to the start of the current logical line. The cache reference point
(w_cline/w_coff) is moved so that it is most R0, and is thus not corrupted by
the insertion/deletion. If you wish to move it further back (eg if a control
code later in a line effects the formatting of earlier bits) then now is the
time to do so - via Zap_ClipCache.
 e_prevline is called before e_nextline. Complicated colouring modes (eg
colour C mode) need to know what data is being inserted/deleted to decide
what to return for e_prevline/e_nextline. To make this possible, the
follwing data is available:
 f_docom=the command currently being executed:
 0,>5=none   => text not changing (just return with R0 preserved).
 1=insertion => R0=offset that text is being inserted at
 		f_dolen=number of characters being inserted
 		f_dodata=pointer to the text being inserted
 		File is split at the offset R0 with split size >= f_dolen.
 2=deletion  => R0=offset of start of block to delete
 		f_dolen=number of characters being deleted
 		File is split at R0+f_dolen with split size >=0.
 3/4=replace => R0=offset of start of block to replace
 		f_dolen=number of characters to replace
 		f_dodata=replacement block
 		File is split at R0+f_dolen with split size >= f_dolen.
	\E R0=First changed offset in the file. R8/R9
	\X R0=Offset to start updating the screen from.
	   You must preserve the split offset and split size of the file.
00000000  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000040  2a 2a 2a 2a 2a 2a 2a 2a  2a 0a 2a 20 3e 45 2d 45  |*********.* >E-E|
00000050  6e 74 72 79 09 44 6f 63  75 6d 65 6e 74 73 20 74  |ntry.Documents t|
00000060  68 65 20 66 6f 72 6d 61  74 20 6f 66 20 61 20 6d  |he format of a m|
00000070  6f 64 65 20 65 6e 74 72  79 20 70 6f 69 6e 74 20  |ode entry point |
00000080  74 61 62 6c 65 09 2a 0a  2a 2a 2a 2a 2a 2a 2a 2a  |table.*.********|
00000090  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
000000d0  2a 0a 0a 54 68 65 20 6f  66 66 73 65 74 73 20 69  |*..The offsets i|
000000e0  6e 20 74 68 65 20 65 6e  74 72 79 20 70 6f 69 6e  |n the entry poin|
000000f0  74 20 74 61 62 6c 65 20  61 72 65 20 67 69 76 65  |t table are give|
00000100  6e 20 6e 61 6d 65 73 20  62 65 67 69 6e 6e 69 6e  |n names beginnin|
00000110  67 20 27 65 5f 27 2e 20  54 68 65 0a 45 2d 4c 69  |g 'e_'. The.E-Li|
00000120  62 72 61 72 79 20 70 72  6f 67 72 61 6d 20 77 69  |brary program wi|
00000130  6c 6c 20 64 65 66 69 6e  65 20 74 68 65 20 6f 66  |ll define the of|
00000140  66 73 65 74 73 20 66 6f  72 20 79 6f 75 2e 0a 0a  |fsets for you...|
00000150  59 6f 75 20 6d 75 73 74  20 66 69 6c 6c 20 69 6e  |You must fill in|
00000160  20 74 68 65 20 66 69 72  73 74 20 38 20 65 6e 74  | the first 8 ent|
00000170  72 69 65 73 20 6f 66 20  74 68 69 73 20 74 61 62  |ries of this tab|
00000180  6c 65 2e 20 54 68 65 20  72 65 73 74 20 6f 66 20  |le. The rest of |
00000190  74 68 65 20 65 6e 74 72  69 65 73 0a 79 6f 75 20  |the entries.you |
000001a0  6d 61 79 20 6c 65 61 76  65 20 61 73 20 30 20 28  |may leave as 0 (|
000001b0  6f 72 20 6d 6f 72 65 20  73 69 6d 70 6c 79 2c 20  |or more simply, |
000001c0  73 65 74 20 74 68 65 20  74 61 62 6c 65 20 6c 65  |set the table le|
000001d0  6e 67 74 68 20 69 6e 20  74 68 65 20 38 74 68 20  |ngth in the 8th |
000001e0  77 6f 72 64 20 74 6f 0a  33 32 20 62 79 74 65 73  |word to.32 bytes|
000001f0  29 2e 20 54 68 65 20 69  64 65 61 20 6f 66 20 74  |). The idea of t|
00000200  68 65 20 6d 6f 64 65 20  74 61 62 6c 65 2c 20 69  |he mode table, i|
00000210  73 20 74 68 61 74 20 79  6f 75 20 73 70 65 63 69  |s that you speci|
00000220  66 79 20 61 20 42 41 53  45 20 6d 6f 64 65 2e 20  |fy a BASE mode. |
00000230  46 6f 72 0a 61 6c 6c 20  74 68 65 20 65 6e 74 72  |For.all the entr|
00000240  79 20 70 6f 69 6e 74 73  20 28 66 72 6f 6d 20 74  |y points (from t|
00000250  68 65 20 39 74 68 20 6f  6e 77 61 72 64 73 29 20  |he 9th onwards) |
00000260  74 68 61 74 20 61 72 65  20 6f 66 66 20 74 68 65  |that are off the|
00000270  20 65 6e 64 20 6f 66 20  79 6f 75 72 0a 74 61 62  | end of your.tab|
00000280  6c 65 2c 20 6f 72 20 74  68 61 74 20 79 6f 75 20  |le, or that you |
00000290  68 61 76 65 20 6c 65 66  74 20 61 73 20 30 2c 20  |have left as 0, |
000002a0  74 68 65 20 62 61 73 65  20 6d 6f 64 65 20 77 69  |the base mode wi|
000002b0  6c 6c 20 62 65 20 63 61  6c 6c 65 64 20 69 6e 73  |ll be called ins|
000002c0  74 65 61 64 2e 0a 0a 48  65 6e 63 65 2c 20 74 68  |tead...Hence, th|
000002d0  65 20 73 69 6d 70 6c 65  73 74 20 5a 61 70 20 65  |e simplest Zap e|
000002e0  78 74 65 6e 73 69 6f 6e  20 6d 6f 64 65 20 77 6f  |xtension mode wo|
000002f0  75 6c 64 20 6a 75 73 74  20 73 65 74 20 74 68 65  |uld just set the|
00000300  20 62 61 73 65 20 6d 6f  64 65 20 61 73 20 30 20  | base mode as 0 |
00000310  28 69 65 2c 0a 54 45 58  54 29 20 61 6e 64 20 6c  |(ie,.TEXT) and l|
00000320  65 61 76 65 20 74 68 65  20 72 65 73 74 20 61 73  |eave the rest as|
00000330  20 30 2e 20 59 6f 75 20  77 69 6c 6c 20 74 68 65  | 0. You will the|
00000340  6e 20 67 65 74 20 61 20  63 6c 6f 6e 65 20 6f 66  |n get a clone of|
00000350  20 74 68 65 20 74 65 78  74 20 6d 6f 64 65 2e 0a  | the text mode..|
00000360  0a 49 6e 20 67 65 6e 65  72 61 6c 20 74 68 65 20  |.In general the |
00000370  66 6f 6c 6c 6f 77 69 6e  67 20 72 65 67 69 73 74  |following regist|
00000380  65 72 20 63 6f 6e 76 65  6e 74 69 6f 6e 73 20 61  |er conventions a|
00000390  72 65 20 75 73 65 64 3a  0a 0a 09 52 32 09 43 75  |re used:...R2.Cu|
000003a0  72 72 65 6e 74 20 63 6f  6c 75 6d 6e 20 69 6e 20  |rrent column in |
000003b0  63 68 61 72 61 63 74 65  72 73 20 28 73 65 65 20  |characters (see |
000003c0  45 2d 57 69 6e 64 6f 77  73 29 0a 09 52 33 09 43  |E-Windows)..R3.C|
000003d0  75 72 72 65 6e 74 20 6c  69 6e 65 20 69 6e 20 63  |urrent line in c|
000003e0  68 61 72 61 63 74 65 72  73 20 28 73 65 65 20 45  |haracters (see E|
000003f0  2d 57 69 6e 64 6f 77 73  29 0a 09 52 38 09 57 69  |-Windows)..R8.Wi|
00000400  6e 64 6f 77 20 62 6c 6f  63 6b 20 70 6f 69 6e 74  |ndow block point|
00000410  65 72 20 2f 20 30 20 74  6f 20 63 68 61 6e 67 65  |er / 0 to change|
00000420  20 74 68 65 20 64 65 66  61 75 6c 74 20 63 6f 6e  | the default con|
00000430  66 69 67 0a 09 52 39 09  46 69 6c 65 20 62 6c 6f  |fig..R9.File blo|
00000440  63 6b 20 70 6f 69 6e 74  65 72 20 2f 20 30 20 74  |ck pointer / 0 t|
00000450  6f 20 63 68 61 6e 67 65  20 74 68 65 20 64 65 66  |o change the def|
00000460  61 75 6c 74 20 63 6f 6e  66 69 67 0a 09 52 31 30  |ault config..R10|
00000470  09 43 75 72 73 6f 72 20  62 6c 6f 63 6b 20 70 6f  |.Cursor block po|
00000480  69 6e 74 65 72 0a 09 52  31 31 09 59 6f 75 72 20  |inter..R11.Your |
00000490  65 78 74 65 6e 73 69 6f  6e 20 6d 6f 64 65 20 77  |extension mode w|
000004a0  6f 72 6b 73 70 61 63 65  20 28 70 72 69 76 61 74  |orkspace (privat|
000004b0  65 20 77 6f 72 64 29 0a  09 52 31 32 09 5a 61 70  |e word)..R12.Zap|
000004c0  73 20 77 6f 72 6b 73 70  61 63 65 20 28 70 72 69  |s workspace (pri|
000004d0  76 61 74 65 20 77 6f 72  64 29 0a 0a 49 6e 20 67  |vate word)..In g|
000004e0  65 6e 65 72 61 6c 20 74  68 65 20 65 6e 74 72 79  |eneral the entry|
000004f0  20 70 6f 69 6e 74 73 20  68 61 76 65 20 65 6e 74  | points have ent|
00000500  72 79 20 61 6e 64 20 65  78 69 74 20 63 6f 6e 64  |ry and exit cond|
00000510  69 74 69 6f 6e 73 3a 0a  0a 09 5c 45 20 52 30 2d  |itions:...\E R0-|
00000520  52 31 30 3d 70 61 72 61  6d 65 74 65 72 73 20 52  |R10=parameters R|
00000530  31 31 3d 79 6f 75 72 20  77 6f 72 6b 73 70 61 63  |11=your workspac|
00000540  65 0a 09 20 20 20 52 31  32 3d 5a 61 70 27 73 20  |e..   R12=Zap's |
00000550  77 6f 72 6b 73 70 61 63  65 20 52 31 33 3d 46 44  |workspace R13=FD|
00000560  20 73 74 61 63 6b 20 52  31 34 3d 72 65 74 75 72  | stack R14=retur|
00000570  6e 20 61 64 64 72 0a 09  5c 58 20 59 6f 75 20 6d  |n addr..\X You m|
00000580  75 73 74 20 73 61 76 65  20 52 31 2d 52 31 31 20  |ust save R1-R11 |
00000590  28 75 6e 6c 65 73 73 20  6f 74 68 65 72 77 69 73  |(unless otherwis|
000005a0  65 20 6d 65 6e 74 69 6f  6e 65 64 29 2e 0a 09 20  |e mentioned)... |
000005b0  20 20 59 6f 75 20 6d 61  79 20 63 6f 72 72 75 70  |  You may corrup|
000005c0  74 20 52 30 20 61 6e 64  20 66 6c 61 67 73 2e 0a  |t R0 and flags..|
000005d0  09 20 20 20 53 65 74 20  56 20 66 6c 61 67 20 61  |.   Set V flag a|
000005e0  6e 64 20 70 75 74 20 52  30 3d 65 72 72 6f 72 20  |nd put R0=error |
000005f0  62 6c 6f 63 6b 20 70 6f  69 6e 74 65 72 20 6f 6e  |block pointer on|
00000600  20 61 6e 20 65 72 72 6f  72 2e 0a 0a 53 65 65 20  | an error...See |
00000610  74 68 65 20 45 2d 5a 61  70 43 61 6c 6c 73 20 66  |the E-ZapCalls f|
00000620  69 6c 65 20 66 6f 72 20  6d 6f 72 65 20 64 65 74  |ile for more det|
00000630  61 69 6c 73 20 6f 6e 20  6d 79 20 65 6e 74 72 79  |ails on my entry|
00000640  2f 65 78 69 74 20 73 79  6e 74 61 78 2e 0a 0a 41  |/exit syntax...A|
00000650  6c 6c 20 6f 66 66 73 65  74 73 20 67 69 76 65 6e  |ll offsets given|
00000660  20 69 6e 20 74 68 65 20  74 61 62 6c 65 20 62 65  | in the table be|
00000670  6c 6f 77 20 6d 75 73 74  20 62 65 20 66 72 6f 6d  |low must be from|
00000680  20 74 68 65 20 73 74 61  72 74 20 6f 66 20 74 68  | the start of th|
00000690  65 20 6d 6f 64 75 6c 65  2e 0a 48 65 6e 63 65 20  |e module..Hence |
000006a0  74 68 65 20 74 61 62 6c  65 20 69 73 20 72 65 6c  |the table is rel|
000006b0  6f 63 61 74 61 62 6c 65  2e 20 5a 61 70 20 66 69  |ocatable. Zap fi|
000006c0  6e 64 73 20 74 68 65 20  73 74 61 72 74 20 61 64  |nds the start ad|
000006d0  64 72 65 73 73 20 6f 66  20 79 6f 75 72 20 6d 6f  |dress of your mo|
000006e0  64 75 6c 65 0a 76 69 61  20 74 68 65 20 66 69 72  |dule.via the fir|
000006f0  73 74 20 74 61 62 6c 65  20 65 6e 74 72 79 20 28  |st table entry (|
00000700  65 5f 6d 6f 64 75 6c 65  29 2e 20 49 74 20 75 73  |e_module). It us|
00000710  65 73 20 74 68 69 73 20  61 6e 64 20 61 6e 20 4f  |es this and an O|
00000720  53 5f 4d 6f 64 75 6c 65  20 63 61 6c 6c 20 74 6f  |S_Module call to|
00000730  0a 64 65 74 65 72 6d 69  6e 65 20 74 68 65 20 61  |.determine the a|
00000740  64 64 72 65 73 73 20 6f  66 20 79 6f 75 72 20 77  |ddress of your w|
00000750  6f 72 6b 73 70 61 63 65  20 28 74 6f 20 70 61 73  |orkspace (to pas|
00000760  73 20 69 6e 20 52 31 31  29 2e 20 41 6c 6c 20 73  |s in R11). All s|
00000770  74 72 69 6e 67 73 20 73  68 6f 75 6c 64 0a 62 65  |trings should.be|
00000780  20 30 20 74 65 72 6d 69  6e 61 74 65 64 2e 0a 0a  | 0 terminated...|
00000790  45 6e 74 72 79 20 70 6f  69 6e 74 73 20 66 6f 72  |Entry points for|
000007a0  20 61 72 62 69 74 72 61  72 79 20 6d 6f 64 65 73  | arbitrary modes|
000007b0  20 6d 61 79 20 62 65 20  63 61 6c 6c 65 64 20 75  | may be called u|
000007c0  73 69 6e 67 20 5a 61 70  5f 43 61 6c 6c 4d 6f 64  |sing Zap_CallMod|
000007d0  65 2c 0a 5a 61 70 5f 43  61 6c 6c 47 69 76 65 6e  |e,.Zap_CallGiven|
000007e0  4d 6f 64 65 20 6f 72 20  5a 61 70 5f 42 61 73 65  |Mode or Zap_Base|
000007f0  4d 6f 64 65 2e 20 49 66  20 6e 6f 6e 65 20 6f 66  |Mode. If none of|
00000800  20 74 68 65 73 65 20 77  69 6c 6c 20 64 6f 2c 20  | these will do, |
00000810  74 68 65 6e 20 75 73 65  0a 5a 61 70 5f 52 65 61  |then use.Zap_Rea|
00000820  64 4d 6f 64 65 20 74 6f  20 66 69 6e 64 20 74 68  |dMode to find th|
00000830  65 20 74 61 62 6c 65 20  65 6e 74 72 79 20 6c 69  |e table entry li|
00000840  6e 6b 65 64 20 70 6f 69  6e 74 73 20 61 6e 64 20  |nked points and |
00000850  74 68 65 20 61 64 64 72  65 73 73 20 6f 66 20 74  |the address of t|
00000860  68 65 0a 6d 6f 64 65 27  73 20 77 6f 72 6b 73 70  |he.mode's worksp|
00000870  61 63 65 20 61 6e 64 20  74 68 65 20 65 6e 74 72  |ace and the entr|
00000880  79 20 70 6f 69 6e 74 20  63 61 6e 20 62 65 20 63  |y point can be c|
00000890  61 6c 6c 65 64 20 64 69  72 65 63 74 6c 79 2e 0a  |alled directly..|
000008a0  0a 45 61 63 68 20 6d 6f  64 65 20 68 61 73 20 61  |.Each mode has a|
000008b0  20 77 6f 72 64 20 6f 66  20 77 6f 72 6b 73 70 61  | word of workspa|
000008c0  63 65 20 72 65 73 65 72  76 65 64 20 69 6e 20 74  |ce reserved in t|
000008d0  68 65 20 77 69 6e 64 6f  77 20 62 6c 6f 63 6b 20  |he window block |
000008e0  28 70 6f 69 6e 74 65 64  20 74 6f 0a 62 79 20 52  |(pointed to.by R|
000008f0  38 29 20 66 6f 72 20 65  61 63 68 20 66 69 6c 65  |8) for each file|
00000900  2e 20 41 20 6d 6f 64 65  20 69 73 20 72 65 73 70  |. A mode is resp|
00000910  6f 6e 73 69 62 6c 65 20  66 6f 72 20 73 74 6f 72  |onsible for stor|
00000920  69 6e 67 20 74 68 65 20  63 75 72 72 65 6e 74 20  |ing the current |
00000930  6f 70 74 69 6f 6e 73 0a  69 6e 20 74 68 65 69 72  |options.in their|
00000940  20 6d 6f 64 65 20 77 6f  72 64 20 77 68 65 6e 20  | mode word when |
00000950  74 68 65 20 75 73 65 72  20 63 68 61 6e 67 65 73  |the user changes|
00000960  20 6d 6f 64 65 20 28 73  65 65 20 65 5f 73 74 61  | mode (see e_sta|
00000970  72 74 2f 65 5f 65 6e 64  29 2e 20 54 68 65 72 65  |rt/e_end). There|
00000980  0a 61 72 65 20 5a 61 70  20 63 61 6c 6c 73 20 70  |.are Zap calls p|
00000990  72 6f 76 69 64 65 64 20  74 6f 20 6d 61 6b 65 20  |rovided to make |
000009a0  74 68 69 73 20 65 61 73  69 65 72 20 66 6f 72 20  |this easier for |
000009b0  79 6f 75 2e 20 49 66 20  79 6f 75 20 6e 65 65 64  |you. If you need|
000009c0  20 6d 6f 72 65 20 74 68  61 6e 0a 6f 6e 65 20 77  | more than.one w|
000009d0  6f 72 64 20 6f 66 20 77  6f 72 6b 73 70 61 63 65  |ord of workspace|
000009e0  20 74 68 65 6e 20 74 68  65 20 6d 6f 64 65 20 77  | then the mode w|
000009f0  6f 72 64 20 63 61 6e 20  73 74 6f 72 65 20 74 68  |ord can store th|
00000a00  65 20 70 6f 69 6e 74 65  72 20 74 6f 20 61 20 62  |e pointer to a b|
00000a10  6c 6f 63 6b 20 6f 66 0a  77 6f 72 6b 73 70 61 63  |lock of.workspac|
00000a20  65 20 69 66 20 79 6f 75  20 73 65 74 20 61 20 66  |e if you set a f|
00000a30  6c 61 67 20 69 6e 20 65  5f 6d 6f 64 65 2e 20 53  |lag in e_mode. S|
00000a40  65 65 20 45 2d 57 69 6e  64 6f 77 73 20 28 77 5f  |ee E-Windows (w_|
00000a50  6d 6f 64 65 30 2e 2e 2e  29 20 61 6e 64 20 45 2d  |mode0...) and E-|
00000a60  56 61 72 73 0a 28 6f 70  74 5f 6d 6f 64 65 30 2e  |Vars.(opt_mode0.|
00000a70  2e 2e 29 2e 0a 0a 54 68  65 20 65 6e 74 72 79 20  |..)...The entry |
00000a80  70 6f 69 6e 74 73 0a 3d  3d 3d 3d 3d 3d 3d 3d 3d  |points.=========|
00000a90  3d 3d 3d 3d 3d 3d 3d 0a  0a 65 5f 6d 6f 64 75 6c  |=======..e_modul|
00000aa0  65 0a 54 68 69 73 20 67  69 76 65 73 20 74 68 65  |e.This gives the|
00000ab0  20 74 61 62 6c 65 20 6f  66 66 73 65 74 20 66 72  | table offset fr|
00000ac0  6f 6d 20 74 68 65 20 6d  6f 64 75 6c 65 20 73 74  |om the module st|
00000ad0  61 72 74 20 73 6f 20 74  68 61 74 20 74 68 65 20  |art so that the |
00000ae0  6d 6f 64 75 6c 65 20 73  74 61 72 74 0a 6d 61 79  |module start.may|
00000af0  20 62 65 20 63 61 6c 63  75 6c 61 74 65 64 20 62  | be calculated b|
00000b00  79 20 5a 61 70 2e 20 49  65 2c 20 6d 6f 64 75 6c  |y Zap. Ie, modul|
00000b10  65 20 73 74 61 72 74 20  3d 20 61 64 64 72 65 73  |e start = addres|
00000b20  73 20 6f 66 20 74 61 62  6c 65 20 73 74 61 72 74  |s of table start|
00000b30  20 2d 20 74 68 69 73 0a  6f 66 66 73 65 74 2e 0a  | - this.offset..|
00000b40  0a 65 5f 74 69 74 6c 65  0a 4f 66 66 73 65 74 20  |.e_title.Offset |
00000b50  6f 66 20 74 68 65 20 6d  6f 64 65 20 74 69 74 6c  |of the mode titl|
00000b60  65 20 73 74 72 69 6e 67  20 74 6f 20 62 65 20 75  |e string to be u|
00000b70  73 65 64 20 69 6e 20 74  68 65 20 27 4d 6f 64 65  |sed in the 'Mode|
00000b80  27 20 6d 65 6e 75 2e 20  49 74 20 73 68 6f 75 6c  |' menu. It shoul|
00000b90  64 20 62 65 0a 61 74 20  6d 6f 73 74 20 37 20 63  |d be.at most 7 c|
00000ba0  68 61 72 73 20 6c 6f 6e  67 2e 20 28 65 67 20 27  |hars long. (eg '|
00000bb0  42 41 53 49 43 27 29 0a  0a 65 5f 61 75 74 68 6f  |BASIC')..e_autho|
00000bc0  72 0a 4f 66 66 73 65 74  20 6f 66 20 74 68 65 20  |r.Offset of the |
00000bd0  61 75 74 68 6f 72 20 6e  61 6d 65 20 73 74 72 69  |author name stri|
00000be0  6e 67 20 28 65 67 20 27  44 6f 6d 69 6e 69 63 20  |ng (eg 'Dominic |
00000bf0  53 79 6d 65 73 27 29 2e  0a 0a 65 5f 62 61 73 65  |Symes')...e_base|
00000c00  6d 6f 64 65 0a 47 69 76  65 73 20 74 68 65 20 6d  |mode.Gives the m|
00000c10  6f 64 65 20 6f 6e 20 77  68 69 63 68 20 74 6f 20  |ode on which to |
00000c20  62 61 73 65 20 6e 75 6c  6c 20 65 6e 74 72 79 20  |base null entry |
00000c30  70 6f 69 6e 74 73 2e 20  43 75 72 72 65 6e 74 20  |points. Current |
00000c40  6d 6f 64 65 73 20 61 72  65 3a 20 30 3d 54 65 78  |modes are: 0=Tex|
00000c50  74 0a 31 3d 62 79 74 65  20 32 3d 77 6f 72 64 20  |t.1=byte 2=word |
00000c60  33 3d 61 73 63 69 69 20  34 3d 68 65 78 20 35 3d  |3=ascii 4=hex 5=|
00000c70  62 61 73 69 63 20 36 3d  62 61 73 74 78 74 20 37  |basic 6=bastxt 7|
00000c80  3d 63 6d 6f 64 65 20 31  31 3d 74 68 72 6f 77 62  |=cmode 11=throwb|
00000c90  61 63 6b 0a 31 32 3d 74  61 73 6b 77 69 6e 64 6f  |ack.12=taskwindo|
00000ca0  77 2e 20 4e 65 65 64 6c  65 73 73 20 74 6f 20 73  |w. Needless to s|
00000cb0  61 79 2c 20 69 66 20 79  6f 75 20 77 69 73 68 20  |ay, if you wish |
00000cc0  74 6f 20 63 6c 6f 6e 65  20 74 68 65 20 42 41 53  |to clone the BAS|
00000cd0  49 43 20 6d 6f 64 65 2c  20 79 6f 75 27 64 0a 62  |IC mode, you'd.b|
00000ce0  65 74 74 65 72 20 62 65  20 73 75 72 65 20 74 68  |etter be sure th|
00000cf0  61 74 20 74 68 65 20 5a  61 70 5f 42 61 73 69 63  |at the Zap_Basic|
00000d00  20 6d 6f 64 75 6c 65 20  69 6e 69 74 69 61 6c 69  | module initiali|
00000d10  73 65 64 20 62 65 66 6f  72 65 20 79 6f 75 72 73  |sed before yours|
00000d20  21 0a 0a 65 5f 6d 6f 64  65 0a 47 69 76 65 73 20  |!..e_mode.Gives |
00000d30  74 68 65 20 6d 6f 64 65  20 6e 75 6d 62 65 72 20  |the mode number |
00000d40  79 6f 75 20 77 6f 75 6c  64 20 6c 69 6b 65 20 74  |you would like t|
00000d50  6f 20 62 65 20 69 6e 20  62 69 74 73 20 62 30 2d  |o be in bits b0-|
00000d60  62 37 2e 20 42 69 74 73  20 38 2d 33 31 20 63 6f  |b7. Bits 8-31 co|
00000d70  6e 74 61 69 6e 0a 66 6c  61 67 73 20 61 73 20 66  |ntain.flags as f|
00000d80  6f 6c 6c 6f 77 73 3a 0a  09 62 38 09 53 65 74 20  |ollows:..b8.Set |
00000d90  74 6f 20 72 65 63 65 69  76 65 20 52 41 57 20 6b  |to receive RAW k|
00000da0  65 79 62 6f 61 72 64 20  69 6e 70 75 74 2e 20 41  |eyboard input. A|
00000db0  6c 6c 20 6b 65 79 20 70  72 65 73 73 65 73 20 61  |ll key presses a|
00000dc0  72 65 20 73 65 6e 74 0a  09 09 74 6f 20 65 5f 63  |re sent...to e_c|
00000dd0  68 61 72 2e 20 5a 61 70  20 6b 65 79 20 63 6f 64  |har. Zap key cod|
00000de0  65 73 20 67 72 65 61 74  65 72 20 74 68 61 6e 20  |es greater than |
00000df0  26 46 46 20 61 72 65 20  73 65 6e 74 20 61 73 20  |&FF are sent as |
00000e00  61 0a 09 09 7a 65 72 6f  20 62 79 74 65 20 66 6f  |a...zero byte fo|
00000e10  6c 6c 6f 77 65 64 20 62  79 20 74 68 65 20 6c 6f  |llowed by the lo|
00000e20  77 20 62 79 74 65 2e 0a  09 62 39 09 53 65 74 20  |w byte...b9.Set |
00000e30  74 6f 20 67 65 74 20 74  61 73 6b 77 69 6e 64 6f  |to get taskwindo|
00000e40  77 20 73 74 79 6c 65 20  6b 65 79 62 6f 61 72 64  |w style keyboard|
00000e50  20 69 6e 70 75 74 20 70  61 73 73 65 64 20 74 6f  | input passed to|
00000e60  20 65 5f 63 68 61 72 73  2e 0a 09 09 54 68 69 73  | e_chars....This|
00000e70  20 64 69 66 66 65 72 73  20 66 72 6f 6d 20 6e 6f  | differs from no|
00000e80  72 6d 61 6c 20 65 5f 63  68 61 72 73 20 65 6e 74  |rmal e_chars ent|
00000e90  72 79 20 69 6e 20 74 68  61 74 3a 0a 09 09 31 29  |ry in that:...1)|
00000ea0  20 44 65 6c 65 74 65 20  69 73 20 70 61 73 73 65  | Delete is passe|
00000eb0  64 20 6f 6e 20 61 73 20  26 37 46 20 69 6e 73 74  |d on as &7F inst|
00000ec0  65 61 64 20 6f 66 20 63  61 6c 6c 69 6e 67 20 65  |ead of calling e|
00000ed0  5f 64 65 6c 65 74 65 0a  09 09 32 29 20 43 68 61  |_delete...2) Cha|
00000ee0  72 61 63 74 65 72 73 20  26 32 30 2d 26 46 46 20  |racters &20-&FF |
00000ef0  61 72 65 20 70 61 73 73  65 64 20 6f 6e 20 72 65  |are passed on re|
00000f00  67 61 72 64 6c 65 73 73  20 6f 66 20 6d 61 70 70  |gardless of mapp|
00000f10  69 6e 67 0a 09 09 33 29  20 49 66 20 6e 6f 74 20  |ing...3) If not |
00000f20  69 6e 20 43 4f 50 59 20  6d 6f 64 65 20 74 68 65  |in COPY mode the|
00000f30  6e 20 74 68 65 20 63 75  72 73 6f 72 20 6b 65 79  |n the cursor key|
00000f40  73 20 61 72 65 20 70 61  73 73 65 64 20 6f 6e 0a  |s are passed on.|
00000f50  09 09 20 20 20 61 73 20  61 20 30 20 62 79 74 65  |..   as a 0 byte|
00000f60  20 66 6f 6c 6c 6f 77 65  64 20 62 79 20 62 6f 74  | followed by bot|
00000f70  74 6f 6d 20 38 20 62 69  74 73 20 6f 66 20 74 68  |tom 8 bits of th|
00000f80  65 20 77 69 6d 70 27 73  20 63 6f 64 65 2e 0a 09  |e wimp's code...|
00000f90  09 20 20 20 53 69 6d 69  6c 61 72 6c 79 20 54 41  |.   Similarly TA|
00000fa0  42 2e 0a 09 09 34 29 20  52 65 74 75 72 6e 20 61  |B....4) Return a|
00000fb0  6e 64 20 45 73 63 61 70  65 20 61 72 65 20 70 61  |nd Escape are pa|
00000fc0  73 73 65 64 20 6f 6e 20  61 73 20 26 30 44 20 61  |ssed on as &0D a|
00000fd0  6e 64 20 26 31 42 2e 0a  09 09 54 68 69 73 20 69  |nd &1B....This i|
00000fe0  73 20 73 75 62 6a 65 63  74 20 74 6f 20 63 68 61  |s subject to cha|
00000ff0  6e 67 65 73 20 2d 20 63  6f 6e 74 61 63 74 20 6d  |nges - contact m|
00001000  65 2e 0a 09 62 31 30 09  53 65 74 20 74 6f 20 69  |e...b10.Set to i|
00001010  6e 64 69 63 61 74 65 20  74 68 61 74 20 79 6f 75  |ndicate that you|
00001020  20 75 73 65 20 61 20 6d  6f 64 65 20 77 6f 72 64  | use a mode word|
00001030  20 69 6e 20 61 20 77 69  6e 64 6f 77 20 62 6c 6f  | in a window blo|
00001040  63 6b 0a 09 09 28 65 67  20 77 5f 6d 6f 64 65 6e  |ck...(eg w_moden|
00001050  29 20 74 6f 20 70 6f 69  6e 74 20 74 6f 20 61 20  |) to point to a |
00001060  62 6c 6f 63 6b 20 6f 66  20 64 61 74 61 2e 20 53  |block of data. S|
00001070  65 65 20 45 2d 57 69 6e  64 6f 77 73 0a 09 09 66  |ee E-Windows...f|
00001080  6f 72 20 74 68 65 20 66  6f 72 6d 61 74 20 74 68  |or the format th|
00001090  69 73 20 62 6c 6f 63 6b  20 6d 75 73 74 20 74 61  |is block must ta|
000010a0  6b 65 2e 0a 09 62 33 31  09 53 65 74 20 74 6f 20  |ke...b31.Set to |
000010b0  6f 76 65 72 77 72 69 74  65 20 61 6e 79 20 6d 6f  |overwrite any mo|
000010c0  64 65 20 61 6c 72 65 61  64 79 20 75 73 69 6e 67  |de already using|
000010d0  20 74 68 69 73 20 6d 6f  64 65 20 6e 75 6d 62 65  | this mode numbe|
000010e0  72 2e 0a 09 4f 74 68 65  72 73 20 62 69 74 73 20  |r...Others bits |
000010f0  61 72 65 20 72 65 73 65  72 76 65 64 20 61 6e 64  |are reserved and|
00001100  20 73 68 6f 75 6c 64 20  62 65 20 73 65 74 20 74  | should be set t|
00001110  6f 20 30 2e 0a 09 49 66  20 62 33 31 20 69 73 20  |o 0...If b31 is |
00001120  6e 6f 74 20 73 65 74 20  74 68 65 6e 20 79 6f 75  |not set then you|
00001130  20 61 72 65 20 61 6c 6c  6f 63 61 74 65 64 20 74  | are allocated t|
00001140  68 65 20 6e 65 78 74 20  66 72 65 65 20 6d 6f 64  |he next free mod|
00001150  65 20 69 66 20 74 68 65  0a 09 6f 6e 65 20 79 6f  |e if the..one yo|
00001160  75 20 77 61 6e 74 65 64  20 69 73 20 62 65 69 6e  |u wanted is bein|
00001170  67 20 75 73 65 64 2e 0a  0a 65 5f 69 6e 69 74 0a  |g used...e_init.|
00001180  43 61 6c 6c 65 64 20 61  74 20 76 61 72 69 6f 75  |Called at variou|
00001190  73 20 70 6f 69 6e 74 73  20 77 68 65 6e 20 5a 61  |s points when Za|
000011a0  70 20 69 73 20 73 74 61  72 74 69 6e 67 20 75 70  |p is starting up|
000011b0  2f 64 79 69 6e 67 20 6f  72 20 77 61 6e 74 73 20  |/dying or wants |
000011c0  74 6f 20 67 69 76 65 20  79 6f 75 72 0a 6d 6f 64  |to give your.mod|
000011d0  65 20 61 20 63 68 61 6e  63 65 20 74 6f 20 69 6e  |e a chance to in|
000011e0  74 65 72 63 65 70 74 20  61 6e 20 6f 70 65 72 61  |tercept an opera|
000011f0  74 69 6f 6e 2e 20 4e 6f  74 65 20 74 68 61 74 20  |tion. Note that |
00001200  5a 61 70 20 77 69 6c 6c  20 61 75 74 6f 6d 61 74  |Zap will automat|
00001210  69 63 61 6c 6c 79 0a 6b  69 6c 6c 20 79 6f 75 72  |ically.kill your|
00001220  20 6d 6f 64 75 6c 65 20  6f 6e 20 64 79 69 6e 67  | module on dying|
00001230  20 75 6e 6c 65 73 73 20  79 6f 75 20 74 65 6c 6c  | unless you tell|
00001240  20 69 74 20 6f 74 68 65  72 77 69 73 65 2e 20 59  | it otherwise. Y|
00001250  6f 75 20 73 68 6f 75 6c  64 20 75 73 65 20 72 65  |ou should use re|
00001260  61 73 6f 6e 0a 63 6f 64  65 20 32 20 74 6f 20 63  |ason.code 2 to c|
00001270  6c 61 69 6d 20 61 6e 79  20 62 75 66 66 65 72 73  |laim any buffers|
00001280  20 66 72 6f 6d 20 5a 61  70 2e 20 49 20 61 6d 20  | from Zap. I am |
00001290  61 74 20 6c 69 62 65 72  74 79 20 74 6f 20 61 64  |at liberty to ad|
000012a0  64 20 65 78 74 72 61 20  72 65 61 73 6f 6e 0a 63  |d extra reason.c|
000012b0  6f 64 65 73 20 73 6f 20  70 6c 65 61 73 65 20 72  |odes so please r|
000012c0  65 74 75 72 6e 20 77 69  74 68 20 61 6c 6c 20 72  |eturn with all r|
000012d0  65 67 69 73 74 65 72 73  20 75 6e 61 6c 74 65 72  |egisters unalter|
000012e0  65 64 20 69 66 20 79 6f  75 20 72 65 63 65 69 76  |ed if you receiv|
000012f0  65 20 61 6e 0a 75 6e 72  65 63 6f 67 6e 69 73 65  |e an.unrecognise|
00001300  64 20 63 6f 64 65 2e 0a  20 20 20 20 5c 45 20 52  |d code..    \E R|
00001310  31 3d 72 65 61 73 6f 6e  20 63 6f 64 65 20 28 61  |1=reason code (a|
00001320  6e 64 20 6f 74 68 65 72  20 72 65 67 69 73 74 65  |nd other registe|
00001330  72 73 20 6d 61 79 20 68  6f 6c 64 20 76 61 6c 75  |rs may hold valu|
00001340  65 73 20 64 65 70 65 6e  64 65 6e 74 20 6f 6e 20  |es dependent on |
00001350  69 74 29 0a 20 20 20 20  5c 58 20 53 61 76 65 20  |it).    \X Save |
00001360  52 31 2d 52 31 31 20 61  73 20 75 73 75 61 6c 20  |R1-R11 as usual |
00001370  75 6e 6c 65 73 73 20 6f  74 68 65 72 77 69 73 65  |unless otherwise|
00001380  20 73 74 61 74 65 64 20  62 65 6c 6f 77 2e 0a 20  | stated below.. |
00001390  54 68 65 20 72 65 61 73  6f 6e 20 63 6f 64 65 73  |The reason codes|
000013a0  20 61 72 65 3a 0a 20 52  31 3d 30 20 3d 3e 20 5a  | are:. R1=0 => Z|
000013b0  61 70 20 69 73 20 71 75  69 74 74 69 6e 67 20 61  |ap is quitting a|
000013c0  6e 64 20 61 62 6f 75 74  20 74 6f 20 6b 69 6c 6c  |nd about to kill|
000013d0  20 79 6f 75 72 20 6d 6f  64 75 6c 65 2e 0a 09 20  | your module... |
000013e0  52 65 74 75 72 6e 20 52  30 3d 2d 31 20 74 6f 20  |Return R0=-1 to |
000013f0  73 74 6f 70 20 74 68 69  73 20 28 65 67 20 69 66  |stop this (eg if|
00001400  20 79 6f 75 27 76 65 20  6d 6f 72 65 20 74 68 61  | you've more tha|
00001410  6e 20 6f 6e 65 20 6d 6f  64 65 29 2e 0a 20 52 31  |n one mode).. R1|
00001420  3d 31 20 3d 3e 20 5a 61  70 20 68 61 73 20 6a 75  |=1 => Zap has ju|
00001430  73 74 20 73 74 61 72 74  65 64 20 62 75 74 20 6e  |st started but n|
00001440  6f 74 20 73 65 74 20 75  70 20 69 74 73 20 68 65  |ot set up its he|
00001450  61 70 20 79 65 74 2e 0a  20 09 20 52 30 3d 74 68  |ap yet.. . R0=th|
00001460  65 20 6d 6f 64 65 20 6e  75 6d 62 65 72 20 61 73  |e mode number as|
00001470  73 69 67 6e 65 64 20 74  6f 20 79 6f 75 72 20 6d  |signed to your m|
00001480  6f 64 65 2e 0a 20 09 20  59 6f 75 20 73 68 6f 75  |ode.. . You shou|
00001490  6c 64 20 6e 6f 74 65 20  74 68 65 20 6d 6f 64 65  |ld note the mode|
000014a0  20 6e 75 6d 62 65 72 20  74 68 61 74 20 68 61 73  | number that has|
000014b0  20 61 63 74 75 61 6c 6c  79 20 62 65 65 6e 20 61  | actually been a|
000014c0  73 73 69 67 6e 65 64 20  74 6f 0a 20 09 20 79 6f  |ssigned to. . yo|
000014d0  75 20 61 6e 64 20 73 74  6f 72 65 20 69 74 20 69  |u and store it i|
000014e0  6e 20 79 6f 75 72 20 6d  6f 64 75 6c 65 20 73 6f  |n your module so|
000014f0  6d 65 77 68 65 72 65 2e  20 54 68 69 73 20 69 73  |mewhere. This is|
00001500  20 6e 6f 74 20 67 75 61  72 61 6e 74 65 65 64 0a  | not guaranteed.|
00001510  20 09 20 74 6f 20 62 65  20 74 68 65 20 6f 6e 65  | . to be the one|
00001520  20 79 6f 75 20 61 73 6b  65 64 20 66 6f 72 2e 0a  | you asked for..|
00001530  20 52 31 3d 32 20 3d 3e  20 5a 61 70 20 68 61 73  | R1=2 => Zap has|
00001540  20 73 74 61 72 74 65 64  20 61 6e 64 20 73 65 74  | started and set|
00001550  20 75 70 20 69 74 73 20  68 65 61 70 2e 20 4f 6e  | up its heap. On|
00001560  20 74 68 69 73 20 63 61  6c 6c 20 79 6f 75 20 73  | this call you s|
00001570  68 6f 75 6c 64 20 63 68  65 63 6b 0a 09 20 79 6f  |hould check.. yo|
00001580  75 72 20 6d 6f 64 65 20  77 6f 72 64 20 6f 70 74  |ur mode word opt|
00001590  5f 6d 6f 64 65 6e 20 74  6f 20 73 65 65 20 69 66  |_moden to see if|
000015a0  20 69 74 27 73 20 7a 65  72 6f 2e 20 49 66 20 73  | it's zero. If s|
000015b0  6f 20 74 68 65 6e 20 79  6f 75 20 73 68 6f 75 6c  |o then you shoul|
000015c0  64 0a 09 20 69 6e 69 74  69 61 6c 69 73 65 20 69  |d.. initialise i|
000015d0  74 20 74 6f 20 61 20 73  65 6e 73 69 62 6c 65 20  |t to a sensible |
000015e0  64 65 66 61 75 6c 74 20  76 61 6c 75 65 2e 20 28  |default value. (|
000015f0  53 65 65 20 45 2d 56 61  72 73 29 20 59 6f 75 20  |See E-Vars) You |
00001600  73 68 6f 75 6c 64 0a 09  20 61 6c 73 6f 20 75 73  |should.. also us|
00001610  65 20 74 68 69 73 20 63  61 6c 6c 20 74 6f 20 63  |e this call to c|
00001620  6c 61 69 6d 20 61 6e 79  20 62 75 66 66 65 72 73  |laim any buffers|
00001630  20 79 6f 75 20 6e 65 65  64 2e 0a 20 52 31 3d 33  | you need.. R1=3|
00001640  20 3d 3e 20 5a 61 70 20  69 73 20 64 65 6c 65 74  | => Zap is delet|
00001650  69 6e 67 20 61 20 66 69  6c 65 20 77 69 74 68 20  |ing a file with |
00001660  79 6f 75 72 20 6d 6f 64  65 20 6e 75 6d 62 65 72  |your mode number|
00001670  20 69 6e 20 66 5f 63 6d  6f 64 65 2e 20 52 39 3d  | in f_cmode. R9=|
00001680  66 69 6c 65 0a 09 20 62  6c 6f 63 6b 20 6f 6e 20  |file.. block on |
00001690  65 6e 74 72 79 2e 20 53  65 65 20 45 2d 46 69 6c  |entry. See E-Fil|
000016a0  65 2e 0a 20 52 31 3d 34  20 3d 3e 20 5a 61 70 20  |e.. R1=4 => Zap |
000016b0  69 73 20 73 61 76 69 6e  67 20 61 20 66 69 6c 65  |is saving a file|
000016c0  20 77 69 74 68 20 79 6f  75 72 20 6d 6f 64 65 20  | with your mode |
000016d0  6e 75 6d 62 65 72 20 69  6e 20 66 5f 63 6d 6f 64  |number in f_cmod|
000016e0  65 2e 20 52 38 2f 52 39  3d 74 68 65 0a 09 20 77  |e. R8/R9=the.. w|
000016f0  69 6e 64 6f 77 20 62 65  69 6e 67 20 73 61 76 65  |indow being save|
00001700  64 2e 20 52 65 74 75 72  6e 20 52 31 3d 2d 31 20  |d. Return R1=-1 |
00001710  69 66 20 79 6f 75 20 77  69 73 68 20 74 6f 20 61  |if you wish to a|
00001720  62 6f 72 74 20 74 68 65  20 73 61 76 65 0a 09 20  |bort the save.. |
00001730  28 61 6e 64 20 68 61 6e  64 6c 65 20 69 74 20 79  |(and handle it y|
00001740  6f 75 72 73 65 6c 66 29  2e 20 49 66 20 79 6f 75  |ourself). If you|
00001750  20 72 65 74 75 72 6e 20  52 31 3d 2d 31 20 74 68  | return R1=-1 th|
00001760  65 6e 20 72 65 74 75 72  6e 20 52 30 3d 30 20 69  |en return R0=0 i|
00001770  66 0a 09 20 74 68 65 20  73 61 76 65 20 69 73 20  |f.. the save is |
00001780  73 61 66 65 20 28 66 69  6c 65 20 63 61 6e 20 6e  |safe (file can n|
00001790  6f 77 20 62 65 20 64 65  6c 65 74 65 64 29 20 6f  |ow be deleted) o|
000017a0  72 20 2d 31 20 69 66 20  75 6e 73 61 66 65 20 28  |r -1 if unsafe (|
000017b0  65 6e 74 65 72 65 64 0a  09 20 64 61 74 61 20 74  |entered.. data t|
000017c0  72 61 6e 73 66 65 72 20  70 72 6f 74 6f 63 6f 6c  |ransfer protocol|
000017d0  20 66 6f 72 20 65 78 61  6d 70 6c 65 29 2e 0a 20  | for example).. |
000017e0  52 31 3d 35 20 3d 3e 20  5a 61 70 20 77 61 6e 74  |R1=5 => Zap want|
000017f0  73 20 74 6f 20 64 65 6c  65 74 65 20 61 20 66 69  |s to delete a fi|
00001800  6c 65 20 79 6f 75 72 20  6d 6f 64 65 20 6e 75 6d  |le your mode num|
00001810  62 65 72 20 69 6e 20 66  5f 63 6d 6f 64 65 2c 20  |ber in f_cmode, |
00001820  62 75 74 20 69 74 0a 20  09 20 68 61 73 20 74 68  |but it. . has th|
00001830  65 20 27 61 6c 74 65 72  65 64 27 20 66 6c 61 67  |e 'altered' flag|
00001840  20 73 65 74 2e 20 52 65  74 75 72 6e 20 52 31 3d  | set. Return R1=|
00001850  2d 31 20 74 6f 20 6f 76  65 72 72 69 64 65 20 61  |-1 to override a|
00001860  6e 64 20 61 6c 6c 6f 77  20 74 68 65 0a 20 09 20  |nd allow the. . |
00001870  66 69 6c 65 20 74 6f 20  62 65 20 6b 69 6c 6c 65  |file to be kille|
00001880  64 20 61 6e 79 77 61 79  2e 0a 20 52 31 3d 36 20  |d anyway.. R1=6 |
00001890  3d 3e 20 5a 61 70 20 69  73 20 63 72 65 61 74 69  |=> Zap is creati|
000018a0  6e 67 20 74 68 65 20 63  6f 6c 6f 75 72 73 20 73  |ng the colours s|
000018b0  75 62 6d 65 6e 75 20 61  6e 64 20 77 61 6e 74 73  |ubmenu and wants|
000018c0  20 74 6f 20 6b 6e 6f 77  20 77 68 61 74 20 79 6f  | to know what yo|
000018d0  75 0a 20 09 20 63 61 6c  6c 20 63 6f 6c 6f 75 72  |u. . call colour|
000018e0  73 20 3e 3d 39 2e 20 52  65 74 75 72 6e 20 69 6e  |s >=9. Return in|
000018f0  20 52 31 20 70 6f 69 6e  74 65 72 20 74 6f 20 61  | R1 pointer to a|
00001900  20 64 6f 75 62 6c 65 20  7a 65 72 6f 20 74 65 72  | double zero ter|
00001910  6d 69 6e 61 74 65 64 0a  20 09 20 6c 69 73 74 20  |minated. . list |
00001920  6f 66 20 7a 65 72 6f 20  74 65 72 6d 69 6e 61 74  |of zero terminat|
00001930  65 64 20 65 6e 74 72 69  65 73 20 67 69 76 69 6e  |ed entries givin|
00001940  67 20 74 68 65 20 6e 61  6d 65 73 20 6f 66 20 74  |g the names of t|
00001950  68 65 20 63 6f 6c 6f 75  72 73 0a 20 09 20 73 74  |he colours. . st|
00001960  61 72 74 69 6e 67 20 66  72 6f 6d 20 39 2e 20 45  |arting from 9. E|
00001970  67 20 22 52 45 4d 73 22  2c 30 2c 22 53 74 72 69  |g "REMs",0,"Stri|
00001980  6e 67 73 22 2c 30 2c 30  2e 20 28 4f 72 20 6c 65  |ngs",0,0. (Or le|
00001990  61 76 65 20 52 31 20 61  73 20 36 0a 20 09 20 69  |ave R1 as 6. . i|
000019a0  66 20 74 68 69 73 20 63  61 6c 6c 20 69 73 20 6e  |f this call is n|
000019b0  6f 74 20 73 75 70 70 6f  72 74 65 64 29 2e 0a 0a  |ot supported)...|
000019c0  65 5f 6d 65 6e 75 0a 4f  66 66 73 65 74 20 6f 66  |e_menu.Offset of|
000019d0  20 73 75 62 6d 65 6e 75  20 69 6e 20 5a 61 70 27  | submenu in Zap'|
000019e0  73 20 66 6f 72 6d 61 74  20 2f 20 30 20 66 6f 72  |s format / 0 for|
000019f0  20 6e 6f 6e 65 2e 20 54  68 69 73 20 6d 65 6e 75  | none. This menu|
00001a00  20 63 6f 6d 65 73 20 6f  66 66 20 74 68 65 0a 27  | comes off the.'|
00001a10  4d 6f 64 65 27 20 6d 65  6e 75 2e 20 53 65 65 20  |Mode' menu. See |
00001a20  74 68 65 20 66 69 6c 65  20 45 2d 4d 65 6e 75 20  |the file E-Menu |
00001a30  66 6f 72 20 64 65 74 61  69 6c 73 20 6f 66 20 74  |for details of t|
00001a40  68 65 20 6d 65 6e 75 20  66 6f 72 6d 61 74 2e 0a  |he menu format..|
00001a50  0a 65 5f 6c 65 6e 0a 54  6f 74 61 6c 20 6c 65 6e  |.e_len.Total len|
00001a60  67 74 68 20 6f 66 20 74  68 65 20 74 61 62 6c 65  |gth of the table|
00001a70  20 64 61 74 61 20 28 3e  3d 33 32 29 2e 20 28 53  | data (>=32). (S|
00001a80  6f 20 74 68 61 74 20 6f  6e 6c 79 20 65 6e 74 72  |o that only entr|
00001a90  79 20 70 6f 69 6e 74 73  20 77 69 74 68 69 6e 20  |y points within |
00001aa0  74 68 65 0a 74 61 62 6c  65 20 61 72 65 20 63 61  |the.table are ca|
00001ab0  6c 6c 65 64 20 61 6e 64  20 66 6f 72 20 66 6f 72  |lled and for for|
00001ac0  77 61 72 64 20 63 6f 6d  70 61 74 69 62 69 6c 69  |ward compatibili|
00001ad0  74 79 29 2e 20 49 66 20  7a 61 70 20 66 69 6e 64  |ty). If zap find|
00001ae0  73 20 61 6e 20 65 6e 74  72 79 20 70 6f 69 6e 74  |s an entry point|
00001af0  0a 69 73 20 6f 66 66 20  74 68 65 20 65 6e 64 20  |.is off the end |
00001b00  6f 66 20 74 68 65 20 74  61 62 6c 65 20 74 68 65  |of the table the|
00001b10  6e 20 69 74 20 77 69 6c  6c 20 63 61 6c 6c 20 74  |n it will call t|
00001b20  68 65 20 63 6f 72 72 65  73 70 6f 6e 64 69 6e 67  |he corresponding|
00001b30  20 62 61 73 65 20 6d 6f  64 65 0a 65 6e 74 72 79  | base mode.entry|
00001b40  20 70 6f 69 6e 74 2e 0a  0a 49 66 20 61 6e 79 20  | point...If any |
00001b50  6f 66 20 74 68 65 20 66  6f 6c 6c 6f 77 69 6e 67  |of the following|
00001b60  20 6f 66 66 73 65 74 73  20 61 72 65 20 30 20 74  | offsets are 0 t|
00001b70  68 65 6e 20 74 68 65 20  63 6f 72 72 65 73 70 6f  |hen the correspo|
00001b80  6e 64 69 6e 67 20 6f 66  66 73 65 74 20 66 6f 72  |nding offset for|
00001b90  20 74 68 65 0a 62 61 73  65 6d 6f 64 65 20 69 73  | the.basemode is|
00001ba0  20 63 61 6c 6c 65 64 2e  0a 0a 65 5f 70 6f 73 74  | called...e_post|
00001bb0  6c 6f 61 64 0a 43 61 6c  6c 65 64 20 61 66 74 65  |load.Called afte|
00001bc0  72 20 61 20 66 69 6c 65  20 69 73 20 6c 6f 61 64  |r a file is load|
00001bd0  65 64 20 61 6e 64 20 68  61 73 20 68 61 64 20 61  |ed and has had a|
00001be0  20 77 69 6e 64 6f 77 20  6f 70 65 6e 65 64 20 66  | window opened f|
00001bf0  6f 72 20 69 74 20 69 6e  20 79 6f 75 72 0a 6d 6f  |or it in your.mo|
00001c00  64 65 2e 20 49 74 20 69  73 20 61 6c 73 6f 20 63  |de. It is also c|
00001c10  61 6c 6c 65 64 20 61 66  74 65 72 20 61 20 66 69  |alled after a fi|
00001c20  6c 65 20 69 6e 20 79 6f  75 72 20 6d 6f 64 65 20  |le in your mode |
00001c30  68 61 73 20 62 65 65 6e  20 73 61 76 65 64 2e 20  |has been saved. |
00001c40  49 74 20 65 6e 61 62 6c  65 73 0a 74 68 65 20 66  |It enables.the f|
00001c50  69 6c 65 20 63 6f 6e 74  65 6e 74 73 20 74 6f 20  |ile contents to |
00001c60  62 65 20 73 6c 69 67 68  74 6c 79 20 61 6c 74 65  |be slightly alte|
00001c70  72 65 64 20 62 65 66 6f  72 65 20 65 64 69 74 69  |red before editi|
00001c80  6e 67 2e 20 28 65 67 20  42 41 53 49 43 20 65 6e  |ng. (eg BASIC en|
00001c90  63 72 79 70 74 73 0a 74  68 65 20 6c 69 6e 65 20  |crypts.the line |
00001ca0  6e 75 6d 62 65 72 73 20  61 6e 64 20 42 41 53 54  |numbers and BAST|
00001cb0  58 54 20 64 65 74 6f 6b  65 6e 69 73 65 73 20 74  |XT detokenises t|
00001cc0  68 65 20 70 72 6f 67 72  61 6d 29 2e 20 59 6f 75  |he program). You|
00001cd0  20 6d 61 79 20 61 6c 74  65 72 20 74 68 65 20 64  | may alter the d|
00001ce0  61 74 61 0a 64 69 72 65  63 74 6c 79 20 28 69 65  |ata.directly (ie|
00001cf0  2c 20 79 6f 75 20 6e 65  65 64 6e 27 74 20 75 73  |, you needn't us|
00001d00  65 20 5a 61 70 5f 43 6f  6d 6d 61 6e 64 29 2e 0a  |e Zap_Command)..|
00001d10  09 5c 45 20 52 38 2f 52  39 0a 09 0a 65 5f 70 72  |.\E R8/R9...e_pr|
00001d20  65 73 61 76 65 0a 43 61  6c 6c 65 64 20 62 65 66  |esave.Called bef|
00001d30  6f 72 65 20 74 68 65 20  66 69 6c 65 20 69 73 20  |ore the file is |
00001d40  73 61 76 65 64 2e 20 49  74 20 65 6e 61 62 6c 65  |saved. It enable|
00001d50  73 20 66 69 6c 65 20 63  6f 6e 74 65 6e 74 73 20  |s file contents |
00001d60  74 6f 20 62 65 20 73 6c  69 67 68 74 6c 79 0a 61  |to be slightly.a|
00001d70  6c 74 65 72 65 64 2c 20  75 6e 64 6f 69 6e 67 20  |ltered, undoing |
00001d80  74 68 65 20 65 66 66 65  63 74 20 6f 66 20 65 5f  |the effect of e_|
00001d90  70 6f 73 74 6c 6f 61 64  2e 20 28 65 67 20 42 41  |postload. (eg BA|
00001da0  53 54 58 54 20 72 65 74  6f 6b 65 6e 69 73 65 73  |STXT retokenises|
00001db0  20 74 68 65 20 70 72 6f  67 72 61 6d 0a 70 72 69  | the program.pri|
00001dc0  6f 72 20 74 6f 20 73 61  76 69 6e 67 29 2e 20 41  |or to saving). A|
00001dd0  73 20 61 62 6f 76 65 2c  20 79 6f 75 20 6d 61 79  |s above, you may|
00001de0  20 61 6c 74 65 72 20 74  68 65 20 64 61 74 61 20  | alter the data |
00001df0  64 69 72 65 63 74 6c 79  2e 0a 09 5c 45 20 52 38  |directly...\E R8|
00001e00  2f 52 39 0a 0a 65 5f 6c  6f 61 64 69 6e 67 0a 54  |/R9..e_loading.T|
00001e10  68 69 73 20 69 73 20 63  61 6c 6c 65 64 20 77 68  |his is called wh|
00001e20  65 6e 20 61 20 66 69 6c  65 20 69 73 20 6c 6f 61  |en a file is loa|
00001e30  64 65 64 20 6f 66 66 20  64 69 73 63 20 66 6f 72  |ded off disc for|
00001e40  20 64 72 6f 70 70 69 6e  67 20 69 6e 74 6f 20 61  | dropping into a|
00001e50  20 77 69 6e 64 6f 77 2e  20 54 68 65 0a 66 69 6c  | window. The.fil|
00001e60  65 20 64 61 74 61 20 69  73 20 69 6e 20 61 20 68  |e data is in a h|
00001e70  65 61 70 20 62 6c 6f 63  6b 2e 20 54 68 69 73 20  |eap block. This |
00001e80  65 6e 61 62 6c 65 73 20  79 6f 75 20 74 6f 20 63  |enables you to c|
00001e90  68 61 6e 67 65 20 69 74  20 62 65 66 6f 72 65 20  |hange it before |
00001ea0  69 6e 73 65 72 74 69 6f  6e 0a 74 61 6b 65 73 20  |insertion.takes |
00001eb0  70 6c 61 63 65 20 28 65  67 20 42 41 53 54 58 54  |place (eg BASTXT|
00001ec0  20 64 65 74 6f 6b 65 6e  69 73 65 73 20 74 68 65  | detokenises the|
00001ed0  20 66 69 6c 65 29 2e 20  59 6f 75 20 61 72 65 20  | file). You are |
00001ee0  6f 6e 6c 79 20 63 61 6c  6c 65 64 20 69 66 20 74  |only called if t|
00001ef0  68 65 20 66 69 6c 65 0a  74 79 70 65 20 6f 66 20  |he file.type of |
00001f00  74 68 65 20 66 69 6c 65  20 69 73 20 63 6c 61 69  |the file is clai|
00001f10  6d 65 64 20 62 79 20 79  6f 75 72 20 6d 6f 64 65  |med by your mode|
00001f20  20 28 69 6e 20 74 68 65  20 27 6b 65 79 73 27 20  | (in the 'keys' |
00001f30  66 69 6c 65 29 2e 0a 09  5c 45 20 52 32 3d 64 61  |file)...\E R2=da|
00001f40  74 61 20 6c 65 6e 67 74  68 20 52 33 3d 64 61 74  |ta length R3=dat|
00001f50  61 20 61 64 64 72 65 73  73 0a 09 5c 58 20 59 6f  |a address..\X Yo|
00001f60  75 20 6d 61 79 20 63 68  61 6e 67 65 20 74 68 65  |u may change the|
00001f70  20 64 61 74 61 2c 20 6d  61 6b 69 6e 67 20 69 74  | data, making it|
00001f80  20 6c 61 72 67 65 72 20  69 66 20 6e 65 63 65 73  | larger if neces|
00001f90  73 61 72 79 0a 09 20 20  20 70 72 6f 76 69 64 65  |sary..   provide|
00001fa0  64 20 74 68 61 74 20 79  6f 75 20 65 6e 6c 61 72  |d that you enlar|
00001fb0  67 65 20 74 68 65 20 68  65 61 70 20 62 6c 6f 63  |ge the heap bloc|
00001fc0  6b 20 52 33 2e 20 52 65  74 75 72 6e 0a 09 20 20  |k R3. Return..  |
00001fd0  20 75 70 64 61 74 65 64  20 52 32 20 61 6e 64 20  | updated R2 and |
00001fe0  52 33 2e 0a 0a 65 5f 73  74 61 72 74 0a 43 61 6c  |R3...e_start.Cal|
00001ff0  6c 65 64 20 77 68 65 6e  20 61 20 77 69 6e 64 6f  |led when a windo|
00002000  77 20 65 6e 74 65 72 73  20 79 6f 75 72 20 6d 6f  |w enters your mo|
00002010  64 65 20 28 65 67 20 76  69 61 20 5a 61 70 5f 4e  |de (eg via Zap_N|
00002020  65 77 4d 6f 64 65 29 2e  20 59 6f 75 20 73 68 6f  |ewMode). You sho|
00002030  75 6c 64 0a 72 65 73 74  6f 72 65 20 74 68 65 20  |uld.restore the |
00002040  63 75 72 72 65 6e 74 20  77 5f 66 6c 61 67 73 20  |current w_flags |
00002050  61 6e 64 20 77 5f 66 6f  72 6d 61 74 20 6f 70 74  |and w_format opt|
00002060  69 6f 6e 73 2c 20 61 6e  64 20 61 6e 79 20 6f 74  |ions, and any ot|
00002070  68 65 72 20 6f 70 74 69  6f 6e 73 20 79 6f 75 0a  |her options you.|
00002080  6d 61 79 20 68 61 76 65  20 73 61 76 65 64 20 69  |may have saved i|
00002090  6e 20 79 6f 75 72 20 70  72 69 76 61 74 65 20 77  |n your private w|
000020a0  6f 72 64 20 77 5f 6d 6f  64 65 6e 20 6f 72 20 62  |ord w_moden or b|
000020b0  6c 6f 63 6b 20 70 6f 69  6e 74 65 64 20 74 6f 20  |lock pointed to |
000020c0  62 79 20 77 5f 6d 6f 64  65 6e 2e 0a 54 68 65 20  |by w_moden..The |
000020d0  63 61 6c 6c 20 5a 61 70  5f 52 65 73 74 6f 72 65  |call Zap_Restore|
000020e0  4d 6f 64 65 57 6f 72 64  20 73 68 6f 75 6c 64 20  |ModeWord should |
000020f0  62 65 20 6d 61 64 65 20  61 73 20 74 68 69 73 20  |be made as this |
00002100  72 65 73 74 6f 72 65 73  20 74 68 65 20 6f 70 74  |restores the opt|
00002110  69 6f 6e 73 20 6b 65 70  74 0a 74 72 61 63 6b 20  |ions kept.track |
00002120  6f 66 20 62 79 20 5a 61  70 20 75 73 69 6e 67 20  |of by Zap using |
00002130  5a 61 70 5f 4d 6f 64 65  44 61 74 61 2e 0a 09 5c  |Zap_ModeData...\|
00002140  45 20 52 38 2f 52 39 3d  77 69 6e 64 6f 77 20 6d  |E R8/R9=window m|
00002150  6f 64 65 20 69 73 20 62  65 69 6e 67 20 63 68 61  |ode is being cha|
00002160  6e 67 65 64 20 69 6e 20  4f 52 20 30 20 69 66 20  |nged in OR 0 if |
00002170  74 68 65 20 6d 6f 64 65  20 6f 6e 20 74 68 65 0a  |the mode on the.|
00002180  09 09 20 6f 70 74 69 6f  6e 73 20 6d 65 6e 75 20  |.. options menu |
00002190  69 73 20 62 65 69 6e 67  20 63 68 61 6e 67 65 64  |is being changed|
000021a0  20 61 6e 64 20 79 6f 75  20 73 68 6f 75 6c 64 20  | and you should |
000021b0  72 65 73 74 6f 72 65 20  74 68 65 0a 09 09 20 64  |restore the... d|
000021c0  65 66 61 75 6c 74 20 6f  70 74 69 6f 6e 73 2c 20  |efault options, |
000021d0  6f 66 20 66 6f 72 20 65  78 61 6d 70 6c 65 20 6f  |of for example o|
000021e0  70 74 5f 66 6c 61 67 73  20 61 6e 64 20 6f 70 74  |pt_flags and opt|
000021f0  5f 66 6f 72 6d 61 74 2e  0a 0a 65 5f 65 6e 64 0a  |_format...e_end.|
00002200  43 61 6c 6c 65 64 20 77  68 65 6e 20 61 20 77 69  |Called when a wi|
00002210  6e 64 6f 77 20 6c 65 61  76 65 73 20 79 6f 75 72  |ndow leaves your|
00002220  20 6d 6f 64 65 20 28 65  67 20 76 69 61 20 5a 61  | mode (eg via Za|
00002230  70 5f 4e 65 77 4d 6f 64  65 29 2e 20 54 68 69 73  |p_NewMode). This|
00002240  20 69 73 20 73 69 6d 69  6c 61 72 0a 74 6f 20 65  | is similar.to e|
00002250  5f 73 74 61 72 74 20 65  78 63 65 70 74 20 74 68  |_start except th|
00002260  61 74 20 79 6f 75 20 73  68 6f 75 6c 64 20 73 61  |at you should sa|
00002270  76 65 20 74 68 65 20 63  75 72 72 65 6e 74 20 6d  |ve the current m|
00002280  6f 64 65 20 64 65 70 65  6e 64 65 6e 74 0a 6f 70  |ode dependent.op|
00002290  74 69 6f 6e 73 20 66 72  6f 6d 20 77 5f 66 6f 72  |tions from w_for|
000022a0  6d 61 74 2c 20 77 5f 66  6c 61 67 73 2e 20 54 68  |mat, w_flags. Th|
000022b0  65 20 63 61 6c 6c 20 5a  61 70 5f 53 61 76 65 4d  |e call Zap_SaveM|
000022c0  6f 64 65 57 6f 72 64 20  73 68 6f 75 6c 64 20 62  |odeWord should b|
000022d0  65 20 6d 61 64 65 20 61  73 0a 74 68 69 73 20 73  |e made as.this s|
000022e0  61 76 65 73 20 74 68 65  20 6f 70 74 69 6f 6e 73  |aves the options|
000022f0  20 6b 65 70 74 20 74 72  61 63 6b 20 6f 66 20 62  | kept track of b|
00002300  79 20 5a 61 70 20 75 73  69 6e 67 20 5a 61 70 5f  |y Zap using Zap_|
00002310  4d 6f 64 65 44 61 74 61  2e 20 41 67 61 69 6e 2c  |ModeData. Again,|
00002320  20 69 66 0a 52 38 3d 30  20 74 68 65 6e 20 74 68  | if.R8=0 then th|
00002330  69 73 20 61 6c 6c 20 61  70 70 6c 69 65 73 20 74  |is all applies t|
00002340  6f 20 74 68 65 20 6f 70  74 69 6f 6e 73 20 6d 65  |o the options me|
00002350  6e 75 20 61 6e 64 20 6f  70 74 5f 66 6c 61 67 73  |nu and opt_flags|
00002360  2c 6f 70 74 5f 66 6f 72  6d 61 74 2e 0a 09 5c 45  |,opt_format...\E|
00002370  20 52 38 2f 52 39 3d 77  69 6e 64 6f 77 20 2f 20  | R8/R9=window / |
00002380  30 20 66 6f 72 20 69 63  6f 6e 62 61 72 20 6d 65  |0 for iconbar me|
00002390  6e 75 0a 0a 65 5f 77 69  64 74 68 0a 43 61 6c 6c  |nu..e_width.Call|
000023a0  65 64 20 77 68 65 6e 20  61 20 77 69 6e 64 6f 77  |ed when a window|
000023b0  20 69 73 20 28 72 65 29  63 72 65 61 74 65 64 20  | is (re)created |
000023c0  74 6f 20 66 69 6e 64 20  6f 75 74 20 74 68 65 20  |to find out the |
000023d0  77 69 64 74 68 20 6f 66  20 74 68 65 20 77 6f 72  |width of the wor|
000023e0  6b 20 61 72 65 61 20 69  6e 0a 63 68 61 72 61 63  |k area in.charac|
000023f0  74 65 72 73 20 28 65 78  63 6c 75 64 69 6e 67 20  |ters (excluding |
00002400  6d 61 72 67 69 6e 29 2e  20 59 6f 75 20 73 68 6f  |margin). You sho|
00002410  75 6c 64 20 72 65 61 64  20 74 68 69 73 20 65 69  |uld read this ei|
00002420  74 68 65 72 20 66 72 6f  6d 20 79 6f 75 72 20 6d  |ther from your m|
00002430  6f 64 65 0a 77 6f 72 64  20 6f 72 20 62 6c 6f 63  |ode.word or bloc|
00002440  6b 2c 20 6f 72 20 75 73  69 6e 67 20 5a 61 70 5f  |k, or using Zap_|
00002450  4d 6f 64 65 44 61 74 61  20 76 61 72 69 61 62 6c  |ModeData variabl|
00002460  65 20 6e 75 6d 62 65 72  20 30 20 77 68 65 72 65  |e number 0 where|
00002470  20 5a 61 70 20 72 65 73  65 72 76 65 73 0a 73 70  | Zap reserves.sp|
00002480  61 63 65 20 66 6f 72 20  61 20 77 69 64 74 68 20  |ace for a width |
00002490  76 61 6c 75 65 20 66 6f  72 20 79 6f 75 2e 20 49  |value for you. I|
000024a0  66 20 79 6f 75 20 73 75  70 70 6f 72 74 20 61 75  |f you support au|
000024b0  74 6f 20 77 69 64 74 68  20 61 6e 64 20 74 68 65  |to width and the|
000024c0  20 61 75 74 6f 20 77 69  64 74 68 0a 66 6c 61 67  | auto width.flag|
000024d0  20 69 73 20 73 65 74 20  28 73 65 65 20 45 2d 46  | is set (see E-F|
000024e0  6c 61 67 73 29 20 74 68  65 6e 20 79 6f 75 20 73  |lags) then you s|
000024f0  68 6f 75 6c 64 20 77 6f  72 6b 20 74 68 69 73 20  |hould work this |
00002500  77 69 64 74 68 20 6f 75  74 20 66 72 6f 6d 20 74  |width out from t|
00002510  68 65 20 66 69 6c 65 2e  0a 4f 6e 63 65 20 79 6f  |he file..Once yo|
00002520  75 20 68 61 76 65 20 63  61 6c 63 75 6c 61 74 65  |u have calculate|
00002530  64 20 74 68 65 20 77 69  64 74 68 2c 20 69 74 20  |d the width, it |
00002540  69 73 20 61 64 76 69 73  61 62 6c 65 20 74 6f 20  |is advisable to |
00002550  73 74 6f 72 65 20 69 74  20 69 6e 20 77 5f 62 70  |store it in w_bp|
00002560  6c 2c 20 61 0a 76 61 72  69 61 62 6c 65 20 72 65  |l, a.variable re|
00002570  73 65 72 76 65 64 20 66  6f 72 20 74 68 69 73 20  |served for this |
00002580  70 75 72 70 6f 73 65 2e  0a 09 5c 45 20 52 38 2f  |purpose...\E R8/|
00002590  52 39 0a 09 5c 58 20 52  30 3d 77 69 64 74 68 20  |R9..\X R0=width |
000025a0  6f 66 20 77 6f 72 6b 20  61 72 65 61 20 69 6e 20  |of work area in |
000025b0  63 68 61 72 61 63 74 65  72 73 20 28 65 78 63 6c  |characters (excl|
000025c0  75 64 69 6e 67 20 6d 61  72 67 69 6e 29 0a 0a 65  |uding margin)..e|
000025d0  5f 6c 69 6e 65 63 6f 6c  0a 43 6f 6e 76 65 72 74  |_linecol.Convert|
000025e0  73 20 61 20 63 6f 6c 75  6d 6e 20 6f 66 66 73 65  |s a column offse|
000025f0  74 20 6f 6e 20 73 63 72  65 65 6e 20 74 6f 20 66  |t on screen to f|
00002600  69 6c 65 20 6f 66 66 73  65 74 2e 20 54 68 69 73  |ile offset. This|
00002610  20 69 73 20 63 61 6c 6c  65 64 20 62 79 0a 5a 61  | is called by.Za|
00002620  70 5f 46 69 6e 64 4f 66  66 73 65 74 20 61 6e 64  |p_FindOffset and|
00002630  20 6f 74 68 65 72 20 73  75 62 73 2e 20 54 68 65  | other subs. The|
00002640  20 73 74 61 72 74 20 6f  66 66 73 65 74 20 6f 66  | start offset of|
00002650  20 74 68 65 20 70 68 79  73 69 63 61 6c 20 6c 69  | the physical li|
00002660  6e 65 20 6f 6e 20 77 68  69 63 68 0a 74 68 65 20  |ne on which.the |
00002670  63 6f 6c 75 6d 6e 20 6c  69 65 73 20 68 61 73 20  |column lies has |
00002680  62 65 65 6e 20 63 61 6c  63 75 6c 61 74 65 64 20  |been calculated |
00002690  28 75 73 75 61 6c 6c 79  20 62 79 20 65 5f 63 6c  |(usually by e_cl|
000026a0  6e 6f 66 66 29 2e 0a 09  5c 45 20 52 30 3d 66 69  |noff)...\E R0=fi|
000026b0  6c 65 20 6f 66 66 73 65  74 20 6f 66 20 70 68 79  |le offset of phy|
000026c0  73 69 63 61 6c 20 6c 69  6e 65 20 73 74 61 72 74  |sical line start|
000026d0  0a 09 20 20 20 52 31 3d  63 6f 6c 75 6d 6e 20 6f  |..   R1=column o|
000026e0  66 66 73 65 74 20 6f 6e  20 73 63 72 65 65 6e 20  |ffset on screen |
000026f0  28 65 78 63 20 6d 61 72  67 69 6e 29 20 52 38 2f  |(exc margin) R8/|
00002700  52 39 0a 09 5c 58 20 52  30 3d 66 69 6c 65 20 6f  |R9..\X R0=file o|
00002710  66 66 73 65 74 20 6f 66  20 6e 65 61 72 65 73 74  |ffset of nearest|
00002720  20 63 68 61 72 61 63 74  65 72 20 6f 6e 20 74 68  | character on th|
00002730  65 20 6c 65 66 74 0a 09  09 0a 65 5f 6c 69 6e 65  |e left....e_line|
00002740  6f 66 66 0a 43 6f 6e 76  65 72 74 20 66 69 6c 65  |off.Convert file|
00002750  20 6f 66 66 73 65 74 20  74 6f 20 63 6f 6c 75 6d  | offset to colum|
00002760  6e 20 6f 6e 20 73 63 72  65 65 6e 2e 20 54 68 69  |n on screen. Thi|
00002770  73 20 70 65 72 66 6f 72  6d 73 20 74 68 65 20 69  |s performs the i|
00002780  6e 76 65 72 73 65 20 66  75 6e 63 74 69 6f 6e 0a  |nverse function.|
00002790  74 6f 20 65 5f 6c 69 6e  65 63 6f 6c 2e 20 49 74  |to e_linecol. It|
000027a0  20 69 73 20 75 73 75 61  6c 6c 79 20 63 61 6c 6c  | is usually call|
000027b0  65 64 20 62 79 20 5a 61  70 5f 4f 66 66 4c 69 6e  |ed by Zap_OffLin|
000027c0  65 43 6f 6c 2e 20 41 67  61 69 6e 20 74 68 65 20  |eCol. Again the |
000027d0  6f 66 66 73 65 74 20 6f  66 20 74 68 65 0a 73 74  |offset of the.st|
000027e0  61 72 74 20 6f 66 20 74  68 65 20 70 68 79 73 69  |art of the physi|
000027f0  63 61 6c 20 6c 69 6e 65  20 68 61 73 20 62 65 65  |cal line has bee|
00002800  6e 20 63 61 6c 63 75 6c  61 74 65 64 20 28 75 73  |n calculated (us|
00002810  75 61 6c 6c 79 20 62 79  20 65 5f 63 6c 6e 70 68  |ually by e_clnph|
00002820  79 29 2e 20 54 68 69 73  0a 63 61 6c 6c 20 73 68  |y). This.call sh|
00002830  6f 75 6c 64 20 61 6c 73  6f 20 72 65 74 75 72 6e  |ould also return|
00002840  20 74 68 65 20 63 61 72  65 74 20 77 69 64 74 68  | the caret width|
00002850  20 66 6f 72 20 74 68 69  73 20 6d 6f 64 65 2e 0a  | for this mode..|
00002860  09 5c 45 20 52 30 3d 66  69 6c 65 20 6f 66 66 73  |.\E R0=file offs|
00002870  65 74 20 6f 66 20 70 68  79 73 69 63 61 6c 20 6c  |et of physical l|
00002880  69 6e 65 20 73 74 61 72  74 0a 09 20 20 20 52 31  |ine start..   R1|
00002890  3d 66 69 6c 65 20 6f 66  66 73 65 74 20 28 74 6f  |=file offset (to|
000028a0  20 63 6f 6e 76 65 72 74  20 74 6f 20 61 20 63 6f  | convert to a co|
000028b0  6c 75 6d 6e 29 20 52 38  2f 52 39 0a 09 5c 58 20  |lumn) R8/R9..\X |
000028c0  52 30 3d 63 6f 6c 75 6d  6e 20 6f 66 66 73 65 74  |R0=column offset|
000028d0  20 6f 6e 20 73 63 72 65  65 6e 20 28 65 78 63 20  | on screen (exc |
000028e0  6d 61 72 67 69 6e 29 0a  09 20 20 20 52 31 3d 63  |margin)..   R1=c|
000028f0  61 72 65 74 20 77 69 64  74 68 20 28 69 6e 20 63  |aret width (in c|
00002900  68 61 72 61 63 74 65 72  73 20 2d 20 75 73 75 61  |haracters - usua|
00002910  6c 6c 79 20 31 29 2e 0a  0a 54 68 65 20 6e 65 78  |lly 1)...The nex|
00002920  74 20 33 20 73 75 62 73  20 64 6f 20 74 68 65 20  |t 3 subs do the |
00002930  6d 61 69 6e 20 62 6f 64  79 20 6f 66 20 77 6f 72  |main body of wor|
00002940  6b 20 6f 66 20 63 6f 6e  76 65 72 74 69 6e 67 20  |k of converting |
00002950  62 65 74 77 65 65 6e 20  73 63 72 65 65 6e 20 64  |between screen d|
00002960  69 73 70 6c 61 79 0a 6c  69 6e 65 73 20 61 6e 64  |isplay.lines and|
00002970  20 66 69 6c 65 20 6f 66  66 73 65 74 73 2e 20 41  | file offsets. A|
00002980  20 70 68 79 73 69 63 61  6c 20 6c 69 6e 65 20 6d  | physical line m|
00002990  65 61 6e 73 20 74 68 65  20 61 63 74 75 61 6c 20  |eans the actual |
000029a0  6f 66 66 73 65 74 20 69  6e 20 6c 69 6e 65 73 20  |offset in lines |
000029b0  66 72 6f 6d 0a 74 68 65  20 74 6f 70 20 6f 66 20  |from.the top of |
000029c0  74 68 65 20 66 69 6c 65  20 77 68 65 6e 20 64 69  |the file when di|
000029d0  73 70 6c 61 79 65 64 20  2d 20 74 68 61 74 20 69  |splayed - that i|
000029e0  73 20 74 68 65 20 61 63  74 75 61 6c 20 27 79 27  |s the actual 'y'|
000029f0  20 63 6f 6f 72 64 69 6e  61 74 65 2e 0a 43 6f 75  | coordinate..Cou|
00002a00  6e 74 69 6e 67 20 73 74  61 72 74 73 20 61 74 20  |nting starts at |
00002a10  30 2e 20 4c 6f 67 69 63  61 6c 20 6c 69 6e 65 73  |0. Logical lines|
00002a20  20 63 61 6e 20 62 65 20  69 6e 74 65 72 70 72 65  | can be interpre|
00002a30  74 65 64 20 68 6f 77 65  76 65 72 20 74 68 65 20  |ted however the |
00002a40  6d 6f 64 65 0a 77 69 73  68 65 73 2e 20 49 6e 20  |mode.wishes. In |
00002a50  74 65 78 74 20 6d 6f 64  65 2c 20 61 20 6c 6f 67  |text mode, a log|
00002a60  69 63 61 6c 20 6c 69 6e  65 20 69 73 20 65 6e 64  |ical line is end|
00002a70  65 64 20 62 79 20 61 20  72 65 74 75 72 6e 20 28  |ed by a return (|
00002a80  61 73 20 6f 70 70 6f 73  65 64 20 74 6f 20 74 68  |as opposed to th|
00002a90  65 0a 64 69 73 70 6c 61  79 20 77 72 61 70 70 69  |e.display wrappi|
00002aa0  6e 67 29 2e 20 54 68 65  73 65 20 61 72 65 20 67  |ng). These are g|
00002ab0  69 76 65 6e 20 61 73 20  6f 66 66 73 65 74 73 20  |iven as offsets |
00002ac0  66 72 6f 6d 20 30 20 61  73 20 74 68 65 20 66 69  |from 0 as the fi|
00002ad0  72 73 74 20 6c 69 6e 65  2e 20 49 74 20 69 73 0a  |rst line. It is.|
00002ae0  69 6d 70 6f 72 74 61 6e  74 20 74 68 61 74 20 74  |important that t|
00002af0  68 65 73 65 20 72 6f 75  74 69 6e 65 73 20 61 72  |hese routines ar|
00002b00  65 20 4f 50 54 49 4d 49  53 45 44 20 61 73 20 6d  |e OPTIMISED as m|
00002b10  75 63 68 20 61 73 20 70  6f 73 73 69 62 6c 65 2e  |uch as possible.|
00002b20  0a 0a 65 5f 63 6c 6e 6c  6f 67 0a 43 6f 6e 76 65  |..e_clnlog.Conve|
00002b30  72 74 73 20 61 20 6c 6f  67 69 63 61 6c 20 6c 69  |rts a logical li|
00002b40  6e 65 20 6e 75 6d 62 65  72 20 74 6f 20 61 20 66  |ne number to a f|
00002b50  69 6c 65 20 6f 66 66 73  65 74 2f 70 68 79 73 69  |ile offset/physi|
00002b60  63 61 6c 20 6c 69 6e 65  2e 20 54 68 69 73 20 69  |cal line. This i|
00002b70  73 20 6e 6f 74 20 61 73  0a 69 6d 70 6f 72 74 61  |s not as.importa|
00002b80  6e 74 20 61 73 20 74 68  65 20 6f 74 68 65 72 20  |nt as the other |
00002b90  74 77 6f 2e 20 49 74 20  69 73 20 6d 61 69 6e 6c  |two. It is mainl|
00002ba0  79 20 75 73 65 64 20 62  79 20 74 68 65 20 27 47  |y used by the 'G|
00002bb0  4f 54 4f 27 20 62 6f 78  20 28 46 35 29 2e 20 49  |OTO' box (F5). I|
00002bc0  65 2c 0a 75 73 65 72 20  61 73 6b 73 20 74 6f 20  |e,.user asks to |
00002bd0  67 6f 20 74 6f 20 6c 6f  67 69 63 61 6c 20 6c 69  |go to logical li|
00002be0  6e 65 20 28 65 67 20 62  61 73 69 63 20 6c 69 6e  |ne (eg basic lin|
00002bf0  65 29 20 35 30 30 20 61  6e 64 20 5a 61 70 20 77  |e) 500 and Zap w|
00002c00  61 6e 74 73 20 74 6f 20  6b 6e 6f 77 20 74 68 65  |ants to know the|
00002c10  0a 66 69 6c 65 20 6f 66  66 73 65 74 20 6f 66 20  |.file offset of |
00002c20  74 68 69 73 2e 0a 09 5c  45 20 52 30 3d 6c 6f 67  |this...\E R0=log|
00002c30  69 63 61 6c 20 6c 69 6e  65 20 6e 75 6d 62 65 72  |ical line number|
00002c40  20 52 38 2f 52 39 0a 09  5c 58 20 52 30 3d 66 69  | R8/R9..\X R0=fi|
00002c50  6c 65 20 6f 66 66 73 65  74 20 6f 66 20 6c 69 6e  |le offset of lin|
00002c60  65 20 73 74 61 72 74 0a  09 20 20 20 52 31 3d 70  |e start..   R1=p|
00002c70  68 79 73 69 63 61 6c 20  6c 69 6e 65 20 6e 75 6d  |hysical line num|
00002c80  62 65 72 0a 0a 65 5f 63  6c 6e 70 68 79 0a 54 68  |ber..e_clnphy.Th|
00002c90  69 73 20 63 6f 6e 76 65  72 74 73 20 61 20 70 68  |is converts a ph|
00002ca0  79 73 69 63 61 6c 20 6c  69 6e 65 20 6e 75 6d 62  |ysical line numb|
00002cb0  65 72 20 74 6f 20 61 20  66 69 6c 65 20 6f 66 66  |er to a file off|
00002cc0  73 65 74 2e 20 54 68 69  73 20 69 73 20 74 68 65  |set. This is the|
00002cd0  20 6d 6f 73 74 0a 69 6d  70 6f 72 74 61 6e 74 20  | most.important |
00002ce0  6f 66 20 74 68 65 20 33  20 61 73 20 69 74 20 69  |of the 3 as it i|
00002cf0  73 20 63 61 6c 6c 65 64  20 77 68 65 6e 20 75 70  |s called when up|
00002d00  64 61 74 69 6e 67 20 61  20 77 69 6e 64 6f 77 2e  |dating a window.|
00002d10  20 46 6f 72 20 65 78 61  6d 70 6c 65 20 74 68 65  | For example the|
00002d20  0a 77 69 6d 70 20 61 73  6b 73 20 7a 61 70 20 74  |.wimp asks zap t|
00002d30  6f 20 72 65 64 72 61 77  20 61 20 72 65 63 74 61  |o redraw a recta|
00002d40  6e 67 6c 65 2e 20 54 68  65 20 74 6f 70 20 6f 66  |ngle. The top of|
00002d50  20 74 68 65 20 72 65 63  74 61 6e 67 6c 65 20 69  | the rectangle i|
00002d60  73 20 61 74 20 70 68 79  73 69 63 61 6c 0a 6c 69  |s at physical.li|
00002d70  6e 65 20 31 30 30 20 73  61 79 2e 20 5a 61 70 20  |ne 100 say. Zap |
00002d80  6e 65 65 64 73 20 74 6f  20 6b 6e 6f 77 20 74 68  |needs to know th|
00002d90  65 20 66 69 6c 65 20 6f  66 66 73 65 74 20 6f 66  |e file offset of|
00002da0  20 74 68 69 73 20 6c 69  6e 65 20 74 6f 20 63 61  | this line to ca|
00002db0  6c 6c 0a 65 5f 72 65 64  72 61 77 6c 69 6e 65 2e  |ll.e_redrawline.|
00002dc0  20 49 74 20 75 73 65 73  20 74 68 69 73 20 63 61  | It uses this ca|
00002dd0  6c 6c 2e 20 44 6f 20 4e  4f 54 20 73 74 61 72 74  |ll. Do NOT start|
00002de0  20 63 6f 75 6e 74 69 6e  67 20 66 72 6f 6d 20 74  | counting from t|
00002df0  68 65 20 73 74 61 72 74  20 6f 66 20 74 68 65 0a  |he start of the.|
00002e00  66 69 6c 65 2c 20 61 73  20 74 68 65 20 77 69 6e  |file, as the win|
00002e10  64 6f 77 20 62 65 69 6e  67 20 75 70 64 61 74 65  |dow being update|
00002e20  64 20 6d 61 79 20 62 65  20 6e 65 61 72 20 74 68  |d may be near th|
00002e30  65 20 65 6e 64 2e 20 49  6e 73 74 65 61 64 2c 20  |e end. Instead, |
00002e40  75 73 65 20 74 68 65 20  73 74 61 72 74 0a 6f 66  |use the start.of|
00002e50  20 74 68 65 20 77 5f 74  78 74 20 63 61 63 68 65  | the w_txt cache|
00002e60  20 61 73 20 61 20 72 65  66 65 72 65 6e 63 65 2e  | as a reference.|
00002e70  20 49 65 2c 20 75 73 65  20 74 68 65 20 76 61 72  | Ie, use the var|
00002e80  69 61 62 6c 65 73 20 77  5f 63 6c 69 6e 65 2c 20  |iables w_cline, |
00002e90  77 5f 63 6f 66 66 2c 0a  77 5f 63 6c 6f 67 6c 20  |w_coff,.w_clogl |
00002ea0  61 73 20 79 6f 75 72 20  73 74 61 72 74 20 72 65  |as your start re|
00002eb0  66 65 72 65 6e 63 65 2e  0a 09 5c 45 20 52 30 3d  |ference...\E R0=|
00002ec0  70 68 79 73 69 63 61 6c  20 6c 69 6e 65 20 6e 75  |physical line nu|
00002ed0  6d 62 65 72 20 52 38 2f  52 39 0a 09 5c 58 20 52  |mber R8/R9..\X R|
00002ee0  30 3d 66 69 6c 65 20 6f  66 66 73 65 74 20 6f 66  |0=file offset of|
00002ef0  20 6c 69 6e 65 20 73 74  61 72 74 0a 09 20 20 20  | line start..   |
00002f00  52 31 3d 6c 6f 67 69 63  61 6c 20 6c 69 6e 65 20  |R1=logical line |
00002f10  6e 75 6d 62 65 72 0a 0a  65 5f 63 6c 6e 6f 66 66  |number..e_clnoff|
00002f20  0a 43 6f 6e 76 65 72 74  73 20 61 20 66 69 6c 65  |.Converts a file|
00002f30  20 6f 66 66 73 65 74 20  74 6f 20 61 20 6c 69 6e  | offset to a lin|
00002f40  65 20 6e 75 6d 62 65 72  20 61 6e 64 20 6f 66 66  |e number and off|
00002f50  73 65 74 2e 20 54 68 69  73 20 63 61 6c 6c 20 69  |set. This call i|
00002f60  73 20 75 73 65 64 20 62  79 0a 5a 61 70 5f 4f 66  |s used by.Zap_Of|
00002f70  66 4c 69 6e 65 43 6f 6c  20 61 6e 64 20 77 68 65  |fLineCol and whe|
00002f80  6e 20 61 20 77 69 6e 64  6f 77 20 69 73 20 66 69  |n a window is fi|
00002f90  72 73 74 20 6f 70 65 6e  65 64 2e 20 49 74 20 73  |rst opened. It s|
00002fa0  68 6f 75 6c 64 20 66 69  6e 64 20 6f 75 74 20 77  |hould find out w|
00002fb0  68 69 63 68 0a 70 68 79  73 69 63 61 6c 20 6c 69  |hich.physical li|
00002fc0  6e 65 20 61 20 66 69 6c  65 20 6f 66 66 73 65 74  |ne a file offset|
00002fd0  20 6c 69 65 73 20 6f 6e  2e 20 49 66 20 74 68 65  | lies on. If the|
00002fe0  20 66 69 6c 65 20 6f 66  66 73 65 74 20 69 73 20  | file offset is |
00002ff0  65 71 75 61 6c 20 74 6f  20 74 68 65 20 66 69 6c  |equal to the fil|
00003000  65 0a 6c 65 6e 67 74 68  20 74 68 65 6e 20 69 74  |e.length then it|
00003010  20 73 68 6f 75 6c 64 20  72 65 74 75 72 6e 20 74  | should return t|
00003020  68 65 20 6c 69 6e 65 20  6f 66 20 61 6e 20 27 69  |he line of an 'i|
00003030  6d 61 67 69 6e 61 72 79  27 20 6c 61 73 74 20 63  |maginary' last c|
00003040  68 61 72 61 63 74 65 72  2e 20 54 68 69 73 0a 69  |haracter. This.i|
00003050  73 20 63 61 6c 6c 65 64  20 77 68 65 6e 20 61 20  |s called when a |
00003060  77 69 6e 64 6f 77 20 69  73 20 69 6e 69 74 69 61  |window is initia|
00003070  6c 6c 79 20 6f 70 65 6e  65 64 20 74 6f 20 77 6f  |lly opened to wo|
00003080  72 6b 20 6f 75 74 20 74  68 65 20 77 5f 68 65 69  |rk out the w_hei|
00003090  67 68 74 20 76 61 6c 75  65 2e 0a 41 73 20 77 69  |ght value..As wi|
000030a0  74 68 20 65 5f 63 6c 6e  70 68 79 20 79 6f 75 20  |th e_clnphy you |
000030b0  73 68 6f 75 6c 64 20 75  73 65 20 74 68 65 20 63  |should use the c|
000030c0  61 63 68 65 20 72 65 66  65 72 65 6e 63 65 20 70  |ache reference p|
000030d0  6f 69 6e 74 20 61 73 20  61 20 73 74 61 72 74 69  |oint as a starti|
000030e0  6e 67 0a 70 6f 69 6e 74  2e 0a 09 5c 45 20 52 30  |ng.point...\E R0|
000030f0  3d 66 69 6c 65 20 6f 66  66 73 65 74 20 52 38 2f  |=file offset R8/|
00003100  52 39 0a 09 5c 58 20 52  30 3d 70 68 79 73 69 63  |R9..\X R0=physic|
00003110  61 6c 20 6c 69 6e 65 20  6e 75 6d 62 65 72 0a 09  |al line number..|
00003120  20 20 20 52 31 3d 66 69  6c 65 20 6f 66 66 73 65  |   R1=file offse|
00003130  74 20 6f 66 20 70 68 79  73 69 63 61 6c 20 6c 69  |t of physical li|
00003140  6e 65 20 73 74 61 72 74  0a 09 20 20 20 52 32 3d  |ne start..   R2=|
00003150  6c 6f 67 69 63 61 6c 20  6c 69 6e 65 20 6e 75 6d  |logical line num|
00003160  62 65 72 0a 0a 65 5f 6e  65 78 74 6c 69 6e 65 0a  |ber..e_nextline.|
00003170  54 68 69 73 20 69 73 20  63 61 6c 6c 65 64 20 64  |This is called d|
00003180  75 72 69 6e 67 20 61 20  5a 61 70 5f 44 6f 43 6f  |uring a Zap_DoCo|
00003190  6d 6d 61 6e 64 20 6f 70  65 72 61 74 69 6f 6e 2e  |mmand operation.|
000031a0  20 49 74 20 69 73 20 64  65 73 69 67 6e 65 64 20  | It is designed |
000031b0  74 6f 20 77 6f 72 6b 20  6f 75 74 0a 74 68 65 20  |to work out.the |
000031c0  66 69 72 73 74 20 6c 69  6e 65 20 6f 6e 20 73 63  |first line on sc|
000031d0  72 65 65 6e 20 77 68 69  63 68 20 63 61 6e 20 62  |reen which can b|
000031e0  65 20 73 68 69 66 74 65  64 20 64 6f 77 6e 2c 20  |e shifted down, |
000031f0  66 6f 6c 6c 6f 77 69 6e  67 20 61 6e 20 69 6e 73  |following an ins|
00003200  65 72 74 69 6f 6e 2f 0a  64 65 6c 65 74 69 6f 6e  |ertion/.deletion|
00003210  2c 20 77 69 74 68 6f 75  74 20 62 65 69 6e 67 20  |, without being |
00003220  72 65 64 72 61 77 6e 2e  20 4f 6e 20 65 6e 74 72  |redrawn. On entr|
00003230  79 20 79 6f 75 20 61 72  65 20 74 6f 6c 64 20 74  |y you are told t|
00003240  68 65 20 66 69 72 73 74  20 63 68 61 72 61 63 74  |he first charact|
00003250  65 72 0a 77 68 69 63 68  20 6f 63 63 75 72 73 20  |er.which occurs |
00003260  61 66 74 65 72 20 74 68  65 20 61 6c 74 65 72 65  |after the altere|
00003270  64 20 72 65 67 69 6f 6e  20 61 6e 64 20 74 68 65  |d region and the|
00003280  20 61 6d 6f 75 6e 74 20  62 79 20 77 68 69 63 68  | amount by which|
00003290  20 69 74 73 20 6f 66 66  73 65 74 20 77 69 6c 6c  | its offset will|
000032a0  0a 63 68 61 6e 67 65 20  64 75 65 20 74 6f 20 74  |.change due to t|
000032b0  68 65 20 61 6c 74 65 72  61 74 69 6f 6e 2e 20 59  |he alteration. Y|
000032c0  6f 75 20 6d 75 73 74 20  72 65 74 75 72 6e 20 74  |ou must return t|
000032d0  68 65 20 66 69 6c 65 20  6f 66 66 73 65 74 20 6f  |he file offset o|
000032e0  66 20 74 68 65 20 66 69  72 73 74 0a 6c 69 6e 65  |f the first.line|
000032f0  20 77 68 69 63 68 20 6d  61 79 20 62 65 20 73 68  | which may be sh|
00003300  69 66 74 65 64 20 6f 6e  20 74 68 65 20 73 63 72  |ifted on the scr|
00003310  65 65 6e 20 77 69 74 68  6f 75 74 20 62 65 69 6e  |een without bein|
00003320  67 20 72 65 64 72 61 77  6e 2e 20 28 55 73 75 61  |g redrawn. (Usua|
00003330  6c 6c 79 20 74 68 65 0a  66 69 72 73 74 20 6c 6f  |lly the.first lo|
00003340  67 69 63 61 6c 20 6c 69  6e 65 20 77 69 74 68 20  |gical line with |
00003350  73 74 61 72 74 20 6f 66  66 73 65 74 20 3e 20 52  |start offset > R|
00003360  30 29 2e 20 49 6e 20 74  68 65 20 63 61 73 65 20  |0). In the case |
00003370  77 68 65 72 65 20 74 68  65 72 65 20 69 73 20 6e  |where there is n|
00003380  6f 0a 73 75 63 68 20 6c  69 6e 65 2c 20 72 65 74  |o.such line, ret|
00003390  75 72 6e 20 74 68 65 20  65 6e 64 20 6f 66 20 66  |urn the end of f|
000033a0  69 6c 65 20 6f 66 66 73  65 74 20 61 6e 64 20 74  |ile offset and t|
000033b0  68 65 20 70 68 79 73 69  63 61 6c 20 6c 69 6e 65  |he physical line|
000033c0  20 63 6f 6e 74 61 69 6e  69 6e 67 0a 74 68 69 73  | containing.this|
000033d0  20 27 69 6d 61 67 69 6e  61 72 79 27 20 63 68 61  | 'imaginary' cha|
000033e0  72 61 63 74 65 72 20 6f  66 66 73 65 74 20 28 61  |racter offset (a|
000033f0  73 20 66 6f 72 20 65 5f  63 6c 6e 6f 66 66 29 2e  |s for e_clnoff).|
00003400  0a 20 53 65 65 20 61 6c  73 6f 20 65 5f 70 72 65  |. See also e_pre|
00003410  76 6c 69 6e 65 2e 20 65  5f 70 72 65 76 6c 69 6e  |vline. e_prevlin|
00003420  65 20 69 73 20 63 61 6c  6c 65 64 20 66 69 72 73  |e is called firs|
00003430  74 2c 20 61 6e 64 20 74  68 65 20 66 69 6c 65 20  |t, and the file |
00003440  62 6c 6f 63 6b 20 69 73  0a 73 65 74 20 75 70 20  |block is.set up |
00003450  61 73 20 66 6f 72 20 65  5f 70 72 65 76 6c 69 6e  |as for e_prevlin|
00003460  65 2e 0a 09 5c 45 20 52  30 3d 66 69 6c 65 20 6f  |e...\E R0=file o|
00003470  66 66 73 65 74 20 6f 66  20 66 69 72 73 74 20 27  |ffset of first '|
00003480  73 68 69 66 74 61 62 6c  65 27 20 63 68 61 72 61  |shiftable' chara|
00003490  63 74 65 72 0a 09 20 20  20 52 31 3d 73 69 67 6e  |cter..   R1=sign|
000034a0  65 64 20 63 68 61 6e 67  65 20 69 6e 20 66 69 6c  |ed change in fil|
000034b0  65 20 6f 66 66 73 65 74  20 6f 66 20 74 68 69 73  |e offset of this|
000034c0  20 63 68 61 72 61 63 74  65 72 20 52 38 2f 52 39  | character R8/R9|
000034d0  0a 09 5c 58 20 52 30 3d  66 69 6c 65 20 6f 66 66  |..\X R0=file off|
000034e0  73 65 74 20 6f 66 20 66  69 72 73 74 20 27 73 68  |set of first 'sh|
000034f0  69 66 74 61 62 6c 65 27  20 6c 69 6e 65 0a 09 20  |iftable' line.. |
00003500  20 20 52 31 3d 70 68 79  73 69 63 61 6c 20 6c 69  |  R1=physical li|
00003510  6e 65 20 6e 75 6d 62 65  72 20 6f 66 20 74 68 69  |ne number of thi|
00003520  73 20 6c 69 6e 65 20 23  0a 09 20 20 20 59 6f 75  |s line #..   You|
00003530  20 6d 75 73 74 20 70 72  65 73 65 72 76 65 20 74  | must preserve t|
00003540  68 65 20 73 70 6c 69 74  20 6f 66 66 73 65 74 20  |he split offset |
00003550  61 6e 64 20 73 70 6c 69  74 20 73 69 7a 65 20 6f  |and split size o|
00003560  66 20 74 68 65 20 66 69  6c 65 2e 0a 09 20 20 20  |f the file...   |
00003570  0a 65 5f 6d 69 6e 75 73  0a 54 68 69 73 20 69 73  |.e_minus.This is|
00003580  20 63 61 6c 6c 65 64 20  77 68 65 6e 20 74 68 65  | called when the|
00003590  20 75 73 65 72 20 70 72  65 73 73 65 73 20 74 68  | user presses th|
000035a0  65 20 6c 65 66 74 20 61  72 72 6f 77 20 6b 65 79  |e left arrow key|
000035b0  20 74 6f 20 77 6f 72 6b  20 6f 75 74 20 74 68 65  | to work out the|
000035c0  20 6e 65 78 74 0a 63 75  72 73 6f 72 20 70 6f 73  | next.cursor pos|
000035d0  69 74 69 6f 6e 2e 20 54  68 65 20 62 75 66 66 65  |ition. The buffe|
000035e0  72 69 6e 67 20 69 73 20  64 6f 6e 65 20 66 6f 72  |ring is done for|
000035f0  20 79 6f 75 2e 0a 09 5c  45 20 52 30 3d 70 68 79  | you...\E R0=phy|
00003600  73 69 63 61 6c 20 6c 69  6e 65 20 73 74 61 72 74  |sical line start|
00003610  20 66 69 6c 65 20 6f 66  66 73 65 74 0a 09 20 20  | file offset..  |
00003620  20 52 31 3d 63 75 72 73  6f 72 20 66 69 6c 65 20  | R1=cursor file |
00003630  6f 66 66 73 65 74 0a 09  20 20 20 52 32 3d 63 75  |offset..   R2=cu|
00003640  72 73 6f 72 20 63 6f 6c  75 6d 6e 20 28 65 78 63  |rsor column (exc|
00003650  20 6d 61 72 67 69 6e 29  20 52 38 2f 52 39 0a 09  | margin) R8/R9..|
00003660  20 20 20 52 31 30 3d 63  75 72 73 6f 72 20 63 61  |   R10=cursor ca|
00003670  72 65 74 20 62 6c 6f 63  6b 0a 09 5c 58 20 49 66  |ret block..\X If|
00003680  20 52 32 3e 3d 30 20 74  68 65 6e 20 52 31 2c 52  | R2>=0 then R1,R|
00003690  32 20 67 69 76 65 6e 20  6e 65 77 20 63 75 72 73  |2 given new curs|
000036a0  6f 72 20 70 6f 73 69 74  69 6f 6e 20 6f 6e 20 74  |or position on t|
000036b0  68 65 0a 09 20 20 20 73  61 6d 65 20 70 68 79 73  |he..   same phys|
000036c0  69 63 61 6c 20 6c 69 6e  65 2e 0a 09 20 20 20 49  |ical line...   I|
000036d0  66 20 52 32 3d 2d 31 20  74 68 65 6e 20 52 31 3d  |f R2=-1 then R1=|
000036e0  6e 65 77 20 66 69 6c 65  20 6f 66 66 73 65 74 20  |new file offset |
000036f0  6f 66 20 63 75 72 73 6f  72 2e 0a 09 20 20 20 49  |of cursor...   I|
00003700  66 20 52 32 3d 2d 32 20  74 68 65 6e 20 79 6f 75  |f R2=-2 then you|
00003710  20 68 61 76 65 20 6d 6f  76 65 64 20 74 68 65 20  | have moved the |
00003720  63 75 72 73 6f 72 20 79  6f 75 72 73 65 6c 66 2e  |cursor yourself.|
00003730  0a 09 20 20 20 49 66 20  52 32 3d 2d 33 20 74 68  |..   If R2=-3 th|
00003740  65 6e 20 52 30 2c 52 31  3d 6e 65 77 20 78 2c 79  |en R0,R1=new x,y|
00003750  20 66 6f 72 20 63 75 72  73 6f 72 2e 0a 0a 65 5f  | for cursor...e_|
00003760  70 6c 75 73 09 09 50 65  72 66 6f 72 6d 20 63 75  |plus..Perform cu|
00003770  72 73 6f 72 20 72 69 67  68 74 20 28 5c 45 20 26  |rsor right (\E &|
00003780  20 5c 58 20 61 73 20 66  6f 72 20 65 5f 6d 69 6e  | \X as for e_min|
00003790  75 73 29 0a 65 5f 73 6d  69 6e 75 73 09 50 65 72  |us).e_sminus.Per|
000037a0  66 6f 72 6d 20 63 75 72  73 6f 72 20 62 61 63 6b  |form cursor back|
000037b0  20 61 20 77 6f 72 64 20  28 5c 45 20 26 20 5c 58  | a word (\E & \X|
000037c0  20 61 73 20 66 6f 72 20  65 5f 6d 69 6e 75 73 29  | as for e_minus)|
000037d0  0a 65 5f 73 70 6c 75 73  09 09 50 65 72 66 6f 72  |.e_splus..Perfor|
000037e0  6d 20 63 75 72 73 6f 72  20 66 6f 72 77 61 72 64  |m cursor forward|
000037f0  20 61 20 77 6f 72 64 20  28 5c 45 20 26 20 5c 58  | a word (\E & \X|
00003800  20 61 73 20 66 6f 72 20  65 5f 6d 69 6e 75 73 29  | as for e_minus)|
00003810  0a 65 5f 63 6d 69 6e 75  73 09 4d 6f 76 65 20 63  |.e_cminus.Move c|
00003820  75 72 73 6f 72 20 74 6f  20 6c 69 6e 65 20 73 74  |ursor to line st|
00003830  61 72 74 20 28 5c 45 20  26 20 5c 58 20 61 73 20  |art (\E & \X as |
00003840  66 6f 72 20 65 5f 6d 69  6e 75 73 29 0a 65 5f 63  |for e_minus).e_c|
00003850  70 6c 75 73 09 09 4d 6f  76 65 20 63 75 72 73 6f  |plus..Move curso|
00003860  72 20 74 6f 20 6c 69 6e  65 20 65 6e 64 20 28 5c  |r to line end (\|
00003870  45 20 26 20 5c 58 20 61  73 20 66 6f 72 20 65 5f  |E & \X as for e_|
00003880  6d 69 6e 75 73 29 0a 0a  65 5f 72 65 64 72 61 77  |minus)..e_redraw|
00003890  6c 69 6e 65 0a 54 68 69  73 20 69 73 20 63 61 6c  |line.This is cal|
000038a0  6c 65 64 20 77 68 65 6e  20 79 6f 75 72 20 6d 6f  |led when your mo|
000038b0  64 65 20 69 73 20 72 65  71 75 69 72 65 64 20 74  |de is required t|
000038c0  6f 20 72 65 64 72 61 77  20 6f 6e 65 20 28 70 68  |o redraw one (ph|
000038d0  79 73 69 63 61 6c 29 20  6c 69 6e 65 20 6f 66 0a  |ysical) line of.|
000038e0  74 68 65 20 64 69 73 70  6c 61 79 20 2d 20 69 74  |the display - it|
000038f0  20 69 73 20 61 6c 73 6f  20 68 65 72 65 20 74 68  | is also here th|
00003900  61 74 20 79 6f 75 20 63  61 6e 20 73 70 65 63 69  |at you can speci|
00003910  66 79 20 74 68 65 20 63  6f 6c 6f 75 72 20 6f 66  |fy the colour of|
00003920  20 65 61 63 68 0a 63 68  61 72 61 63 74 65 72 2e  | each.character.|
00003930  20 59 6f 75 20 61 72 65  20 70 61 73 73 65 64 3a  | You are passed:|
00003940  0a 20 31 29 20 41 73 20  69 6e 70 75 74 3a 0a 20  |. 1) As input:. |
00003950  20 20 20 54 68 65 20 70  68 79 73 69 63 61 6c 20  |   The physical |
00003960  6c 69 6e 65 20 73 74 61  72 74 20 28 63 61 6c 63  |line start (calc|
00003970  75 6c 61 74 65 64 20 76  69 61 20 65 5f 63 6c 6e  |ulated via e_cln|
00003980  70 68 79 20 2d 20 6f 72  20 74 68 65 20 70 72 65  |phy - or the pre|
00003990  76 69 6f 75 73 20 63 61  6c 6c 0a 20 20 20 20 74  |vious call.    t|
000039a0  6f 20 74 68 69 73 20 73  75 62 29 2e 20 54 68 69  |o this sub). Thi|
000039b0  73 20 69 73 20 6e 6f 74  20 70 61 73 73 65 64 20  |s is not passed |
000039c0  61 73 20 61 20 66 69 6c  65 20 6f 66 66 73 65 74  |as a file offset|
000039d0  2c 20 62 75 74 20 61 73  20 61 6e 20 61 63 74 75  |, but as an actu|
000039e0  61 6c 0a 20 20 20 20 41  44 44 52 45 53 53 20 69  |al.    ADDRESS i|
000039f0  6e 20 74 68 65 20 66 69  6c 65 20 62 75 66 66 65  |n the file buffe|
00003a00  72 20 28 69 6e 20 52 37  29 2e 20 52 65 63 61 6c  |r (in R7). Recal|
00003a10  6c 69 6e 67 20 74 68 65  20 73 70 6c 69 74 20 6e  |ling the split n|
00003a20  61 74 75 72 65 20 6f 66  20 74 68 65 0a 20 20 20  |ature of the.   |
00003a30  20 62 75 66 66 65 72 20  28 73 65 65 20 45 2d 46  | buffer (see E-F|
00003a40  69 6c 65 29 20 74 68 65  20 74 65 78 74 20 6d 61  |ile) the text ma|
00003a50  79 20 6e 6f 74 20 62 65  20 63 6f 6e 74 69 6e 75  |y not be continu|
00003a60  6f 75 73 2e 20 52 31 30  20 69 73 20 73 65 74 20  |ous. R10 is set |
00003a70  74 6f 20 74 68 65 0a 20  20 20 20 65 6e 64 20 6f  |to the.    end o|
00003a80  66 20 74 68 69 73 20 73  65 63 74 69 6f 6e 20 6f  |f this section o|
00003a90  66 20 74 68 65 20 73 70  6c 69 74 20 73 6f 20 74  |f the split so t|
00003aa0  68 65 20 66 69 6c 65 20  69 73 20 63 6f 6e 74 69  |he file is conti|
00003ab0  6e 75 6f 75 73 20 75 70  20 74 6f 20 52 31 30 2e  |nuous up to R10.|
00003ac0  0a 20 20 20 20 52 35 3d  52 37 2d 74 68 65 20 6f  |.    R5=R7-the o|
00003ad0  66 66 73 65 74 20 6f 66  20 74 68 65 20 63 68 61  |ffset of the cha|
00003ae0  72 61 63 74 65 72 20 2d  20 49 20 63 61 6c 6c 20  |racter - I call |
00003af0  74 68 69 73 20 74 68 65  20 61 70 70 61 72 65 6e  |this the apparen|
00003b00  74 20 62 75 66 66 65 72  20 73 74 61 72 74 0a 20  |t buffer start. |
00003b10  20 20 20 28 77 68 65 72  65 20 74 68 65 20 73 74  |   (where the st|
00003b20  61 72 74 20 77 6f 75 6c  64 20 62 65 20 69 66 20  |art would be if |
00003b30  74 68 65 20 66 69 6c 65  20 77 65 72 65 20 63 6f  |the file were co|
00003b40  6e 74 69 6e 75 6f 75 73  29 2e 0a 20 32 29 20 46  |ntinuous).. 2) F|
00003b50  6f 72 20 6f 75 74 70 75  74 3a 0a 20 20 20 20 54  |or output:.    T|
00003b60  68 65 20 61 64 64 72 65  73 73 20 6f 66 20 61 20  |he address of a |
00003b70  62 75 66 66 65 72 20 28  69 6e 20 52 36 29 20 69  |buffer (in R6) i|
00003b80  6e 20 77 68 69 63 68 20  74 6f 20 77 72 69 74 65  |n which to write|
00003b90  20 74 68 65 20 63 68 61  72 61 63 74 65 72 73 20  | the characters |
00003ba0  74 6f 0a 20 20 20 20 61  70 70 65 61 72 20 6f 6e  |to.    appear on|
00003bb0  20 74 68 65 20 6c 69 6e  65 20 28 6f 6e 65 20 62  | the line (one b|
00003bc0  79 74 65 20 70 65 72 20  63 68 61 72 61 63 74 65  |yte per characte|
00003bd0  72 29 2e 20 54 68 69 73  20 62 75 66 66 65 72 20  |r). This buffer |
00003be0  68 61 73 20 62 65 65 6e  0a 20 20 20 20 63 6c 65  |has been.    cle|
00003bf0  61 72 65 64 20 74 6f 20  73 70 61 63 65 73 20 62  |ared to spaces b|
00003c00  65 66 6f 72 65 68 61 6e  64 20 73 6f 20 79 6f 75  |eforehand so you|
00003c10  20 6f 6e 6c 79 20 6e 65  65 64 20 74 6f 20 77 72  | only need to wr|
00003c20  69 74 65 20 74 68 65 20  6e 6f 6e 2d 73 70 61 63  |ite the non-spac|
00003c30  65 0a 20 20 20 20 63 68  61 72 61 63 74 65 72 73  |e.    characters|
00003c40  2e 20 4c 69 6e 65 20 6e  75 6d 62 65 72 73 20 68  |. Line numbers h|
00003c50  61 76 65 20 62 65 65 6e  20 64 65 61 6c 74 20 77  |ave been dealt w|
00003c60  69 74 68 2e 20 59 6f 75  20 74 6f 6c 64 20 5a 61  |ith. You told Za|
00003c70  70 20 74 68 65 20 77 69  64 74 68 0a 20 20 20 20  |p the width.    |
00003c80  74 68 65 20 62 75 66 66  65 72 20 73 68 6f 75 6c  |the buffer shoul|
00003c90  64 20 62 65 20 77 68 65  6e 20 79 6f 75 72 20 65  |d be when your e|
00003ca0  5f 77 69 64 74 68 20 65  6e 74 72 79 20 70 6f 69  |_width entry poi|
00003cb0  6e 74 20 77 61 73 20 63  61 6c 6c 65 64 2e 0a 20  |nt was called.. |
00003cc0  33 29 20 43 6f 6c 6f 75  72 73 3a 0a 20 20 20 20  |3) Colours:.    |
00003cd0  41 73 20 66 61 72 20 61  73 20 74 68 69 73 20 63  |As far as this c|
00003ce0  61 6c 6c 20 69 73 20 63  6f 6e 63 65 72 6e 65 64  |all is concerned|
00003cf0  20 74 68 65 72 65 20 61  72 65 20 31 36 20 63 6f  | there are 16 co|
00003d00  6c 6f 75 72 73 20 6e 75  6d 62 65 72 65 64 20 30  |lours numbered 0|
00003d10  2d 31 35 0a 20 20 20 20  61 76 61 69 6c 61 62 6c  |-15.    availabl|
00003d20  65 2e 20 54 68 65 73 65  20 62 65 61 72 20 6e 6f  |e. These bear no|
00003d30  20 72 65 73 65 6d 62 6c  61 6e 63 65 20 74 6f 20  | resemblance to |
00003d40  77 69 6d 70 20 63 6f 6c  6f 75 72 20 6e 75 6d 62  |wimp colour numb|
00003d50  65 72 73 2c 20 62 75 74  20 61 72 65 0a 20 20 20  |ers, but are.   |
00003d60  20 27 69 6e 74 65 72 6e  61 6c 27 20 5a 61 70 20  | 'internal' Zap |
00003d70  63 6f 6c 6f 75 72 20 6e  75 6d 62 65 72 73 2e 20  |colour numbers. |
00003d80  54 68 65 69 72 20 61 63  74 75 61 6c 20 70 68 79  |Their actual phy|
00003d90  73 69 63 61 6c 20 61 70  70 65 61 72 61 6e 63 65  |sical appearance|
00003da0  20 69 73 20 63 68 6f 73  65 6e 0a 20 20 20 20 62  | is chosen.    b|
00003db0  79 20 74 68 65 20 75 73  65 72 20 66 72 6f 6d 20  |y the user from |
00003dc0  74 68 65 20 63 6f 6c 6f  75 72 73 20 6d 65 6e 75  |the colours menu|
00003dd0  20 2d 20 61 6e 64 20 63  61 6e 20 62 65 20 73 65  | - and can be se|
00003de0  6c 65 63 74 65 64 20 66  72 6f 6d 20 61 0a 20 20  |lected from a.  |
00003df0  20 20 70 61 6c 65 74 74  65 2e 20 43 6f 6c 6f 75  |  palette. Colou|
00003e00  72 73 20 30 2d 38 20 68  61 76 65 20 61 20 73 74  |rs 0-8 have a st|
00003e10  61 6e 64 61 72 64 20 69  6e 74 65 72 70 72 65 74  |andard interpret|
00003e20  61 74 69 6f 6e 20 62 75  74 20 63 6f 6c 6f 75 72  |ation but colour|
00003e30  73 20 39 2d 31 35 0a 20  20 20 20 63 61 6e 20 62  |s 9-15.    can b|
00003e40  65 20 75 73 65 64 20 61  73 20 74 68 65 20 6d 6f  |e used as the mo|
00003e50  64 65 20 73 65 65 73 20  66 69 74 2e 20 45 67 2c  |de sees fit. Eg,|
00003e60  20 63 6f 6c 6f 75 72 20  39 20 6d 61 79 20 62 65  | colour 9 may be|
00003e70  20 75 73 65 64 20 66 6f  72 20 49 46 0a 20 20 20  | used for IF.   |
00003e80  20 73 74 61 74 65 6d 65  6e 74 73 20 69 6e 20 61  | statements in a|
00003e90  20 6c 61 6e 67 75 61 67  65 20 65 64 69 74 6f 72  | language editor|
00003ea0  20 66 6f 72 20 65 78 61  6d 70 6c 65 2e 20 54 68  | for example. Th|
00003eb0  65 20 73 74 61 6e 64 61  72 64 20 63 6f 6c 6f 75  |e standard colou|
00003ec0  72 73 20 61 72 65 0a 20  20 20 20 09 30 3d 42 61  |rs are.    .0=Ba|
00003ed0  63 6b 67 72 6f 75 6e 64  20 63 6f 6c 6f 75 72 20  |ckground colour |
00003ee0  31 20 28 64 65 66 61 75  6c 74 20 62 61 63 6b 67  |1 (default backg|
00003ef0  72 6f 75 6e 64 20 63 6f  6c 6f 75 72 20 2b 20 6f  |round colour + o|
00003f00  66 66 20 65 6e 64 20 6f  66 20 74 65 78 74 29 0a  |ff end of text).|
00003f10  20 20 20 20 09 31 3d 42  61 63 6b 67 72 6f 75 6e  |    .1=Backgroun|
00003f20  64 20 63 6f 6c 6f 75 72  20 32 20 28 74 68 69 73  |d colour 2 (this|
00003f30  20 73 68 6f 75 6c 64 20  62 65 20 75 73 65 64 20  | should be used |
00003f40  75 6e 64 65 72 20 74 65  78 74 29 0a 20 20 20 20  |under text).    |
00003f50  09 32 3d 53 74 61 6e 64  61 72 64 20 66 6f 72 65  |.2=Standard fore|
00003f60  67 72 6f 75 6e 64 20 63  6f 6c 6f 75 72 0a 20 20  |ground colour.  |
00003f70  20 20 09 33 2f 34 3d 73  65 6c 65 63 74 69 6f 6e  |  .3/4=selection|
00003f80  20 62 61 63 2f 66 6f 72  65 67 72 6f 75 6e 64 20  | bac/foreground |
00003f90  35 2f 36 3d 63 75 72 73  6f 72 20 62 61 63 2f 66  |5/6=cursor bac/f|
00003fa0  6f 72 65 67 72 6f 75 6e  64 0a 20 20 20 20 09 37  |oreground.    .7|
00003fb0  3d 6c 69 6e 65 20 6e 75  6d 62 65 72 73 20 38 3d  |=line numbers 8=|
00003fc0  63 6f 6e 74 72 6f 6c 20  63 68 61 72 61 63 74 65  |control characte|
00003fd0  72 73 2e 0a 20 20 20 20  4c 65 74 20 6e 20 62 65  |rs..    Let n be|
00003fe0  20 74 68 65 20 76 61 6c  75 65 20 73 74 6f 72 65  | the value store|
00003ff0  64 20 69 6e 20 52 38 2c  23 77 5f 74 78 74 77 2e  |d in R8,#w_txtw.|
00004000  20 54 68 65 6e 20 74 68  65 20 66 6f 72 65 67 72  | Then the foregr|
00004010  6f 75 6e 64 20 63 6f 6c  6f 75 72 20 6f 66 0a 20  |ound colour of. |
00004020  20 20 20 74 68 65 20 63  61 63 68 65 64 20 63 68  |   the cached ch|
00004030  61 72 61 63 74 65 72 20  73 74 6f 72 65 64 20 61  |aracter stored a|
00004040  74 20 52 36 20 69 73 20  73 74 6f 72 65 64 20 61  |t R6 is stored a|
00004050  74 20 52 36 2b 6e 20 61  6e 64 20 74 68 65 20 62  |t R6+n and the b|
00004060  61 63 6b 67 72 6f 75 6e  64 0a 20 20 20 20 63 6f  |ackground.    co|
00004070  6c 6f 75 72 20 61 74 20  52 36 2b 32 2a 6e 2e 20  |lour at R6+2*n. |
00004080  54 68 65 73 65 20 61 72  65 20 69 6e 69 74 69 61  |These are initia|
00004090  6c 6c 79 20 63 6c 65 61  72 65 64 20 74 6f 20 62  |lly cleared to b|
000040a0  79 74 65 73 20 27 32 27  20 61 6e 64 20 27 30 27  |ytes '2' and '0'|
000040b0  0a 20 20 20 20 72 65 73  70 65 63 74 69 76 65 6c  |.    respectivel|
000040c0  79 20 2d 20 79 6f 75 20  73 68 6f 75 6c 64 20 6f  |y - you should o|
000040d0  76 65 72 77 72 69 74 65  20 74 68 65 73 65 20 62  |verwrite these b|
000040e0  79 74 65 73 20 74 6f 20  63 68 61 6e 67 65 20 74  |ytes to change t|
000040f0  68 65 20 63 6f 6c 6f 75  72 2e 0a 20 20 20 20 54  |he colour..    T|
00004100  65 78 74 20 6d 6f 64 65  20 70 75 74 73 20 63 6f  |ext mode puts co|
00004110  6c 6f 75 72 20 31 20 28  62 61 63 6b 67 72 6f 75  |lour 1 (backgrou|
00004120  6e 64 20 63 6f 6c 6f 75  72 20 32 29 20 75 6e 64  |nd colour 2) und|
00004130  65 72 20 61 63 74 75 61  6c 20 74 65 78 74 20 61  |er actual text a|
00004140  6e 64 20 79 6f 75 0a 20  20 20 20 73 68 6f 75 6c  |nd you.    shoul|
00004150  64 20 64 6f 20 74 68 65  20 73 61 6d 65 2e 20 53  |d do the same. S|
00004160  65 65 20 65 5f 69 6e 69  74 20 66 6f 72 20 68 6f  |ee e_init for ho|
00004170  77 20 74 6f 20 63 68 61  6e 67 65 20 74 68 65 20  |w to change the |
00004180  63 6f 6c 6f 75 72 73 20  6d 65 6e 75 2e 0a 20 34  |colours menu.. 4|
00004190  29 20 4f 74 68 65 72 20  63 6f 6d 6d 65 6e 74 73  |) Other comments|
000041a0  3a 0a 20 20 20 20 4f 6e  20 65 78 69 74 20 79 6f  |:.    On exit yo|
000041b0  75 20 73 68 6f 75 6c 64  20 75 70 64 61 74 65 20  |u should update |
000041c0  73 65 76 65 72 61 6c 20  72 65 67 69 73 74 65 72  |several register|
000041d0  73 20 74 6f 20 74 68 65  20 73 74 61 72 74 20 6f  |s to the start o|
000041e0  66 20 74 68 65 20 6e 65  78 74 0a 20 20 20 20 70  |f the next.    p|
000041f0  68 79 73 69 63 61 6c 20  6c 69 6e 65 2e 20 65 5f  |hysical line. e_|
00004200  63 6c 6e 70 68 79 20 69  73 20 6f 6e 6c 79 20 63  |clnphy is only c|
00004210  61 6c 6c 65 64 20 66 6f  72 20 74 68 65 20 66 69  |alled for the fi|
00004220  72 73 74 20 6c 69 6e 65  20 69 6e 20 61 20 67 72  |rst line in a gr|
00004230  6f 75 70 2e 0a 20 20 20  20 46 6f 72 20 61 20 73  |oup..    For a s|
00004240  69 6d 70 6c 65 20 65 78  61 6d 70 6c 65 20 6f 66  |imple example of|
00004250  20 68 6f 77 20 74 6f 20  77 72 69 74 65 20 74 68  | how to write th|
00004260  69 73 20 72 65 64 72 61  77 20 63 6f 64 65 2c 20  |is redraw code, |
00004270  73 65 65 20 74 68 65 20  63 6f 64 65 20 66 6f 72  |see the code for|
00004280  0a 20 20 20 20 6d 6f 64  65 20 33 20 28 61 73 63  |.    mode 3 (asc|
00004290  69 69 20 6d 6f 64 65 29  2e 0a 09 5c 45 20 52 34  |ii mode)...\E R4|
000042a0  3d 77 5f 66 6f 72 6d 61  74 20 28 72 65 61 64 20  |=w_format (read |
000042b0  66 72 6f 6d 20 52 38 2c  23 77 5f 66 6f 72 6d 61  |from R8,#w_forma|
000042c0  74 29 0a 09 20 20 20 52  35 3d 61 70 70 61 72 65  |t)..   R5=appare|
000042d0  6e 74 20 62 75 66 66 65  72 20 73 74 61 72 74 20  |nt buffer start |
000042e0  28 52 37 2d 6f 66 66 73  65 74 20 6f 66 20 63 68  |(R7-offset of ch|
000042f0  61 72 20 69 6e 20 66 69  6c 65 29 0a 09 20 20 20  |ar in file)..   |
00004300  20 20 20 28 73 6f 20 69  74 20 69 73 20 65 69 74  |   (so it is eit|
00004310  68 65 72 20 66 5f 70 74  72 20 6f 72 20 66 5f 70  |her f_ptr or f_p|
00004320  74 72 2b 66 5f 73 70 6c  69 74 73 29 0a 09 20 20  |tr+f_splits)..  |
00004330  20 52 36 3d 61 64 64 72  65 73 73 20 6f 66 20 63  | R6=address of c|
00004340  61 63 68 65 20 6c 69 6e  65 20 74 6f 20 64 72 61  |ache line to dra|
00004350  77 20 6c 69 6e 65 20 69  6e 20 28 61 6c 72 65 61  |w line in (alrea|
00004360  64 79 20 62 6c 61 6e 6b  65 64 29 0a 09 20 20 20  |dy blanked)..   |
00004370  52 37 3d 61 64 64 72 65  73 73 20 6f 66 20 73 74  |R7=address of st|
00004380  61 72 74 20 6f 66 20 28  73 6f 75 72 63 65 29 20  |art of (source) |
00004390  6c 69 6e 65 20 28 52 35  2b 66 69 6c 65 20 6f 66  |line (R5+file of|
000043a0  66 73 65 74 20 6f 66 20  6c 69 6e 65 29 2e 0a 09  |fset of line)...|
000043b0  20 20 20 52 38 2f 52 39  0a 09 20 20 20 52 31 30  |   R8/R9..   R10|
000043c0  3d 61 64 64 72 65 73 73  20 6f 66 20 65 6e 64 20  |=address of end |
000043d0  6f 66 20 74 68 69 73 20  73 65 63 74 69 6f 6e 20  |of this section |
000043e0  6f 66 20 74 68 65 20 62  75 66 66 65 72 2e 0a 09  |of the buffer...|
000043f0  20 20 20 20 20 20 20 28  73 6f 20 77 68 65 6e 20  |       (so when |
00004400  79 6f 75 20 72 65 61 63  68 20 52 31 30 20 79 6f  |you reach R10 yo|
00004410  75 20 69 6e 63 72 65 61  73 65 20 52 35 20 61 6e  |u increase R5 an|
00004420  64 20 52 37 20 62 79 20  66 5f 73 70 6c 69 74 73  |d R7 by f_splits|
00004430  20 69 66 0a 09 20 20 20  20 20 20 20 61 74 20 74  | if..       at t|
00004440  68 65 20 65 6e 64 20 6f  66 20 74 68 65 20 66 69  |he end of the fi|
00004450  72 73 74 20 68 61 6c 66  20 6f 72 20 73 74 6f 70  |rst half or stop|
00004460  20 69 66 20 61 74 20 74  68 65 20 66 69 6c 65 20  | if at the file |
00004470  65 6e 64 29 2e 0a 09 20  20 20 52 31 31 3d 6c 6f  |end)...   R11=lo|
00004480  67 69 63 61 6c 20 6c 69  6e 65 20 6e 75 6d 62 65  |gical line numbe|
00004490  72 20 28 66 6f 72 20 79  6f 75 20 74 6f 20 75 70  |r (for you to up|
000044a0  64 61 74 65 20 66 6f 72  20 63 61 63 68 65 20 72  |date for cache r|
000044b0  65 66 65 72 65 6e 63 65  0a 09 20 20 20 20 20 20  |eference..      |
000044c0  20 61 6e 64 20 70 72 69  6e 74 69 6e 67 20 69 6e  | and printing in|
000044d0  20 74 68 65 20 6c 65 66  74 20 68 61 6e 64 20 63  | the left hand c|
000044e0  6f 6c 75 6d 6e 29 2e 0a  09 5c 58 20 52 30 2d 52  |olumn)...\X R0-R|
000044f0  34 2c 52 36 2c 52 31 30  20 6d 61 79 20 62 65 20  |4,R6,R10 may be |
00004500  63 6f 72 72 75 70 74 65  64 0a 09 20 20 20 52 35  |corrupted..   R5|
00004510  2c 52 37 2c 52 31 31 20  6d 75 73 74 20 62 65 20  |,R7,R11 must be |
00004520  75 70 64 61 74 65 64 20  74 6f 20 74 68 65 20 73  |updated to the s|
00004530  74 61 72 74 20 6f 66 20  74 68 65 20 6e 65 78 74  |tart of the next|
00004540  20 70 68 79 73 69 63 61  6c 20 6c 69 6e 65 0a 09  | physical line..|
00004550  a0 20 20 52 38 2d 52 39  2c 52 31 32 20 6d 75 73  |.  R8-R9,R12 mus|
00004560  74 20 62 65 20 70 72 65  73 65 72 76 65 64 0a 0a  |t be preserved..|
00004570  65 5f 72 65 64 72 61 77  6c 6e 75 6d 0a 54 68 69  |e_redrawlnum.Thi|
00004580  73 20 69 73 20 63 61 6c  6c 65 64 20 77 68 65 6e  |s is called when|
00004590  20 74 68 65 20 75 73 65  72 20 77 69 73 68 65 73  | the user wishes|
000045a0  20 6c 6f 67 69 63 61 6c  20 6c 69 6e 65 20 6e 75  | logical line nu|
000045b0  6d 62 65 72 73 20 74 6f  20 62 65 20 64 69 73 70  |mbers to be disp|
000045c0  6c 61 79 65 64 20 6f 6e  0a 74 68 65 20 6c 65 66  |layed on.the lef|
000045d0  74 2e 20 59 6f 75 20 6d  75 73 74 20 64 65 63 69  |t. You must deci|
000045e0  64 65 20 77 68 65 74 68  65 72 20 74 68 65 20 67  |de whether the g|
000045f0  69 76 65 6e 20 70 68 79  73 69 63 61 6c 20 6c 69  |iven physical li|
00004600  6e 65 20 66 69 6c 65 20  6f 66 66 73 65 74 20 69  |ne file offset i|
00004610  74 20 61 74 0a 74 68 65  20 73 74 61 72 74 20 6f  |t at.the start o|
00004620  66 20 61 20 6c 6f 67 69  63 61 6c 20 6c 69 6e 65  |f a logical line|
00004630  2e 20 54 68 69 73 20 69  73 20 63 61 6c 6c 65 64  |. This is called|
00004640  20 77 68 69 6c 65 20 72  65 64 72 61 77 69 6e 67  | while redrawing|
00004650  20 74 68 65 20 6c 69 6e  65 20 6e 75 6d 62 65 72  | the line number|
00004660  73 2e 0a 09 5c 45 20 52  37 3d 66 69 6c 65 20 6f  |s...\E R7=file o|
00004670  66 66 73 65 74 20 6f 66  20 73 74 61 72 74 20 6f  |ffset of start o|
00004680  66 20 70 68 79 73 69 63  61 6c 20 6c 69 6e 65 0a  |f physical line.|
00004690  09 20 20 20 52 31 31 3d  70 72 6f 70 6f 73 65 64  |.   R11=proposed|
000046a0  20 6c 6f 67 69 63 61 6c  20 6c 69 6e 65 20 6e 75  | logical line nu|
000046b0  6d 62 65 72 20 28 61 73  20 63 61 6c 63 75 6c 61  |mber (as calcula|
000046c0  74 65 64 20 62 79 20 65  5f 63 6c 6e 70 68 79 29  |ted by e_clnphy)|
000046d0  0a 09 20 20 20 52 38 2f  52 39 0a 09 5c 58 20 43  |..   R8/R9..\X C|
000046e0  43 20 69 66 20 52 37 20  69 73 20 61 74 20 74 68  |C if R7 is at th|
000046f0  65 20 73 74 61 72 74 20  6f 66 20 61 20 6c 6f 67  |e start of a log|
00004700  69 63 61 6c 20 6c 69 6e  65 20 28 73 6f 20 70 72  |ical line (so pr|
00004710  69 6e 74 20 69 74 29 0a  09 20 20 20 43 53 20 69  |int it)..   CS i|
00004720  66 20 74 68 65 20 6c 69  6e 65 20 6e 75 6d 62 65  |f the line numbe|
00004730  72 20 63 6f 6c 75 6d 6e  20 73 68 6f 75 6c 64 20  |r column should |
00004740  62 65 20 6c 65 66 74 20  62 6c 61 6e 6b 0a 09 20  |be left blank.. |
00004750  20 20 59 6f 75 20 6d 61  79 20 63 6f 72 72 75 70  |  You may corrup|
00004760  74 20 52 30 2d 52 34 2e  20 59 6f 75 20 6d 61 79  |t R0-R4. You may|
00004770  20 61 6c 73 6f 20 63 68  61 6e 67 65 20 52 31 31  | also change R11|
00004780  20 61 73 20 42 41 53 49  43 20 64 6f 65 73 0a 09  | as BASIC does..|
00004790  20 20 20 62 75 74 20 74  68 69 73 20 69 73 20 6e  |   but this is n|
000047a0  6f 74 20 61 64 76 69 73  65 64 20 61 73 20 74 68  |ot advised as th|
000047b0  65 20 77 5f 63 6c 6f 67  6c 20 77 69 6c 6c 20 67  |e w_clogl will g|
000047c0  65 74 20 6f 75 74 20 6f  66 20 73 79 6e 63 2e 0a  |et out of sync..|
000047d0  09 20 20 20 42 41 53 49  43 20 69 67 6e 6f 72 65  |.   BASIC ignore|
000047e0  73 20 74 68 65 20 77 5f  63 6c 6f 67 6c 20 61 73  |s the w_clogl as|
000047f0  20 74 68 65 20 6c 69 6e  65 20 6e 75 6d 62 65 72  | the line number|
00004800  20 69 73 20 73 74 6f 72  65 64 20 69 6e 20 74 68  | is stored in th|
00004810  65 0a 09 20 20 20 66 69  6c 65 2e 0a 0a 65 5f 63  |e..   file...e_c|
00004820  68 61 72 0a 54 68 69 73  20 69 73 20 63 61 6c 6c  |har.This is call|
00004830  65 64 20 77 68 65 6e 20  74 68 65 20 75 73 65 72  |ed when the user|
00004840  20 74 79 70 65 73 20 61  20 73 74 72 69 6e 67 20  | types a string |
00004850  6f 66 20 61 73 63 69 69  20 63 68 61 72 73 20 76  |of ascii chars v|
00004860  69 61 20 74 68 65 20 43  48 41 52 0a 63 6f 6d 6d  |ia the CHAR.comm|
00004870  61 6e 64 2e 20 54 68 65  20 63 68 61 72 61 63 74  |and. The charact|
00004880  65 72 73 20 68 61 76 65  20 62 65 65 6e 20 63 6f  |ers have been co|
00004890  6e 63 61 74 65 6e 61 74  65 64 20 66 6f 72 20 79  |ncatenated for y|
000048a0  6f 75 2e 20 59 6f 75 20  73 68 6f 75 6c 64 20 70  |ou. You should p|
000048b0  65 72 66 6f 72 6d 0a 74  68 65 20 72 65 6c 65 76  |erform.the relev|
000048c0  61 6e 74 20 69 6e 73 65  72 74 69 6f 6e 73 2f 64  |ant insertions/d|
000048d0  65 6c 65 74 69 6f 6e 73  20 76 69 61 20 5a 61 70  |eletions via Zap|
000048e0  5f 43 6f 6d 6d 61 6e 64  2e 0a 09 5c 45 20 52 34  |_Command...\E R4|
000048f0  3d 77 5f 66 6c 61 67 73  0a 09 20 20 20 52 35 3d  |=w_flags..   R5=|
00004900  6e 75 6d 62 65 72 20 6f  66 20 62 79 74 65 73 20  |number of bytes |
00004910  74 79 70 65 64 0a 09 20  20 20 52 36 3d 77 5f 66  |typed..   R6=w_f|
00004920  6f 72 6d 61 74 0a 09 20  20 20 52 37 3d 61 64 64  |ormat..   R7=add|
00004930  72 65 73 73 20 6f 66 20  74 79 70 65 64 20 64 61  |ress of typed da|
00004940  74 61 0a 09 20 20 20 52  38 2d 52 31 30 3d 69 6e  |ta..   R8-R10=in|
00004950  70 75 74 20 63 61 72 65  74 20 28 69 65 20 74 68  |put caret (ie th|
00004960  69 73 20 70 6f 69 6e 74  73 20 74 6f 20 74 68 65  |is points to the|
00004970  20 62 6c 6f 63 6b 20 63  61 72 5f 63 75 72 73 6f  | block car_curso|
00004980  72 20 6f 72 0a 09 20 20  20 20 20 20 20 20 20 20  |r or..          |
00004990  63 61 72 5f 69 6e 70 75  74 20 64 65 70 65 6e 64  |car_input depend|
000049a0  69 6e 67 20 6f 6e 20 74  68 65 20 63 61 72 65 74  |ing on the caret|
000049b0  20 6d 6f 64 65 20 61 6e  64 20 77 68 65 72 65 20  | mode and where |
000049c0  74 79 70 65 64 0a 09 20  20 20 20 20 20 20 20 20  |typed..         |
000049d0  20 74 65 78 74 20 73 68  6f 75 6c 64 20 67 6f 29  | text should go)|
000049e0  2e 0a 09 5c 58 20 59 6f  75 20 6d 61 79 20 63 6f  |...\X You may co|
000049f0  72 72 75 70 74 20 52 30  2d 52 31 31 0a 0a 65 5f  |rrupt R0-R11..e_|
00004a00  64 65 6c 65 74 65 0a 54  68 69 73 20 69 73 20 63  |delete.This is c|
00004a10  61 6c 6c 65 64 20 77 68  65 6e 20 74 68 65 20 75  |alled when the u|
00004a20  73 65 72 20 65 78 65 63  75 74 65 73 20 74 68 65  |ser executes the|
00004a30  20 63 6f 6d 6d 61 6e 64  73 20 44 45 4c 45 54 45  | commands DELETE|
00004a40  20 6f 72 20 44 45 4c 45  54 45 4e 45 58 54 2e 20  | or DELETENEXT. |
00004a50  41 0a 73 65 71 75 65 6e  63 65 20 6f 66 20 64 65  |A.sequence of de|
00004a60  6c 65 74 65 73 20 69 73  20 63 6f 6e 63 61 74 65  |letes is concate|
00004a70  6e 61 74 65 64 20 66 6f  72 20 79 6f 75 2e 20 59  |nated for you. Y|
00004a80  6f 75 20 73 68 6f 75 6c  64 20 75 73 65 20 5a 61  |ou should use Za|
00004a90  70 5f 43 6f 6d 6d 61 6e  64 20 74 6f 0a 64 65 6c  |p_Command to.del|
00004aa0  65 74 65 20 74 68 65 20  74 65 78 74 2e 20 54 72  |ete the text. Tr|
00004ab0  79 20 61 6e 64 20 73 75  70 70 6f 72 74 20 74 68  |y and support th|
00004ac0  65 20 6c 69 6e 65 20 65  64 69 74 20 6d 6f 64 65  |e line edit mode|
00004ad0  2e 0a 09 5c 45 20 52 35  3d 6e 75 6d 62 65 72 20  |...\E R5=number |
00004ae0  6f 66 20 74 69 6d 65 73  20 70 72 65 73 73 65 64  |of times pressed|
00004af0  0a 09 20 20 20 52 36 3d  77 5f 66 6f 72 6d 61 74  |..   R6=w_format|
00004b00  0a 09 20 20 20 52 37 3d  30 20 66 6f 72 20 44 45  |..   R7=0 for DE|
00004b10  4c 45 54 45 2f 31 20 66  6f 72 20 44 45 4c 45 54  |LETE/1 for DELET|
00004b20  45 4e 45 58 54 0a 09 20  20 20 52 38 2d 52 31 30  |ENEXT..   R8-R10|
00004b30  3d 69 6e 70 75 74 20 63  61 72 65 74 0a 09 5c 58  |=input caret..\X|
00004b40  20 59 6f 75 20 6d 61 79  20 63 6f 72 72 75 70 74  | You may corrupt|
00004b50  20 52 30 2d 52 31 31 0a  0a 65 5f 74 61 62 0a 54  | R0-R11..e_tab.T|
00004b60  68 69 73 20 69 73 20 63  61 6c 6c 65 64 20 77 68  |his is called wh|
00004b70  65 6e 20 74 68 65 20 75  73 65 72 20 65 78 65 63  |en the user exec|
00004b80  75 74 65 73 20 74 68 65  20 63 6f 6d 6d 61 6e 64  |utes the command|
00004b90  20 54 41 42 2e 20 41 73  20 75 73 75 61 6c 2c 20  | TAB. As usual, |
00004ba0  72 65 70 65 74 69 74 69  6f 6e 73 0a 61 72 65 20  |repetitions.are |
00004bb0  63 6f 6e 63 61 74 65 6e  61 74 65 64 2e 20 55 73  |concatenated. Us|
00004bc0  65 20 5a 61 70 5f 43 6f  6d 6d 61 6e 64 20 74 6f  |e Zap_Command to|
00004bd0  20 70 65 72 66 6f 72 6d  20 74 68 65 20 66 75 6e  | perform the fun|
00004be0  63 74 69 6f 6e 2e 0a 09  5c 45 20 52 31 3d 6e 75  |ction...\E R1=nu|
00004bf0  6d 62 65 72 20 6f 66 20  74 69 6d 65 73 20 70 72  |mber of times pr|
00004c00  65 73 73 65 64 0a 09 20  20 20 52 38 2d 52 31 30  |essed..   R8-R10|
00004c10  3d 69 6e 70 75 74 20 63  61 72 65 74 0a 09 5c 58  |=input caret..\X|
00004c20  20 59 6f 75 20 6d 61 79  20 63 6f 72 72 75 70 74  | You may corrupt|
00004c30  20 52 30 2d 52 31 31 0a  0a 65 5f 72 65 74 75 72  | R0-R11..e_retur|
00004c40  6e 09 43 61 6c 6c 65 64  20 77 68 65 6e 20 52 45  |n.Called when RE|
00004c50  54 55 52 4e 20 65 78 65  63 75 74 65 64 20 28 5c  |TURN executed (\|
00004c60  45 20 5c 58 20 61 73 20  66 6f 72 20 65 5f 74 61  |E \X as for e_ta|
00004c70  62 29 0a 65 5f 72 65 6e  75 6d 62 65 72 09 43 61  |b).e_renumber.Ca|
00004c80  6c 6c 65 64 20 77 68 65  6e 20 52 45 4e 55 4d 42  |lled when RENUMB|
00004c90  45 52 20 65 78 65 63 75  74 65 64 20 28 5c 45 20  |ER executed (\E |
00004ca0  5c 58 20 61 73 20 66 6f  72 20 65 5f 74 61 62 29  |\X as for e_tab)|
00004cb0  0a 65 5f 73 61 76 65 61  6e 64 72 75 6e 09 43 61  |.e_saveandrun.Ca|
00004cc0  6c 6c 65 64 20 77 68 65  6e 20 53 41 56 45 41 4e  |lled when SAVEAN|
00004cd0  44 52 55 4e 20 65 78 65  63 75 74 65 64 20 28 5c  |DRUN executed (\|
00004ce0  45 20 5c 58 20 61 73 20  66 6f 72 20 65 5f 74 61  |E \X as for e_ta|
00004cf0  62 29 0a 0a 54 68 65 20  6e 65 78 74 20 34 20 73  |b)..The next 4 s|
00004d00  75 62 73 20 61 72 65 20  75 73 65 64 20 62 79 20  |ubs are used by |
00004d10  74 68 65 20 76 61 72 69  6f 75 73 20 64 65 6c 65  |the various dele|
00004d20  74 65 20 6c 69 6e 65 20  63 61 6c 6c 73 2e 20 54  |te line calls. T|
00004d30  68 65 79 20 65 61 63 68  20 68 61 76 65 0a 09 5c  |hey each have..\|
00004d40  45 20 52 30 3d 63 75 72  72 65 6e 74 20 66 69 6c  |E R0=current fil|
00004d50  65 20 6f 66 66 73 65 74  20 69 6e 20 61 20 6c 69  |e offset in a li|
00004d60  6e 65 20 52 38 2f 52 39  0a 09 5c 58 20 52 30 3d  |ne R8/R9..\X R0=|
00004d70  6e 65 77 20 66 69 6c 65  20 6f 66 66 73 65 74 20  |new file offset |
00004d80  28 73 65 65 20 62 65 6c  6f 77 29 0a 54 68 69 73  |(see below).This|
00004d90  20 69 73 20 68 6f 77 20  74 68 65 20 73 75 62 73  | is how the subs|
00004da0  20 61 72 65 20 63 61 6c  6c 65 64 3a 0a 0a 44 45  | are called:..DE|
00004db0  4c 4c 49 4e 45 09 09 44  65 6c 65 74 65 73 20 66  |LLINE..Deletes f|
00004dc0  72 6f 6d 20 6c 69 6e 65  70 72 65 76 20 74 6f 20  |rom lineprev to |
00004dd0  6c 69 6e 65 6e 65 78 74  20 6f 66 66 73 65 74 73  |linenext offsets|
00004de0  2e 0a 44 45 4c 54 4f 45  4e 44 09 44 65 6c 65 74  |..DELTOEND.Delet|
00004df0  65 73 20 66 72 6f 6d 20  63 75 72 72 65 6e 74 20  |es from current |
00004e00  6f 66 66 73 65 74 20 74  6f 20 6c 69 6e 65 65 6e  |offset to lineen|
00004e10  64 20 75 6e 6c 65 73 73  20 74 68 69 73 20 69 73  |d unless this is|
00004e20  20 65 6d 70 74 79 0a 09  09 77 68 65 6e 20 69 74  | empty...when it|
00004e30  20 63 61 6c 6c 73 20 4a  4f 49 4e 4c 49 4e 45 20  | calls JOINLINE |
00004e40  28 61 73 20 69 6e 20 65  6d 61 63 73 20 63 74 72  |(as in emacs ctr|
00004e50  6c 20 4b 29 0a 44 45 4c  54 4f 53 54 41 52 54 09  |l K).DELTOSTART.|
00004e60  44 65 6c 65 74 65 73 20  66 72 6f 6d 20 6c 69 6e  |Deletes from lin|
00004e70  65 73 74 61 72 74 20 74  6f 20 63 75 72 72 65 6e  |estart to curren|
00004e80  74 20 6f 66 66 73 65 74  20 75 6e 6c 65 73 73 20  |t offset unless |
00004e90  65 6d 70 74 79 2e 0a 0a  65 5f 6c 69 6e 65 73 74  |empty...e_linest|
00004ea0  61 72 74 09 43 61 6c 6c  65 64 20 74 6f 20 66 69  |art.Called to fi|
00004eb0  6e 64 20 74 68 65 20 6c  69 6e 65 73 20 66 69 72  |nd the lines fir|
00004ec0  73 74 20 63 68 61 72 61  63 74 65 72 2e 0a 65 5f  |st character..e_|
00004ed0  6c 69 6e 65 65 6e 64 09  43 61 6c 6c 65 64 20 74  |lineend.Called t|
00004ee0  6f 20 66 69 6e 64 20 74  68 65 20 6c 69 6e 65 73  |o find the lines|
00004ef0  20 6c 61 73 74 20 63 68  61 72 61 63 74 65 72 2e  | last character.|
00004f00  0a 65 5f 6c 69 6e 65 6e  65 78 74 09 43 61 6c 6c  |.e_linenext.Call|
00004f10  65 64 20 74 6f 20 66 69  6e 64 20 74 68 65 20 6c  |ed to find the l|
00004f20  69 6e 65 73 20 61 63 74  75 61 6c 20 65 6e 64 20  |ines actual end |
00004f30  28 65 67 20 61 66 74 65  72 20 26 30 41 29 0a 65  |(eg after &0A).e|
00004f40  5f 6c 69 6e 65 70 72 65  76 09 43 61 6c 6c 65 64  |_lineprev.Called|
00004f50  20 74 6f 20 66 69 6e 64  20 74 68 65 20 6c 69 6e  | to find the lin|
00004f60  65 73 20 61 63 74 75 61  6c 20 73 74 61 72 74 20  |es actual start |
00004f70  28 65 67 20 66 6f 72 20  62 61 73 69 63 20 6c 69  |(eg for basic li|
00004f80  6e 65 73 29 0a 0a 65 5f  63 6f 70 79 0a 43 61 6c  |nes)..e_copy.Cal|
00004f90  6c 65 64 20 77 68 65 6e  20 75 73 65 72 20 77 69  |led when user wi|
00004fa0  73 68 65 73 20 74 6f 20  63 6f 70 79 20 63 68 61  |shes to copy cha|
00004fb0  72 61 63 74 65 72 73 20  76 69 61 20 74 68 65 20  |racters via the |
00004fc0  43 4f 50 59 20 6b 65 79  2e 20 49 73 20 69 73 20  |COPY key. Is is |
00004fd0  63 61 6c 6c 65 64 20 66  6f 72 0a 66 69 6e 64 69  |called for.findi|
00004fe0  6e 67 20 74 68 65 20 63  68 61 72 61 63 74 65 72  |ng the character|
00004ff0  73 20 74 6f 20 63 6f 70  79 20 61 6e 64 20 66 6f  |s to copy and fo|
00005000  72 20 69 6e 73 65 72 74  69 6e 67 20 74 68 65 20  |r inserting the |
00005010  63 6f 70 69 65 64 20 63  68 61 72 61 63 74 65 72  |copied character|
00005020  73 2e 0a 52 65 61 73 6f  6e 20 63 6f 64 65 20 69  |s..Reason code i|
00005030  73 20 69 6e 20 52 30 2e  20 57 68 65 6e 20 72 65  |s in R0. When re|
00005040  61 64 69 6e 67 20 63 68  61 72 61 63 74 65 72 73  |ading characters|
00005050  20 79 6f 75 20 6d 75 73  74 20 75 70 64 61 74 65  | you must update|
00005060  20 74 68 65 20 63 75 72  73 6f 72 0a 79 6f 75 72  | the cursor.your|
00005070  73 65 6c 66 2e 20 4e 6f  74 65 20 74 68 65 20 73  |self. Note the s|
00005080  6f 75 72 63 65 20 77 69  6e 64 6f 77 20 6d 61 79  |ource window may|
00005090  20 62 65 20 69 6e 20 61  20 64 69 66 66 65 72 65  | be in a differe|
000050a0  6e 74 20 6d 6f 64 65 20  74 6f 20 74 68 65 0a 64  |nt mode to the.d|
000050b0  65 73 74 69 6e 61 74 69  6f 6e 20 77 69 6e 64 6f  |estination windo|
000050c0  77 21 0a 09 09 5c 45 20  52 30 3d 31 20 3d 3e 20  |w!...\E R0=1 => |
000050d0  46 65 74 63 68 20 63 68  61 72 61 63 74 65 72 73  |Fetch characters|
000050e0  0a 09 09 20 20 20 52 31  3d 6e 75 6d 62 65 72 20  |...   R1=number |
000050f0  6f 66 20 74 69 6d 65 73  20 63 6f 70 79 20 70 72  |of times copy pr|
00005100  65 73 73 65 64 20 28 6e  75 6d 62 65 72 20 6f 66  |essed (number of|
00005110  20 63 68 61 72 73 20 74  6f 20 67 65 74 29 0a 09  | chars to get)..|
00005120  09 20 20 20 52 38 2d 52  31 30 3d 63 6f 70 79 20  |.   R8-R10=copy |
00005130  63 75 72 73 6f 72 20 28  63 61 72 5f 63 75 72 73  |cursor (car_curs|
00005140  6f 72 29 0a 09 09 5c 58  20 52 33 3d 70 6f 69 6e  |or)...\X R3=poin|
00005150  74 65 72 20 74 6f 20 62  75 66 66 65 72 20 63 6f  |ter to buffer co|
00005160  6e 74 61 69 6e 69 6e 67  20 63 68 61 72 61 63 74  |ntaining charact|
00005170  65 72 73 20 74 6f 20 27  74 79 70 65 27 0a 09 09  |ers to 'type'...|
00005180  20 20 20 52 32 3d 6e 75  6d 62 65 72 20 6f 66 20  |   R2=number of |
00005190  63 68 61 72 61 63 74 65  72 73 20 74 6f 20 27 74  |characters to 't|
000051a0  79 70 65 27 0a 09 09 20  20 20 43 6f 70 79 20 63  |ype'...   Copy c|
000051b0  75 72 73 6f 72 20 75 70  64 61 74 65 64 20 74 6f  |ursor updated to|
000051c0  20 6e 65 77 20 70 6f 73  69 74 69 6f 6e 0a 09 09  | new position...|
000051d0  4f 52 0a 09 09 5c 45 20  52 30 3d 32 20 3d 3e 20  |OR...\E R0=2 => |
000051e0  57 72 69 74 65 20 63 6f  70 69 65 64 20 63 68 61  |Write copied cha|
000051f0  72 61 63 74 65 72 73 0a  09 09 20 20 20 52 32 3d  |racters...   R2=|
00005200  6e 75 6d 62 65 72 20 6f  66 20 63 68 61 72 73 20  |number of chars |
00005210  74 6f 20 74 79 70 65 0a  09 09 20 20 20 52 33 3d  |to type...   R3=|
00005220  70 6f 69 6e 74 65 72 20  74 6f 20 74 68 65 20 63  |pointer to the c|
00005230  68 61 72 73 0a 09 09 20  20 20 52 38 2d 52 31 30  |hars...   R8-R10|
00005240  3d 69 6e 70 75 74 20 63  75 72 73 6f 72 20 28 63  |=input cursor (c|
00005250  61 72 5f 69 6e 70 75 74  29 0a 09 09 5c 58 20 52  |ar_input)...\X R|
00005260  30 3d 30 20 6d 65 61 6e  73 20 79 6f 75 27 76 65  |0=0 means you've|
00005270  20 64 6f 6e 65 20 69 74  20 61 6c 6c 20 79 6f 75  | done it all you|
00005280  72 73 65 6c 66 0a 09 09  20 20 20 52 30 3d 31 20  |rself...   R0=1 |
00005290  6d 65 61 6e 73 20 70 6c  65 61 73 65 20 65 6e 74  |means please ent|
000052a0  65 72 20 69 74 20 66 6f  72 20 6d 65 20 76 69 61  |er it for me via|
000052b0  20 5a 61 70 5f 43 6f 6d  6d 61 6e 64 0a 09 09 20  | Zap_Command... |
000052c0  20 20 52 30 3d 32 20 6d  65 61 6e 73 20 70 6c 65  |  R0=2 means ple|
000052d0  61 73 65 20 65 6e 74 65  72 20 69 74 20 66 6f 72  |ase enter it for|
000052e0  20 6d 65 20 62 79 20 63  61 6c 6c 69 6e 67 20 6d  | me by calling m|
000052f0  79 20 65 5f 63 68 61 72  73 0a 0a 65 5f 6a 6f 69  |y e_chars..e_joi|
00005300  6e 6c 69 6e 65 09 54 68  69 73 20 69 73 20 63 61  |nline.This is ca|
00005310  6c 6c 65 64 20 77 68 65  6e 20 4a 6f 69 6e 6c 69  |lled when Joinli|
00005320  6e 65 20 70 72 65 73 73  65 64 20 28 5c 45 20 5c  |ne pressed (\E \|
00005330  58 20 61 73 20 66 6f 72  20 65 5f 74 61 62 29 0a  |X as for e_tab).|
00005340  65 5f 73 70 6c 69 74 6c  69 6e 65 09 54 68 69 73  |e_splitline.This|
00005350  20 69 73 20 63 61 6c 6c  65 64 20 77 68 65 6e 20  | is called when |
00005360  53 70 6c 69 74 6c 69 6e  65 20 70 72 65 73 73 65  |Splitline presse|
00005370  64 20 28 5c 45 20 5c 58  20 61 73 20 66 6f 72 20  |d (\E \X as for |
00005380  65 5f 74 61 62 29 0a 0a  65 5f 61 6c 69 67 6e 63  |e_tab)..e_alignc|
00005390  61 72 65 74 0a 54 68 69  73 20 69 73 20 63 61 6c  |aret.This is cal|
000053a0  6c 65 64 20 62 65 66 6f  72 65 20 61 6e 79 20 63  |led before any c|
000053b0  6f 6d 6d 61 6e 64 73 20  61 72 65 20 65 78 65 63  |ommands are exec|
000053c0  75 74 65 64 20 6f 6e 20  61 20 77 69 6e 64 6f 77  |uted on a window|
000053d0  20 69 6e 20 79 6f 75 72  20 6d 6f 64 65 2e 0a 49  | in your mode..I|
000053e0  74 20 73 65 72 76 65 73  20 74 77 6f 20 70 75 72  |t serves two pur|
000053f0  70 6f 73 65 73 2e 20 54  68 65 20 66 69 72 73 74  |poses. The first|
00005400  20 69 73 20 74 6f 20 61  6c 69 67 6e 20 74 68 65  | is to align the|
00005410  20 69 6e 70 75 74 20 63  61 72 65 74 20 6f 66 66  | input caret off|
00005420  73 65 74 20 74 6f 20 61  0a 73 65 6e 73 69 62 6c  |set to a.sensibl|
00005430  65 20 70 6f 73 69 74 69  6f 6e 20 28 65 67 20 77  |e position (eg w|
00005440  6f 72 64 20 61 6c 69 67  6e 20 69 6e 20 77 6f 72  |ord align in wor|
00005450  64 20 6d 6f 64 65 2c 20  70 75 74 20 61 66 74 65  |d mode, put afte|
00005460  72 20 6c 69 6e 65 20 6e  75 6d 62 65 72 73 20 69  |r line numbers i|
00005470  6e 0a 62 61 73 69 63 29  2e 20 54 68 65 20 73 65  |n.basic). The se|
00005480  63 6f 6e 64 20 69 73 20  74 6f 20 72 65 73 65 74  |cond is to reset|
00005490  20 61 6e 79 20 63 6f 75  6e 74 65 72 73 20 79 6f  | any counters yo|
000054a0  75 20 6d 61 79 20 68 61  76 65 2e 20 46 6f 72 20  |u may have. For |
000054b0  65 78 61 6d 70 6c 65 2c  20 74 68 65 0a 68 65 78  |example, the.hex|
000054c0  20 6d 6f 64 65 20 65 6e  74 72 79 20 75 73 65 73  | mode entry uses|
000054d0  20 61 20 63 6f 75 6e 74  65 72 20 74 6f 20 74 65  | a counter to te|
000054e0  6c 6c 20 68 6f 77 20 6d  61 6e 79 20 6e 69 62 62  |ll how many nibb|
000054f0  6c 65 73 20 68 61 76 65  20 62 65 65 6e 20 69 6e  |les have been in|
00005500  73 65 72 74 65 64 20 69  6e 0a 61 20 77 6f 72 64  |serted in.a word|
00005510  2e 20 54 68 69 73 20 69  73 20 63 6c 65 61 72 65  |. This is cleare|
00005520  64 20 6f 6e 20 65 5f 61  6c 69 67 6e 63 61 72 65  |d on e_aligncare|
00005530  74 20 77 69 74 68 20 74  68 65 20 6f 6c 64 20 76  |t with the old v|
00005540  61 6c 75 65 20 62 65 69  6e 67 20 73 61 76 65 64  |alue being saved|
00005550  2e 20 54 68 65 6e 0a 69  66 20 74 68 65 20 63 6f  |. Then.if the co|
00005560  6d 6d 61 6e 64 20 27 69  6e 73 65 72 74 20 39 27  |mmand 'insert 9'|
00005570  20 69 73 20 65 78 65 63  75 74 65 64 20 69 74 20  | is executed it |
00005580  63 61 6e 20 72 65 74 72  69 65 76 65 20 61 6e 64  |can retrieve and|
00005590  20 72 65 73 74 6f 72 65  20 74 68 65 20 73 61 76  | restore the sav|
000055a0  65 64 0a 76 61 6c 75 65  2e 20 49 66 20 61 6e 79  |ed.value. If any|
000055b0  20 6f 74 68 65 72 20 63  6f 6d 6d 61 6e 64 20 69  | other command i|
000055c0  73 20 65 78 65 63 75 74  65 64 20 28 65 67 20 4c  |s executed (eg L|
000055d0  45 46 54 29 20 74 68 65  6e 20 74 68 65 20 63 6f  |EFT) then the co|
000055e0  75 6e 74 65 72 20 77 69  6c 6c 0a 72 65 6d 61 69  |unter will.remai|
000055f0  6e 20 72 65 73 65 74 2e  0a 09 5c 45 20 52 38 2d  |n reset...\E R8-|
00005600  52 31 30 3d 63 61 72 65  74 0a 09 5c 58 20 49 6e  |R10=caret..\X In|
00005610  70 75 74 20 63 61 72 65  74 20 6f 66 66 73 65 74  |put caret offset|
00005620  20 5b 52 31 30 2c 23 63  5f 6f 66 66 5d 20 63 61  | [R10,#c_off] ca|
00005630  6e 20 62 65 20 75 70 64  61 74 65 64 2e 0a 0a 65  |n be updated...e|
00005640  5f 63 6f 6d 6d 61 6e 64  0a 54 68 69 73 20 65 6e  |_command.This en|
00005650  74 72 79 20 70 6f 69 6e  74 20 69 73 20 63 61 6c  |try point is cal|
00005660  6c 65 64 20 77 68 65 6e  65 76 65 72 20 61 6e 79  |led whenever any|
00005670  6f 6e 65 20 69 73 73 75  65 73 20 61 20 5a 61 70  |one issues a Zap|
00005680  5f 43 6f 6d 6d 61 6e 64  20 63 61 6c 6c 2c 20 6f  |_Command call, o|
00005690  72 0a 65 71 75 69 76 61  6c 65 6e 74 2c 20 74 6f  |r.equivalent, to|
000056a0  20 74 72 79 20 61 6e 64  20 61 6c 74 65 72 20 61  | try and alter a|
000056b0  20 66 69 6c 65 20 69 6e  20 61 20 77 69 6e 64 6f  | file in a windo|
000056c0  77 20 69 6e 20 79 6f 75  72 20 6d 6f 64 65 2e 20  |w in your mode. |
000056d0  54 68 65 20 65 61 73 69  65 73 74 20 77 61 79 0a  |The easiest way.|
000056e0  74 6f 20 64 65 61 6c 20  77 69 74 68 20 74 68 69  |to deal with thi|
000056f0  73 20 69 73 20 74 6f 20  70 61 73 73 20 74 68 65  |s is to pass the|
00005700  20 63 61 6c 6c 20 6f 6e  74 6f 20 5a 61 70 5f 44  | call onto Zap_D|
00005710  6f 43 6f 6d 6d 61 6e 64  20 77 68 69 63 68 20 77  |oCommand which w|
00005720  69 6c 6c 20 70 65 72 66  6f 72 6d 0a 74 68 65 20  |ill perform.the |
00005730  61 6c 74 65 72 61 74 69  6f 6e 2e 20 48 6f 77 65  |alteration. Howe|
00005740  76 65 72 2c 20 69 66 20  79 6f 75 20 73 75 70 70  |ver, if you supp|
00005750  6f 72 74 20 77 6f 72 64  77 72 61 70 2c 20 79 6f  |ort wordwrap, yo|
00005760  75 20 6d 61 79 20 77 69  73 68 20 74 6f 20 27 66  |u may wish to 'f|
00005770  69 64 64 6c 65 27 0a 74  68 65 20 64 61 74 61 2c  |iddle'.the data,|
00005780  20 6f 72 20 65 76 65 6e  20 70 65 72 66 6f 72 6d  | or even perform|
00005790  20 61 64 64 69 74 69 6f  6e 61 6c 20 6f 70 65 72  | additional oper|
000057a0  61 74 69 6f 6e 73 2e 0a  09 5c 45 20 41 73 20 66  |ations...\E As f|
000057b0  6f 72 20 5a 61 70 5f 43  6f 6d 6d 61 6e 64 0a 0a  |or Zap_Command..|
000057c0  65 5f 63 6f 6d 70 69 6c  65 09 54 68 69 73 20 69  |e_compile.This i|
000057d0  73 20 63 61 6c 6c 65 64  20 77 68 65 6e 20 43 6f  |s called when Co|
000057e0  6d 70 69 6c 65 20 70 72  65 73 73 65 64 09 28 5c  |mpile pressed.(\|
000057f0  45 20 5c 58 20 61 73 20  66 6f 72 20 65 5f 74 61  |E \X as for e_ta|
00005800  62 29 0a 54 68 65 20 6d  6f 64 65 20 73 68 6f 75  |b).The mode shou|
00005810  6c 64 20 73 61 76 65 20  74 68 65 20 66 69 6c 65  |ld save the file|
00005820  20 74 6f 20 64 69 73 63  20 61 6e 64 20 74 68 65  | to disc and the|
00005830  6e 20 74 72 79 20 74 6f  20 63 6f 6d 70 69 6c 65  |n try to compile|
00005840  2f 72 75 6e 20 69 74 2e  0a 0a 65 5f 66 6f 72 6d  |/run it...e_form|
00005850  61 74 74 65 78 74 09 54  68 69 73 20 69 73 20 63  |attext.This is c|
00005860  61 6c 6c 65 64 20 77 68  65 6e 20 46 6f 72 6d 61  |alled when Forma|
00005870  74 74 65 78 74 20 70 72  65 73 73 65 64 09 28 5c  |ttext pressed.(\|
00005880  45 20 5c 58 20 61 73 20  66 6f 72 20 65 5f 74 61  |E \X as for e_ta|
00005890  62 29 0a 54 68 65 20 6d  6f 64 65 20 73 68 6f 75  |b).The mode shou|
000058a0  6c 64 20 74 72 79 20 61  6e 64 20 66 6f 72 6d 61  |ld try and forma|
000058b0  74 20 74 68 65 20 63 75  72 72 65 6e 74 20 70 61  |t the current pa|
000058c0  72 61 67 72 61 70 68 20  66 6f 72 20 69 74 73 20  |ragraph for its |
000058d0  70 61 72 74 69 63 75 6c  61 72 0a 6c 61 6e 67 75  |particular.langu|
000058e0  61 67 65 2e 0a 0a 65 5f  72 75 6e 09 09 54 68 69  |age...e_run..Thi|
000058f0  73 20 69 73 20 63 61 6c  6c 65 64 20 77 68 65 6e  |s is called when|
00005900  20 52 75 6e 20 70 72 65  73 73 65 64 09 09 28 5c  | Run pressed..(\|
00005910  45 20 5c 58 20 61 73 20  66 6f 72 20 65 5f 74 61  |E \X as for e_ta|
00005920  62 29 0a 54 68 65 20 6d  6f 64 65 20 73 68 6f 75  |b).The mode shou|
00005930  6c 64 20 74 72 79 20 61  6e 64 20 72 75 6e 20 74  |ld try and run t|
00005940  68 65 20 70 72 6f 67 72  61 6d 20 77 69 74 68 6f  |he program witho|
00005950  75 74 20 73 61 76 69 6e  67 20 69 74 2e 20 52 65  |ut saving it. Re|
00005960  76 65 72 74 20 74 6f 0a  65 5f 63 6f 6d 70 69 6c  |vert to.e_compil|
00005970  65 20 63 6f 64 65 20 69  66 20 74 68 65 72 65 20  |e code if there |
00005980  69 73 20 6e 6f 20 64 69  66 66 65 72 65 6e 63 65  |is no difference|
00005990  2e 0a 0a 65 5f 72 75 6e  61 6e 64 71 75 69 74 09  |...e_runandquit.|
000059a0  54 68 69 73 20 69 73 20  63 61 6c 6c 65 64 20 77  |This is called w|
000059b0  68 65 6e 20 52 75 6e 61  6e 64 71 75 69 74 20 70  |hen Runandquit p|
000059c0  72 65 73 73 65 64 09 28  5c 45 20 5c 58 20 61 73  |ressed.(\E \X as|
000059d0  20 66 6f 72 20 65 5f 74  61 62 29 0a 54 68 69 73  | for e_tab).This|
000059e0  20 73 68 6f 75 6c 64 20  61 63 74 20 61 73 20 65  | should act as e|
000059f0  5f 72 75 6e 20 62 75 74  20 61 64 64 20 61 20 2d  |_run but add a -|
00005a00  71 75 69 74 20 6f 70 74  69 6f 6e 20 69 66 20 70  |quit option if p|
00005a10  6f 73 73 69 62 6c 65 2e  0a 0a 65 5f 62 61 73 69  |ossible...e_basi|
00005a20  63 09 09 54 68 69 73 20  69 73 20 63 61 6c 6c 65  |c..This is calle|
00005a30  64 20 77 68 65 6e 20 42  61 73 69 63 20 70 72 65  |d when Basic pre|
00005a40  73 73 65 64 09 28 5c 45  20 5c 58 20 61 73 20 66  |ssed.(\E \X as f|
00005a50  6f 72 20 65 5f 74 61 62  29 0a 54 68 69 73 20 73  |or e_tab).This s|
00005a60  68 6f 75 6c 64 20 64 72  6f 70 20 74 68 65 20 66  |hould drop the f|
00005a70  69 6c 65 20 69 6e 74 6f  20 74 68 65 20 63 6f 6d  |ile into the com|
00005a80  6d 61 6e 64 20 6c 69 6e  65 20 73 74 61 74 65 20  |mand line state |
00005a90  6f 66 20 74 68 65 20 63  75 72 72 65 6e 74 0a 6c  |of the current.l|
00005aa0  61 6e 67 75 61 67 65 2e  0a 0a 65 5f 73 65 61 72  |anguage...e_sear|
00005ab0  63 68 0a 54 68 69 73 20  68 61 6e 64 6c 65 73 20  |ch.This handles |
00005ac0  73 74 72 69 6e 67 20 73  65 61 72 63 68 65 73 20  |string searches |
00005ad0  69 6e 20 79 6f 75 72 20  6d 6f 64 65 2e 20 52 31  |in your mode. R1|
00005ae0  20 67 69 76 65 73 20 74  68 65 20 72 65 61 73 6f  | gives the reaso|
00005af0  6e 20 63 6f 64 65 2e 20  49 74 20 67 69 76 65 73  |n code. It gives|
00005b00  0a 79 6f 75 20 61 20 63  68 61 6e 63 65 20 74 6f  |.you a chance to|
00005b10  20 27 64 6f 63 74 6f 72  27 20 74 68 65 20 73 74  | 'doctor' the st|
00005b20  72 69 6e 67 2e 20 45 67  2c 20 42 41 53 49 43 20  |ring. Eg, BASIC |
00005b30  6d 61 79 20 74 6f 6b 65  6e 69 73 65 20 69 74 2e  |may tokenise it.|
00005b40  20 49 74 20 69 73 20 61  6c 73 6f 0a 63 61 6c 6c  | It is also.call|
00005b50  65 64 20 74 6f 20 63 68  65 63 6b 20 61 20 6d 61  |ed to check a ma|
00005b60  74 63 68 20 69 73 20 61  74 20 61 20 76 61 6c 69  |tch is at a vali|
00005b70  64 20 6f 66 66 73 65 74  2e 20 45 67 2c 20 42 41  |d offset. Eg, BA|
00005b80  53 49 43 20 63 68 65 63  6b 73 20 69 74 20 69 73  |SIC checks it is|
00005b90  6e 27 74 20 69 6e 20 61  0a 6c 69 6e 65 20 6e 75  |n't in a.line nu|
00005ba0  6d 62 65 72 2e 0a 09 5c  45 20 52 31 3d 30 20 3d  |mber...\E R1=0 =|
00005bb0  3e 20 53 74 61 72 74 69  6e 67 20 61 20 73 65 61  |> Starting a sea|
00005bc0  72 63 68 0a 09 20 20 20  52 30 3d 73 65 61 72 63  |rch..   R0=searc|
00005bd0  68 20 73 74 72 69 6e 67  20 61 66 74 65 72 20 6d  |h string after m|
00005be0  61 63 72 6f 73 20 72 65  70 6c 61 63 65 64 20 28  |acros replaced (|
00005bf0  69 6e 20 61 20 68 65 61  70 20 62 6c 6f 63 6b 29  |in a heap block)|
00005c00  2e 0a 09 5c 58 20 52 30  3d 70 6f 73 73 69 62 6c  |...\X R0=possibl|
00005c10  79 20 6e 65 77 20 73 65  61 72 63 68 20 73 74 72  |y new search str|
00005c20  69 6e 67 2e 0a 09 4f 52  0a 09 5c 45 20 52 31 3d  |ing...OR..\E R1=|
00005c30  31 20 3d 3e 20 46 6f 75  6e 64 20 61 20 6d 61 74  |1 => Found a mat|
00005c40  63 68 0a 09 20 20 20 52  31 30 3d 6d 61 74 63 68  |ch..   R10=match|
00005c50  20 6f 66 66 73 65 74 0a  09 20 20 20 52 39 3d 66  | offset..   R9=f|
00005c60  69 6c 65 2e 0a 09 5c 58  20 52 65 74 75 72 6e 20  |ile...\X Return |
00005c70  52 30 3c 30 20 69 66 20  74 68 65 20 6f 66 66 73  |R0<0 if the offs|
00005c80  65 74 20 69 6e 76 61 6c  69 64 2e 0a 0a 65 5f 72  |et invalid...e_r|
00005c90  65 70 6c 61 63 65 0a 54  68 69 73 20 69 73 20 63  |eplace.This is c|
00005ca0  61 6c 6c 65 64 20 77 68  65 6e 20 74 68 65 20 75  |alled when the u|
00005cb0  73 65 72 20 77 69 73 68  65 73 20 74 6f 20 70 65  |ser wishes to pe|
00005cc0  72 66 6f 72 6d 20 61 20  73 65 61 72 63 68 20 61  |rform a search a|
00005cd0  6e 64 20 72 65 70 6c 61  63 65 2e 20 54 68 65 0a  |nd replace. The.|
00005ce0  72 65 70 6c 61 63 65 6d  65 6e 74 20 73 74 72 69  |replacement stri|
00005cf0  6e 67 20 68 61 73 20 62  65 65 6e 20 63 61 6c 63  |ng has been calc|
00005d00  75 6c 61 74 65 64 20 66  6f 72 20 79 6f 75 20 61  |ulated for you a|
00005d10  6e 64 20 69 74 20 69 73  20 79 6f 75 72 20 6a 6f  |nd it is your jo|
00005d20  62 20 74 6f 20 69 6e 73  65 72 74 0a 69 74 2e 20  |b to insert.it. |
00005d30  59 6f 75 72 20 64 65 66  61 75 6c 74 20 61 63 74  |Your default act|
00005d40  69 6f 6e 20 73 68 6f 75  6c 64 20 62 65 20 74 6f  |ion should be to|
00005d50  20 63 61 6c 6c 20 5a 61  70 5f 52 65 70 6c 61 63  | call Zap_Replac|
00005d60  65 41 72 65 61 2e 0a 09  5c 45 20 52 31 3d 66 69  |eArea...\E R1=fi|
00005d70  6c 65 20 6f 66 66 73 65  74 20 28 6f 66 20 6d 61  |le offset (of ma|
00005d80  74 63 68 29 0a 09 20 20  20 52 32 3d 6c 65 6e 67  |tch)..   R2=leng|
00005d90  74 68 20 28 6f 66 20 6d  61 74 63 68 29 0a 09 20  |th (of match).. |
00005da0  20 20 52 33 3d 72 65 70  6c 61 63 65 6d 65 6e 74  |  R3=replacement|
00005db0  20 64 61 74 61 0a 09 20  20 20 52 34 3d 72 65 70  | data..   R4=rep|
00005dc0  6c 61 63 65 6d 65 6e 74  20 6c 65 6e 67 74 68 2e  |lacement length.|
00005dd0  20 52 38 2f 52 39 0a 0a  65 5f 73 65 6c 65 63 74  | R8/R9..e_select|
00005de0  69 6f 6e 0a 54 68 69 73  20 68 61 6e 64 6c 65 73  |ion.This handles|
00005df0  20 72 65 67 69 6f 6e 20  73 65 6c 65 63 74 69 6f  | region selectio|
00005e00  6e 73 2f 73 61 76 69 6e  67 2e 20 59 6f 75 20 73  |ns/saving. You s|
00005e10  68 6f 75 6c 64 20 63 68  65 63 6b 20 74 68 65 20  |hould check the |
00005e20  76 61 6c 69 64 69 74 79  20 6f 66 20 74 68 65 0a  |validity of the.|
00005e30  73 65 6c 65 63 74 65 64  20 61 72 65 61 2c 20 63  |selected area, c|
00005e40  6f 6e 66 69 6e 69 6e 67  20 69 74 20 74 6f 20 6c  |onfining it to l|
00005e50  69 6e 65 73 2f 70 61 72  61 67 72 61 70 68 73 20  |ines/paragraphs |
00005e60  69 66 20 79 6f 75 20 77  69 73 68 2e 0a 09 5c 45  |if you wish...\E|
00005e70  20 52 30 3d 72 65 61 73  6f 6e 20 63 6f 64 65 20  | R0=reason code |
00005e80  52 38 2f 52 39 3d 77 69  6e 64 6f 77 0a 09 20 20  |R8/R9=window..  |
00005e90  20 52 30 3d 30 20 3d 3e  20 73 74 61 72 74 69 6e  | R0=0 => startin|
00005ea0  67 20 73 65 6c 65 63 74  69 6f 6e 0a 09 20 20 20  |g selection..   |
00005eb0  09 52 31 30 3d 70 72 6f  70 6f 73 65 64 20 73 74  |.R10=proposed st|
00005ec0  61 72 74 20 63 61 72 65  74 2e 20 59 6f 75 20 63  |art caret. You c|
00005ed0  61 6e 20 75 73 65 20 74  68 65 20 76 61 72 69 61  |an use the varia|
00005ee0  62 6c 65 20 63 61 72 5f  6d 6f 64 65 0a 09 20 20  |ble car_mode..  |
00005ef0  20 09 74 6f 20 66 69 6e  64 20 6f 75 74 20 69 66  | .to find out if|
00005f00  20 74 68 65 20 73 65 6c  65 63 74 69 6f 6e 20 69  | the selection i|
00005f10  73 20 6d 6f 75 73 65 20  6f 72 20 6b 65 79 62 6f  |s mouse or keybo|
00005f20  61 72 64 20 28 45 2d 56  61 72 73 29 2e 0a 09 20  |ard (E-Vars)... |
00005f30  20 20 52 30 3d 31 20 3d  3e 20 75 70 64 61 74 69  |  R0=1 => updati|
00005f40  6e 67 20 73 65 6c 65 63  74 69 6f 6e 20 73 69 7a  |ng selection siz|
00005f50  65 0a 09 20 20 20 09 52  31 30 3d 6e 65 77 20 73  |e..   .R10=new s|
00005f60  65 6c 65 63 74 69 6f 6e  20 62 6c 6f 63 6b 20 28  |election block (|
00005f70  63 61 72 5f 73 65 6c 65  63 74 69 6f 6e 29 0a 09  |car_selection)..|
00005f80  20 20 20 20 09 59 6f 75  20 6d 61 79 20 61 6c 74  |    .You may alt|
00005f90  65 72 20 74 68 65 20 63  6f 6e 74 65 6e 74 73 20  |er the contents |
00005fa0  6f 66 20 74 68 65 20 73  65 6c 65 63 74 69 6f 6e  |of the selection|
00005fb0  20 62 6c 6f 63 6b 2e 0a  09 20 20 20 52 30 3d 32  | block...   R0=2|
00005fc0  20 3d 3e 20 73 61 76 69  6e 67 20 73 65 6c 65 63  | => saving selec|
00005fd0  74 69 6f 6e 0a 09 20 20  20 09 52 33 3d 64 61 74  |tion..   .R3=dat|
00005fe0  61 20 61 64 64 72 65 73  73 20 28 61 20 68 65 61  |a address (a hea|
00005ff0  70 20 62 6c 6f 63 6b 29  0a 09 20 20 20 09 52 32  |p block)..   .R2|
00006000  3d 64 61 74 61 20 6c 65  6e 0a 20 20 20 20 20 20  |=data len.      |
00006010  20 20 20 20 20 09 52 34  3d 70 72 6f 70 6f 73 65  |     .R4=propose|
00006020  64 20 66 69 6c 65 74 79  70 65 0a 09 20 20 20 20  |d filetype..    |
00006030  20 20 20 20 59 6f 75 20  6d 61 79 20 63 68 61 6e  |    You may chan|
00006040  67 65 20 74 68 65 73 65  20 70 72 6f 76 69 64 65  |ge these provide|
00006050  64 20 52 33 20 72 65 6d  61 69 6e 73 20 61 20 68  |d R3 remains a h|
00006060  65 61 70 20 62 6c 6f 63  6b 2e 0a 09 20 20 20 20  |eap block...    |
00006070  20 20 20 20 28 65 67 20  42 41 53 49 43 20 77 69  |    (eg BASIC wi|
00006080  6c 6c 20 74 6f 6b 65 6e  69 73 65 20 69 74 29 2e  |ll tokenise it).|
00006090  0a 0a 65 5f 63 6c 69 63  6b 0a 54 68 69 73 20 69  |..e_click.This i|
000060a0  73 20 63 61 6c 6c 65 64  20 77 68 65 6e 20 74 68  |s called when th|
000060b0  65 20 75 73 65 72 20 63  6c 69 63 6b 73 20 6f 6e  |e user clicks on|
000060c0  20 79 6f 75 72 20 77 69  6e 64 6f 77 2e 20 44 65  | your window. De|
000060d0  66 61 75 6c 74 20 61 63  74 69 6f 6e 20 73 68 6f  |fault action sho|
000060e0  75 6c 64 20 62 65 0a 74  6f 20 63 61 6c 6c 20 5a  |uld be.to call Z|
000060f0  61 70 5f 44 65 66 61 75  6c 74 43 6c 69 63 6b 20  |ap_DefaultClick |
00006100  77 68 69 63 68 20 77 69  6c 6c 20 68 61 6e 64 6c  |which will handl|
00006110  65 20 52 31 3d 30 2c 31  20 61 6e 64 20 69 67 6e  |e R1=0,1 and ign|
00006120  6f 72 65 20 74 68 65 20  72 65 73 74 2e 20 43 6c  |ore the rest. Cl|
00006130  69 63 6b 73 0a 61 72 65  20 72 65 67 69 73 74 65  |icks.are registe|
00006140  72 65 64 20 74 6f 20 61  6e 79 20 64 65 70 74 68  |red to any depth|
00006150  20 73 6f 20 79 6f 75 20  73 68 6f 75 6c 64 20 6d  | so you should m|
00006160  6f 64 75 6c 6f 20 74 68  65 20 63 6c 69 63 6b 20  |odulo the click |
00006170  6e 75 6d 62 65 72 20 77  69 74 68 20 74 68 65 0a  |number with the.|
00006180  6e 75 6d 62 65 72 20 6f  66 20 75 73 65 66 75 6c  |number of useful|
00006190  20 61 63 74 69 6f 6e 73  20 79 6f 75 20 73 75 70  | actions you sup|
000061a0  70 6f 72 74 20 73 6f 20  74 68 65 79 20 63 79 63  |port so they cyc|
000061b0  6c 65 20 72 6f 75 6e 64  2e 20 44 72 61 67 73 20  |le round. Drags |
000061c0  61 72 65 20 61 6c 73 6f  0a 70 61 73 73 65 64 20  |are also.passed |
000061d0  74 6f 20 79 6f 75 2e 20  49 66 20 74 68 65 20 75  |to you. If the u|
000061e0  73 65 72 20 64 72 61 67  73 20 73 74 72 61 69 67  |ser drags straig|
000061f0  68 74 20 61 77 61 79 20  28 69 65 20 61 66 74 65  |ht away (ie afte|
00006200  72 20 31 20 63 6c 69 63  6b 29 20 74 68 65 6e 20  |r 1 click) then |
00006210  79 6f 75 0a 77 69 6c 6c  20 62 65 20 73 65 6e 74  |you.will be sent|
00006220  20 52 31 3d 30 2e 20 49  66 20 74 68 65 20 75 73  | R1=0. If the us|
00006230  65 72 20 64 72 61 67 73  20 61 66 74 65 72 20 61  |er drags after a|
00006240  20 64 6f 75 62 6c 65 20  63 6c 69 63 6b 20 74 68  | double click th|
00006250  65 6e 20 79 6f 75 20 77  69 6c 6c 0a 62 65 20 73  |en you will.be s|
00006260  65 6e 74 20 52 31 3d 32  20 61 6e 64 20 62 33 20  |ent R1=2 and b3 |
00006270  6f 66 20 52 34 20 77 69  6c 6c 20 62 65 20 73 65  |of R4 will be se|
00006280  74 2e 20 41 66 74 65 72  20 74 72 65 62 6c 65 20  |t. After treble |
00006290  63 6c 69 63 6b 20 52 31  3d 33 20 65 74 63 2e 0a  |click R1=3 etc..|
000062a0  09 5c 45 20 52 31 3d 63  6c 69 63 6b 20 64 65 70  |.\E R1=click dep|
000062b0  74 68 20 28 30 3d 73 69  6d 70 6c 65 20 64 72 61  |th (0=simple dra|
000062c0  67 20 31 3d 73 69 6e 67  6c 65 20 63 6c 69 63 6b  |g 1=single click|
000062d0  20 32 3d 64 6f 75 62 6c  65 20 63 6c 69 63 6b 20  | 2=double click |
000062e0  65 74 63 29 0a 09 20 20  20 52 32 3d 78 20 63 6f  |etc)..   R2=x co|
000062f0  6c 75 6d 6e 20 28 69 6e  63 6c 75 64 69 6e 67 20  |lumn (including |
00006300  6d 61 72 67 69 6e 29 0a  09 20 20 20 52 33 3d 79  |margin)..   R3=y|
00006310  20 72 6f 77 20 6f 66 20  63 6c 69 63 6b 20 69 6e  | row of click in|
00006320  20 77 6f 72 6b 20 61 72  65 61 20 63 68 61 72 61  | work area chara|
00006330  63 74 65 72 73 0a 09 20  20 20 52 34 3d 62 75 74  |cters..   R4=but|
00006340  74 6f 6e 73 20 20 20 62  30 3d 61 64 6a 75 73 74  |tons   b0=adjust|
00006350  20 70 72 65 73 73 65 64  0a 09 20 20 20 09 09 62  | pressed..   ..b|
00006360  31 3d 75 6e 64 65 66 69  6e 65 64 20 28 6d 65 6e  |1=undefined (men|
00006370  75 73 20 61 72 65 20 64  65 61 6c 74 20 77 69 74  |us are dealt wit|
00006380  68 20 62 79 20 5a 61 70  29 0a 09 20 20 20 09 09  |h by Zap)..   ..|
00006390  62 32 3d 73 65 6c 65 63  74 20 70 72 65 73 73 65  |b2=select presse|
000063a0  64 0a 09 20 20 20 09 09  62 33 3d 64 72 61 67 20  |d..   ..b3=drag |
000063b0  61 66 74 65 72 20 74 77  6f 20 6f 72 20 6d 6f 72  |after two or mor|
000063c0  65 20 63 6c 69 63 6b 73  20 28 67 69 76 65 6e 20  |e clicks (given |
000063d0  69 6e 20 52 31 29 0a 09  20 20 20 09 09 62 34 2d  |in R1)..   ..b4-|
000063e0  62 33 31 3d 72 65 73 65  72 76 65 64 0a 09 20 20  |b31=reserved..  |
000063f0  20 52 38 2f 52 39 3d 77  69 6e 64 6f 77 20 63 6c  | R8/R9=window cl|
00006400  69 63 6b 65 64 20 6f 6e  0a 0a 65 5f 6d 65 73 73  |icked on..e_mess|
00006410  61 67 65 0a 54 68 69 73  20 65 6e 74 72 79 20 70  |age.This entry p|
00006420  6f 69 6e 74 20 69 73 20  63 61 6c 6c 65 64 20 77  |oint is called w|
00006430  68 65 6e 20 61 6e 20 75  6e 72 65 63 6f 67 6e 69  |hen an unrecogni|
00006440  73 65 64 20 77 69 6d 70  20 6d 65 73 73 61 67 65  |sed wimp message|
00006450  20 69 73 20 72 65 63 65  69 76 65 64 20 62 79 0a  | is received by.|
00006460  7a 61 70 2e 20 54 68 65  20 6d 65 73 73 61 67 65  |zap. The message|
00006470  20 69 73 20 62 72 6f 61  64 63 61 73 74 20 74 6f  | is broadcast to|
00006480  20 61 6c 6c 20 6d 6f 64  65 73 2e 20 50 6c 65 61  | all modes. Plea|
00006490  73 65 20 49 47 4e 4f 52  45 20 28 69 65 20 72 65  |se IGNORE (ie re|
000064a0  74 75 72 6e 29 20 75 6e  6c 65 73 73 0a 79 6f 75  |turn) unless.you|
000064b0  20 75 6e 64 65 72 73 74  61 6e 64 20 74 68 65 20  | understand the |
000064c0  6d 65 73 73 61 67 65 20  6e 75 6d 62 65 72 21 21  |message number!!|
000064d0  0a 09 5c 45 20 52 30 3d  79 6f 75 72 20 6d 6f 64  |..\E R0=your mod|
000064e0  65 20 6e 75 6d 62 65 72  0a 09 20 20 20 52 31 3d  |e number..   R1=|
000064f0  6d 65 73 73 61 67 65 20  62 6c 6f 63 6b 20 28 61  |message block (a|
00006500  73 20 73 65 6e 74 20 62  79 20 77 69 6d 70 29 0a  |s sent by wimp).|
00006510  09 20 20 20 52 32 3d 6d  65 73 73 61 67 65 20 6e  |.   R2=message n|
00006520  75 6d 62 65 72 20 28 69  65 20 52 31 21 31 36 29  |umber (ie R1!16)|
00006530  0a 09 20 20 20 52 33 3d  6d 65 73 73 61 67 65 20  |..   R3=message |
00006540  74 79 70 65 20 28 31 37  20 6f 72 20 31 39 29 20  |type (17 or 19) |
00006550  61 73 20 72 65 74 75 72  6e 65 64 20 69 6e 20 52  |as returned in R|
00006560  30 20 62 79 20 77 69 6d  70 2e 0a 0a 65 5f 73 65  |0 by wimp...e_se|
00006570  74 77 69 64 74 68 0a 54  68 69 73 20 65 6e 74 72  |twidth.This entr|
00006580  79 20 70 6f 69 6e 74 20  69 73 20 75 73 65 64 20  |y point is used |
00006590  62 79 20 74 68 65 20 53  45 54 57 49 44 54 48 20  |by the SETWIDTH |
000065a0  63 6f 6d 6d 61 6e 64 20  28 43 74 72 6c 20 57 29  |command (Ctrl W)|
000065b0  20 61 6e 64 20 74 68 65  20 27 77 69 64 74 68 27  | and the 'width'|
000065c0  0a 6d 65 6e 75 20 6f 70  74 69 6f 6e 20 6f 6e 20  |.menu option on |
000065d0  74 68 65 20 64 69 73 70  6c 61 79 20 6d 65 6e 75  |the display menu|
000065e0  2e 20 49 74 20 69 73 20  63 61 6c 6c 65 64 20 74  |. It is called t|
000065f0  6f 20 72 65 61 64 20 74  68 65 20 63 75 72 72 65  |o read the curre|
00006600  6e 74 6c 79 0a 63 6f 6e  66 69 67 75 72 65 64 20  |ntly.configured |
00006610  77 69 64 74 68 20 66 6f  72 20 74 68 69 73 20 6d  |width for this m|
00006620  6f 64 65 20 28 6f 66 20  61 20 77 69 6e 64 6f 77  |ode (of a window|
00006630  20 6f 72 20 74 68 65 20  64 65 66 61 75 6c 74 20  | or the default |
00006640  61 63 63 6f 72 64 69 6e  67 20 74 6f 20 52 38 29  |according to R8)|
00006650  2c 0a 6f 72 20 69 6e 20  6f 72 64 65 72 20 74 6f  |,.or in order to|
00006660  20 73 65 74 20 74 68 65  20 63 75 72 72 65 6e 74  | set the current|
00006670  6c 79 20 63 6f 6e 66 69  67 75 72 65 64 20 77 69  |ly configured wi|
00006680  64 74 68 2e 20 59 6f 75  20 73 68 6f 75 6c 64 20  |dth. You should |
00006690  61 63 63 65 73 73 20 74  68 69 73 0a 77 69 64 74  |access this.widt|
000066a0  68 20 62 79 20 6c 6f 6f  6b 69 6e 67 20 61 74 20  |h by looking at |
000066b0  79 6f 75 72 20 6d 6f 64  65 20 77 6f 72 64 20 77  |your mode word w|
000066c0  5f 6d 6f 64 65 6e 20 69  66 20 74 68 61 74 27 73  |_moden if that's|
000066d0  20 77 68 65 72 65 20 79  6f 75 20 6b 65 65 70 20  | where you keep |
000066e0  69 74 2c 20 6f 72 0a 75  73 69 6e 67 20 5a 61 70  |it, or.using Zap|
000066f0  5f 4d 6f 64 65 44 61 74  61 20 69 66 20 79 6f 75  |_ModeData if you|
00006700  20 6b 65 65 70 20 69 74  20 69 6e 20 74 68 65 20  | keep it in the |
00006710  70 6c 61 63 65 20 70 72  6f 76 69 64 65 64 20 62  |place provided b|
00006720  79 20 5a 61 70 20 28 74  68 69 73 20 69 73 20 74  |y Zap (this is t|
00006730  68 65 0a 64 65 66 61 75  6c 74 20 61 63 74 69 6f  |he.default actio|
00006740  6e 20 6f 66 20 74 68 65  20 74 65 78 74 20 6d 6f  |n of the text mo|
00006750  64 65 20 65 6e 74 72 79  20 70 6f 69 6e 74 29 2e  |de entry point).|
00006760  20 46 6f 6c 6c 6f 77 69  6e 67 20 74 68 69 73 20  | Following this |
00006770  63 61 6c 6c 2c 20 74 68  65 20 65 64 69 74 6f 72  |call, the editor|
00006780  0a 77 69 6e 64 6f 77 20  69 6e 20 71 75 65 73 74  |.window in quest|
00006790  69 6f 6e 20 77 69 6c 6c  20 62 65 20 72 65 63 72  |ion will be recr|
000067a0  65 61 74 65 64 20 61 75  74 6f 6d 61 74 69 63 61  |eated automatica|
000067b0  6c 6c 79 20 61 6e 64 20  79 6f 75 72 20 65 5f 77  |lly and your e_w|
000067c0  69 64 74 68 20 65 6e 74  72 79 0a 70 6f 69 6e 74  |idth entry.point|
000067d0  20 77 69 6c 6c 20 62 65  20 63 61 6c 6c 65 64 20  | will be called |
000067e0  74 6f 20 63 61 6c 63 75  6c 61 74 65 20 74 68 65  |to calculate the|
000067f0  20 61 63 74 75 61 6c 20  64 69 73 70 6c 61 79 20  | actual display |
00006800  77 69 64 74 68 20 61 73  20 75 73 75 61 6c 2e 0a  |width as usual..|
00006810  09 5c 45 20 52 30 3d 6e  65 77 20 77 69 64 74 68  |.\E R0=new width|
00006820  20 75 73 65 72 20 77 61  6e 74 73 20 6f 72 20 2d  | user wants or -|
00006830  31 20 74 6f 20 72 65 61  64 20 74 68 65 20 63 75  |1 to read the cu|
00006840  72 72 65 6e 74 20 77 69  64 74 68 0a 09 20 20 20  |rrent width..   |
00006850  52 38 2d 52 39 3d 77 69  6e 64 6f 77 2f 30 20 69  |R8-R9=window/0 i|
00006860  66 20 69 74 20 69 73 20  74 68 65 20 64 65 66 61  |f it is the defa|
00006870  75 6c 74 20 77 69 64 74  68 20 62 65 69 6e 67 20  |ult width being |
00006880  63 68 61 6e 67 65 64 2e  0a 09 5c 58 20 52 30 3d  |changed...\X R0=|
00006890  63 75 72 72 65 6e 74 20  77 69 64 74 68 20 69 66  |current width if|
000068a0  20 69 74 20 77 61 73 20  2d 31 20 6f 6e 20 65 6e  | it was -1 on en|
000068b0  74 72 79 2e 0a 0a 65 5f  6c 69 73 74 66 6e 73 0a  |try...e_listfns.|
000068c0  54 68 69 73 20 69 73 20  63 61 6c 6c 65 64 20 77  |This is called w|
000068d0  68 65 6e 20 74 68 65 20  63 6f 6d 6d 61 6e 64 20  |hen the command |
000068e0  4c 49 53 54 46 4e 53 20  69 73 20 70 72 65 73 73  |LISTFNS is press|
000068f0  65 64 2e 20 5c 45 20 5c  58 20 61 73 20 66 6f 72  |ed. \E \X as for|
00006900  20 65 5f 74 61 62 2e 20  54 68 65 0a 6d 6f 64 65  | e_tab. The.mode|
00006910  20 73 68 6f 75 6c 64 20  6f 70 65 6e 20 61 20 74  | should open a t|
00006920  68 72 6f 77 62 61 63 6b  20 62 75 66 66 65 72 20  |hrowback buffer |
00006930  77 69 74 68 20 61 20 6c  69 73 74 20 6f 66 20 66  |with a list of f|
00006940  75 6e 63 74 69 6f 6e 20  64 65 66 69 6e 69 74 69  |unction definiti|
00006950  6f 6e 73 20 69 6e 2e 0a  28 65 67 20 55 73 65 20  |ons in..(eg Use |
00006960  5a 61 70 5f 53 65 61 72  63 68 29 2e 0a 0a 65 5f  |Zap_Search)...e_|
00006970  70 72 65 76 6c 69 6e 65  0a 54 68 69 73 20 65 6e  |prevline.This en|
00006980  74 72 79 20 70 6f 69 6e  74 20 69 73 20 75 73 65  |try point is use|
00006990  64 20 69 6e 20 63 6f 6e  6a 75 6e 63 74 69 6f 6e  |d in conjunction|
000069a0  20 77 69 74 68 20 65 5f  6e 65 78 74 6c 69 6e 65  | with e_nextline|
000069b0  20 74 6f 20 66 69 6e 64  20 74 68 65 20 61 72 65  | to find the are|
000069c0  61 20 6f 6e 0a 74 68 65  20 73 63 72 65 65 6e 20  |a on.the screen |
000069d0  77 68 69 63 68 20 6e 65  65 64 73 20 74 6f 20 62  |which needs to b|
000069e0  65 20 75 70 64 61 74 65  64 20 61 66 74 65 72 20  |e updated after |
000069f0  61 6e 20 69 6e 73 65 72  74 69 6f 6e 2f 64 65 6c  |an insertion/del|
00006a00  65 74 69 6f 6e 2e 20 49  74 20 74 65 6c 6c 73 0a  |etion. It tells.|
00006a10  79 6f 75 20 69 6e 20 52  30 20 74 68 65 20 66 69  |you in R0 the fi|
00006a20  72 73 74 20 66 69 6c 65  20 6f 66 66 73 65 74 20  |rst file offset |
00006a30  62 65 69 6e 67 20 63 68  61 6e 67 65 64 20 61 6e  |being changed an|
00006a40  64 20 79 6f 75 20 6d 75  73 74 20 74 65 6c 6c 20  |d you must tell |
00006a50  69 74 20 74 68 65 20 66  69 72 73 74 0a 66 69 6c  |it the first.fil|
00006a60  65 20 6f 66 66 73 65 74  20 28 3c 3d 52 30 29 20  |e offset (<=R0) |
00006a70  74 6f 20 73 74 61 72 74  20 75 70 64 61 74 69 6e  |to start updatin|
00006a80  67 20 74 68 65 20 73 63  72 65 65 6e 20 66 72 6f  |g the screen fro|
00006a90  6d 2e 20 55 73 75 61 6c  6c 79 20 79 6f 75 20 77  |m. Usually you w|
00006aa0  69 6c 6c 20 6a 75 73 74  0a 6c 65 61 76 65 20 52  |ill just.leave R|
00006ab0  30 20 75 6e 63 68 61 6e  67 65 64 20 62 75 74 20  |0 unchanged but |
00006ac0  69 6e 20 74 68 65 20 63  61 73 65 20 6f 66 20 61  |in the case of a|
00006ad0  20 6d 6f 64 65 20 75 73  69 6e 67 20 63 6f 6c 6f  | mode using colo|
00006ae0  75 72 73 20 2d 20 77 68  65 72 65 20 63 68 61 6e  |urs - where chan|
00006af0  67 69 6e 67 20 61 0a 63  68 61 72 61 63 74 65 72  |ging a.character|
00006b00  20 6c 61 74 65 72 20 6f  6e 20 69 6e 20 74 68 65  | later on in the|
00006b10  20 6c 69 6e 65 20 6d 61  79 20 61 66 66 65 63 74  | line may affect|
00006b20  20 65 61 72 6c 69 65 72  20 63 6f 6c 6f 75 72 73  | earlier colours|
00006b30  20 2d 20 79 6f 75 20 6d  61 79 20 77 61 6e 74 20  | - you may want |
00006b40  74 6f 0a 73 65 74 20 74  68 69 73 20 74 6f 20 74  |to.set this to t|
00006b50  68 65 20 73 74 61 72 74  20 6f 66 20 74 68 65 20  |he start of the |
00006b60  63 75 72 72 65 6e 74 20  6c 6f 67 69 63 61 6c 20  |current logical |
00006b70  6c 69 6e 65 2e 20 54 68  65 20 63 61 63 68 65 20  |line. The cache |
00006b80  72 65 66 65 72 65 6e 63  65 20 70 6f 69 6e 74 0a  |reference point.|
00006b90  28 77 5f 63 6c 69 6e 65  2f 77 5f 63 6f 66 66 29  |(w_cline/w_coff)|
00006ba0  20 69 73 20 6d 6f 76 65  64 20 73 6f 20 74 68 61  | is moved so tha|
00006bb0  74 20 69 74 20 69 73 20  6d 6f 73 74 20 52 30 2c  |t it is most R0,|
00006bc0  20 61 6e 64 20 69 73 20  74 68 75 73 20 6e 6f 74  | and is thus not|
00006bd0  20 63 6f 72 72 75 70 74  65 64 20 62 79 0a 74 68  | corrupted by.th|
00006be0  65 20 69 6e 73 65 72 74  69 6f 6e 2f 64 65 6c 65  |e insertion/dele|
00006bf0  74 69 6f 6e 2e 20 49 66  20 79 6f 75 20 77 69 73  |tion. If you wis|
00006c00  68 20 74 6f 20 6d 6f 76  65 20 69 74 20 66 75 72  |h to move it fur|
00006c10  74 68 65 72 20 62 61 63  6b 20 28 65 67 20 69 66  |ther back (eg if|
00006c20  20 61 20 63 6f 6e 74 72  6f 6c 0a 63 6f 64 65 20  | a control.code |
00006c30  6c 61 74 65 72 20 69 6e  20 61 20 6c 69 6e 65 20  |later in a line |
00006c40  65 66 66 65 63 74 73 20  74 68 65 20 66 6f 72 6d  |effects the form|
00006c50  61 74 74 69 6e 67 20 6f  66 20 65 61 72 6c 69 65  |atting of earlie|
00006c60  72 20 62 69 74 73 29 20  74 68 65 6e 20 6e 6f 77  |r bits) then now|
00006c70  20 69 73 20 74 68 65 0a  74 69 6d 65 20 74 6f 20  | is the.time to |
00006c80  64 6f 20 73 6f 20 2d 20  76 69 61 20 5a 61 70 5f  |do so - via Zap_|
00006c90  43 6c 69 70 43 61 63 68  65 2e 0a 20 65 5f 70 72  |ClipCache.. e_pr|
00006ca0  65 76 6c 69 6e 65 20 69  73 20 63 61 6c 6c 65 64  |evline is called|
00006cb0  20 62 65 66 6f 72 65 20  65 5f 6e 65 78 74 6c 69  | before e_nextli|
00006cc0  6e 65 2e 20 43 6f 6d 70  6c 69 63 61 74 65 64 20  |ne. Complicated |
00006cd0  63 6f 6c 6f 75 72 69 6e  67 20 6d 6f 64 65 73 20  |colouring modes |
00006ce0  28 65 67 0a 63 6f 6c 6f  75 72 20 43 20 6d 6f 64  |(eg.colour C mod|
00006cf0  65 29 20 6e 65 65 64 20  74 6f 20 6b 6e 6f 77 20  |e) need to know |
00006d00  77 68 61 74 20 64 61 74  61 20 69 73 20 62 65 69  |what data is bei|
00006d10  6e 67 20 69 6e 73 65 72  74 65 64 2f 64 65 6c 65  |ng inserted/dele|
00006d20  74 65 64 20 74 6f 20 64  65 63 69 64 65 0a 77 68  |ted to decide.wh|
00006d30  61 74 20 74 6f 20 72 65  74 75 72 6e 20 66 6f 72  |at to return for|
00006d40  20 65 5f 70 72 65 76 6c  69 6e 65 2f 65 5f 6e 65  | e_prevline/e_ne|
00006d50  78 74 6c 69 6e 65 2e 20  54 6f 20 6d 61 6b 65 20  |xtline. To make |
00006d60  74 68 69 73 20 70 6f 73  73 69 62 6c 65 2c 20 74  |this possible, t|
00006d70  68 65 0a 66 6f 6c 6c 77  69 6e 67 20 64 61 74 61  |he.follwing data|
00006d80  20 69 73 20 61 76 61 69  6c 61 62 6c 65 3a 0a 20  | is available:. |
00006d90  66 5f 64 6f 63 6f 6d 3d  74 68 65 20 63 6f 6d 6d  |f_docom=the comm|
00006da0  61 6e 64 20 63 75 72 72  65 6e 74 6c 79 20 62 65  |and currently be|
00006db0  69 6e 67 20 65 78 65 63  75 74 65 64 3a 0a 20 30  |ing executed:. 0|
00006dc0  2c 3e 35 3d 6e 6f 6e 65  20 20 20 3d 3e 20 74 65  |,>5=none   => te|
00006dd0  78 74 20 6e 6f 74 20 63  68 61 6e 67 69 6e 67 20  |xt not changing |
00006de0  28 6a 75 73 74 20 72 65  74 75 72 6e 20 77 69 74  |(just return wit|
00006df0  68 20 52 30 20 70 72 65  73 65 72 76 65 64 29 2e  |h R0 preserved).|
00006e00  0a 20 31 3d 69 6e 73 65  72 74 69 6f 6e 20 3d 3e  |. 1=insertion =>|
00006e10  20 52 30 3d 6f 66 66 73  65 74 20 74 68 61 74 20  | R0=offset that |
00006e20  74 65 78 74 20 69 73 20  62 65 69 6e 67 20 69 6e  |text is being in|
00006e30  73 65 72 74 65 64 20 61  74 0a 20 09 09 66 5f 64  |serted at. ..f_d|
00006e40  6f 6c 65 6e 3d 6e 75 6d  62 65 72 20 6f 66 20 63  |olen=number of c|
00006e50  68 61 72 61 63 74 65 72  73 20 62 65 69 6e 67 20  |haracters being |
00006e60  69 6e 73 65 72 74 65 64  0a 20 09 09 66 5f 64 6f  |inserted. ..f_do|
00006e70  64 61 74 61 3d 70 6f 69  6e 74 65 72 20 74 6f 20  |data=pointer to |
00006e80  74 68 65 20 74 65 78 74  20 62 65 69 6e 67 20 69  |the text being i|
00006e90  6e 73 65 72 74 65 64 0a  20 09 09 46 69 6c 65 20  |nserted. ..File |
00006ea0  69 73 20 73 70 6c 69 74  20 61 74 20 74 68 65 20  |is split at the |
00006eb0  6f 66 66 73 65 74 20 52  30 20 77 69 74 68 20 73  |offset R0 with s|
00006ec0  70 6c 69 74 20 73 69 7a  65 20 3e 3d 20 66 5f 64  |plit size >= f_d|
00006ed0  6f 6c 65 6e 2e 0a 20 32  3d 64 65 6c 65 74 69 6f  |olen.. 2=deletio|
00006ee0  6e 20 20 3d 3e 20 52 30  3d 6f 66 66 73 65 74 20  |n  => R0=offset |
00006ef0  6f 66 20 73 74 61 72 74  20 6f 66 20 62 6c 6f 63  |of start of bloc|
00006f00  6b 20 74 6f 20 64 65 6c  65 74 65 0a 20 09 09 66  |k to delete. ..f|
00006f10  5f 64 6f 6c 65 6e 3d 6e  75 6d 62 65 72 20 6f 66  |_dolen=number of|
00006f20  20 63 68 61 72 61 63 74  65 72 73 20 62 65 69 6e  | characters bein|
00006f30  67 20 64 65 6c 65 74 65  64 0a 20 09 09 46 69 6c  |g deleted. ..Fil|
00006f40  65 20 69 73 20 73 70 6c  69 74 20 61 74 20 52 30  |e is split at R0|
00006f50  2b 66 5f 64 6f 6c 65 6e  20 77 69 74 68 20 73 70  |+f_dolen with sp|
00006f60  6c 69 74 20 73 69 7a 65  20 3e 3d 30 2e 0a 20 33  |lit size >=0.. 3|
00006f70  2f 34 3d 72 65 70 6c 61  63 65 20 3d 3e 20 52 30  |/4=replace => R0|
00006f80  3d 6f 66 66 73 65 74 20  6f 66 20 73 74 61 72 74  |=offset of start|
00006f90  20 6f 66 20 62 6c 6f 63  6b 20 74 6f 20 72 65 70  | of block to rep|
00006fa0  6c 61 63 65 0a 20 09 09  66 5f 64 6f 6c 65 6e 3d  |lace. ..f_dolen=|
00006fb0  6e 75 6d 62 65 72 20 6f  66 20 63 68 61 72 61 63  |number of charac|
00006fc0  74 65 72 73 20 74 6f 20  72 65 70 6c 61 63 65 0a  |ters to replace.|
00006fd0  20 09 09 66 5f 64 6f 64  61 74 61 3d 72 65 70 6c  | ..f_dodata=repl|
00006fe0  61 63 65 6d 65 6e 74 20  62 6c 6f 63 6b 0a 20 09  |acement block. .|
00006ff0  09 46 69 6c 65 20 69 73  20 73 70 6c 69 74 20 61  |.File is split a|
00007000  74 20 52 30 2b 66 5f 64  6f 6c 65 6e 20 77 69 74  |t R0+f_dolen wit|
00007010  68 20 73 70 6c 69 74 20  73 69 7a 65 20 3e 3d 20  |h split size >= |
00007020  66 5f 64 6f 6c 65 6e 2e  0a 09 5c 45 20 52 30 3d  |f_dolen...\E R0=|
00007030  46 69 72 73 74 20 63 68  61 6e 67 65 64 20 6f 66  |First changed of|
00007040  66 73 65 74 20 69 6e 20  74 68 65 20 66 69 6c 65  |fset in the file|
00007050  2e 20 52 38 2f 52 39 0a  09 5c 58 20 52 30 3d 4f  |. R8/R9..\X R0=O|
00007060  66 66 73 65 74 20 74 6f  20 73 74 61 72 74 20 75  |ffset to start u|
00007070  70 64 61 74 69 6e 67 20  74 68 65 20 73 63 72 65  |pdating the scre|
00007080  65 6e 20 66 72 6f 6d 2e  0a 09 20 20 20 59 6f 75  |en from...   You|
00007090  20 6d 75 73 74 20 70 72  65 73 65 72 76 65 20 74  | must preserve t|
000070a0  68 65 20 73 70 6c 69 74  20 6f 66 66 73 65 74 20  |he split offset |
000070b0  61 6e 64 20 73 70 6c 69  74 20 73 69 7a 65 20 6f  |and split size o|
000070c0  66 20 74 68 65 20 66 69  6c 65 2e 0a              |f the file..|
000070cc